File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2323import types
2424
2525from fire import docstrings
26+ from typing import get_args
2627
2728import six
2829
@@ -143,7 +144,7 @@ def Py3GetFullArgSpec(fn):
143144
144145 if sig .return_annotation is not sig .empty :
145146 annotations ['return' ] = sig .return_annotation
146-
147+
147148 for param in sig .parameters .values ():
148149 kind = param .kind
149150 name = param .name
@@ -165,6 +166,10 @@ def Py3GetFullArgSpec(fn):
165166 varkw = name
166167 if param .annotation is not param .empty :
167168 annotations [name ] = param .annotation
169+ if "Union" in str (annotations [name ]):
170+ union_type_tuple = get_args (annotations [name ])
171+ annotations [name ] = union_type_tuple [0 ]
172+
168173 # pylint: enable=protected-access
169174
170175 if not kwdefaults :
You can’t perform that action at this time.
0 commit comments