File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,6 @@ def Py3GetFullArgSpec(fn):
144
144
145
145
if sig .return_annotation is not sig .empty :
146
146
annotations ['return' ] = sig .return_annotation
147
-
148
147
for param in sig .parameters .values ():
149
148
kind = param .kind
150
149
name = param .name
@@ -166,10 +165,13 @@ def Py3GetFullArgSpec(fn):
166
165
varkw = name
167
166
if param .annotation is not param .empty :
168
167
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
+ if "Optional" in str (annotations [name ]) or "Union" in str (annotations [name ]):
169
+ tuple_param1 = get_args (annotations [name ])[0 ].__name__
170
+ tuple_param2 = get_args (annotations [name ])[1 ].__name__
171
+ if str (tuple_param2 ) != "NoneType" :
172
+ annotations [name ] = tuple_param1 + ", " + tuple_param2
173
+ else :
174
+ annotations [name ] = tuple_param
173
175
# pylint: enable=protected-access
174
176
175
177
if not kwdefaults :
You can’t perform that action at this time.
0 commit comments