Skip to content

Commit

Permalink
isinstance() checks instead of ==
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Aug 21, 2024
1 parent fbd9032 commit 5a65c44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions typer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,9 @@ def get_click_type(
elif parameter_info.parser is not None:
return click.types.FuncParamType(parameter_info.parser)

elif annotation == str:
elif isinstance(annotation, str):
return click.STRING
elif annotation == int:
elif isinstance(annotation, int):
if parameter_info.min is not None or parameter_info.max is not None:
min_ = None
max_ = None
Expand All @@ -718,7 +718,7 @@ def get_click_type(
return click.IntRange(min=min_, max=max_, clamp=parameter_info.clamp)
else:
return click.INT
elif annotation == float:
elif isinstance(annotation, float):
if parameter_info.min is not None or parameter_info.max is not None:
return click.FloatRange(
min=parameter_info.min,
Expand All @@ -727,7 +727,7 @@ def get_click_type(
)
else:
return click.FLOAT
elif annotation == bool:
elif isinstance(annotation, bool):
return click.BOOL
elif annotation == UUID:
return click.UUID
Expand Down

0 comments on commit 5a65c44

Please sign in to comment.