File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
azure/functions/decorators Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ def unwrap_optional(pytype: type):
4444 """If Optional[T], return T; else return pytype unchanged."""
4545 origin = get_origin (pytype )
4646 args = get_args (pytype )
47- if origin is Union and any (a is type (None ) for a in args ):
48- non_none_args = [a for a in args if a is not type (None )]
47+ if isinstance ( origin , Union ) and any (isinstance ( a , type (None ) ) for a in args ):
48+ non_none_args = [a for a in args if not isinstance ( a , type (None ) )]
4949 return non_none_args [0 ] if non_none_args else str
5050 return pytype
5151
@@ -85,7 +85,7 @@ def check_is_required(param: type, param_type_hint: type) -> bool:
8585 # 2) Optional[T] => not required
8686 origin = get_origin (param_type_hint )
8787 args = get_args (param_type_hint )
88- if origin is Union and any (a is type (None ) for a in args ):
88+ if isinstance ( origin , Union ) and any (isinstance ( a , type (None ) ) for a in args ):
8989 return False
9090
9191 # 3) It's required
You can’t perform that action at this time.
0 commit comments