Skip to content

Commit

Permalink
committing latest changes for supporting python 3.9+
Browse files Browse the repository at this point in the history
  • Loading branch information
damienjburks committed Jan 24, 2022
1 parent 13f52fe commit 2d4c679
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions fire/inspectutils.py
Expand Up @@ -144,7 +144,6 @@ def Py3GetFullArgSpec(fn):

if sig.return_annotation is not sig.empty:
annotations['return'] = sig.return_annotation

for param in sig.parameters.values():
kind = param.kind
name = param.name
Expand All @@ -166,10 +165,13 @@ def Py3GetFullArgSpec(fn):
varkw = name
if param.annotation is not param.empty:
annotations[name] = param.annotation
if "Union" in str(annotations[name]):
union_type_tuple = get_args(annotations[name])
annotations[name] = union_type_tuple[0]

if "Optional" in str(annotations[name]) or "Union" in str(annotations[name]):
tuple_param1 = get_args(annotations[name])[0].__name__
tuple_param2 = get_args(annotations[name])[1].__name__
if str(tuple_param2) != "NoneType":
annotations[name] = tuple_param1 + ", " + tuple_param2
else:
annotations[name] = tuple_param
# pylint: enable=protected-access

if not kwdefaults:
Expand Down

0 comments on commit 2d4c679

Please sign in to comment.