Skip to content

Commit

Permalink
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed May 15, 2024
1 parent 314f504 commit 2e8fcdd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions typer/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _generic_get_args(tp: Type[Any]) -> Tuple[Any, ...]:
return (Any,) * tp._nparams
return ()


def get_args(tp: Type[Any]) -> Tuple[Any, ...]:
"""Get type arguments with all substitutions performed.
Expand All @@ -128,9 +129,7 @@ def get_args(tp: Type[Any]) -> Tuple[Any, ...]:
if type(tp).__name__ in AnnotatedTypeNames:
return tp.__args__ + tp.__metadata__
# the fallback is needed for the same reasons as `get_origin` (see above)
return (
_typing_get_args(tp) or getattr(tp, "__args__", ()) or _generic_get_args(tp)
)
return _typing_get_args(tp) or getattr(tp, "__args__", ()) or _generic_get_args(tp)


if sys.version_info[:2] == (3, 8):
Expand Down Expand Up @@ -375,6 +374,7 @@ def is_literal_type(type_: Type[Any]) -> bool:
and type_ == Literal[type_.__values__]
)


def literal_values(type_: Type[Any]) -> Tuple[Any, ...]:
return type_.__values__

Expand Down

0 comments on commit 2e8fcdd

Please sign in to comment.