Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f47303

Browse files
committed
Vendor removed typing._allowed_types
1 parenta11d284 commit4f47303

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎fastcore/basics.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
# %% ../nbs/01_basics.ipynb
3434
defaults=SimpleNamespace()
3535

36+
_allowed_types= (types.FunctionType,types.BuiltinFunctionType,
37+
types.MethodType,types.ModuleType,
38+
WrapperDescriptorType,MethodWrapperType,MethodDescriptorType)
39+
3640
# %% ../nbs/01_basics.ipynb
3741
defifnone(a,b):
3842
"`b` if `a` is None else `a`"
@@ -352,7 +356,7 @@ def _eval_type(t, glb, loc):
352356

353357
deftype_hints(f):
354358
"Like `typing.get_type_hints` but returns `{}` if not allowed type"
355-
ifnotisinstance(f,typing._allowed_types):return {}
359+
ifnotisinstance(f,_allowed_types):return {}
356360
ann,glb,loc=get_annotations_ex(f)
357361
return {k:_eval_type(v,glb,loc)fork,vinann.items()}
358362

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp