Skip to content

Commit 9336a59

Browse files
committed
dispatch object
1 parent 5086d41 commit 9336a59

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

fastcore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.3"
1+
__version__ = "1.2.4"

fastcore/dispatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def anno_ret(func):
2525
# Cell
2626
def lenient_issubclass(cls, types):
2727
"If possible return whether `cls` is a subclass of `types`, otherwise return False."
28-
if cls is object and types is type: return False # treat `object` as higher level than `type`
28+
if cls is object and types is not object: return False # treat `object` as highest level
2929
try: return isinstance(cls, types) or issubclass(cls, types)
3030
except: return False
3131

nbs/03_dispatch.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
"#export\n",
204204
"def lenient_issubclass(cls, types):\n",
205205
" \"If possible return whether `cls` is a subclass of `types`, otherwise return False.\"\n",
206-
" if cls is object and types is type: return False # treat `object` as higher level than `type`\n",
206+
" if cls is object and types is not object: return False # treat `object` as highest level\n",
207207
" try: return isinstance(cls, types) or issubclass(cls, types)\n",
208208
" except: return False"
209209
]
@@ -229,7 +229,8 @@
229229
"assert lenient_issubclass(list, typing.Collection)\n",
230230
"assert lenient_issubclass(typing.Collection, object)\n",
231231
"assert lenient_issubclass(typing.List, typing.Collection)\n",
232-
"assert not lenient_issubclass(typing.Collection, typing.List)"
232+
"assert not lenient_issubclass(typing.Collection, typing.List)\n",
233+
"assert not lenient_issubclass(object, typing.Callable)"
233234
]
234235
},
235236
{

settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author = Jeremy Howard and Sylvain Gugger
77
author_email = [email protected]
88
copyright = fast.ai
99
branch = master
10-
version = 1.2.3
10+
version = 1.2.4
1111
min_python = 3.6
1212
audience = Developers
1313
language = English

0 commit comments

Comments
 (0)