File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,6 @@ def Py3GetFullArgSpec(fn):
144144
145145 if sig .return_annotation is not sig .empty :
146146 annotations ['return' ] = sig .return_annotation
147-
148147 for param in sig .parameters .values ():
149148 kind = param .kind
150149 name = param .name
@@ -166,10 +165,13 @@ def Py3GetFullArgSpec(fn):
166165 varkw = name
167166 if param .annotation is not param .empty :
168167 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
173175 # pylint: enable=protected-access
174176
175177 if not kwdefaults :
You can’t perform that action at this time.
0 commit comments