Skip to content

Commit

Permalink
Vendor removed typing._allowed_types
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Nov 30, 2024
1 parent 4f47303 commit e34eb85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nbs/01_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
"outputs": [],
"source": [
"#|export\n",
"defaults = SimpleNamespace()"
"defaults = SimpleNamespace()\n",
"\n",
"_allowed_types = (types.FunctionType, types.BuiltinFunctionType,\n",
" types.MethodType, types.ModuleType,\n",
" WrapperDescriptorType, MethodWrapperType, MethodDescriptorType)"
]
},
{
Expand Down Expand Up @@ -1870,7 +1874,7 @@
"\n",
"def type_hints(f):\n",
" \"Like `typing.get_type_hints` but returns `{}` if not allowed type\"\n",
" if not isinstance(f, typing._allowed_types): return {}\n",
" if not isinstance(f, _allowed_types): return {}\n",
" ann,glb,loc = get_annotations_ex(f)\n",
" return {k:_eval_type(v,glb,loc) for k,v in ann.items()}"
]
Expand Down

0 comments on commit e34eb85

Please sign in to comment.