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 23
23
import types
24
24
25
25
from fire import docstrings
26
+ from typing import get_args
26
27
27
28
import six
28
29
@@ -143,7 +144,7 @@ def Py3GetFullArgSpec(fn):
143
144
144
145
if sig .return_annotation is not sig .empty :
145
146
annotations ['return' ] = sig .return_annotation
146
-
147
+
147
148
for param in sig .parameters .values ():
148
149
kind = param .kind
149
150
name = param .name
@@ -165,6 +166,10 @@ def Py3GetFullArgSpec(fn):
165
166
varkw = name
166
167
if param .annotation is not param .empty :
167
168
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
+
168
173
# pylint: enable=protected-access
169
174
170
175
if not kwdefaults :
You can’t perform that action at this time.
0 commit comments