Skip to content

Commit ef394ed

Browse files
committed
lint
1 parent 63f80c3 commit ef394ed

File tree

1 file changed

+3
-3
lines changed
  • azure/functions/decorators

1 file changed

+3
-3
lines changed

azure/functions/decorators/mcp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)