Skip to content

Commit 5077372

Browse files
authored
Merge pull request #584 from ababino/listify-bytes
do not list bytes
2 parents 63953af + a165d2b commit 5077372

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Welcome to fastcore
2-
================
1+
# Welcome to fastcore
2+
33

44
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
55

@@ -19,9 +19,9 @@ Anaconda, which we recommend) or `pip install fastcore`. For an
1919
[editable
2020
install](https://stackoverflow.com/questions/35064426/when-would-the-e-editable-option-be-useful-with-pip-install),
2121
clone this repo and run: `pip install -e ".[dev]"`. fastcore is tested
22-
to work on Ubuntu, macOS and Windows (versions tested are those show
22+
to work on Ubuntu, macOS and Windows (versions tested are those shown
2323
with the `-latest` suffix
24-
[here](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources).
24+
[here](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources)).
2525

2626
`fastcore` contains many features, including:
2727

fastcore/basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def listify(o=None, *rest, use_list=False, match=None):
6262
if use_list: res = list(o)
6363
elif o is None: res = []
6464
elif isinstance(o, list): res = o
65-
elif isinstance(o, str) or is_array(o): res = [o]
65+
elif isinstance(o, str) or isinstance(o, bytes) or is_array(o): res = [o]
6666
elif is_iter(o): res = list(o)
6767
else: res = [o]
6868
if match is not None:

nbs/01_basics.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
" if use_list: res = list(o)\n",
273273
" elif o is None: res = []\n",
274274
" elif isinstance(o, list): res = o\n",
275-
" elif isinstance(o, str) or is_array(o): res = [o]\n",
275+
" elif isinstance(o, str) or isinstance(o, bytes) or is_array(o): res = [o]\n",
276276
" elif is_iter(o): res = list(o)\n",
277277
" else: res = [o]\n",
278278
" if match is not None:\n",
@@ -296,6 +296,7 @@
296296
"outputs": [],
297297
"source": [
298298
"test_eq(listify('hi'), ['hi'])\n",
299+
"test_eq(listify(b'hi'), [b'hi'])\n",
299300
"test_eq(listify(array(1)), [array(1)])\n",
300301
"test_eq(listify(1), [1])\n",
301302
"test_eq(listify([1,2]), [1,2])\n",

0 commit comments

Comments
 (0)