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 821b06d commit 18178cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 11 additions & 5 deletions typer/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
TYPE_CHECKING,
AbstractSet,
Any,
Callable as TypingCallable,
ClassVar,
Dict,
ForwardRef,
Expand All @@ -26,9 +25,16 @@
Union,
_eval_type,
cast,
get_type_hints,
)
from typing import (
Callable as TypingCallable,
)
from typing import (
get_args as _typing_get_args,
)
from typing import (
get_origin as _typing_get_origin,
get_type_hints,
)

from typing_extensions import Annotated, Literal
Expand Down Expand Up @@ -108,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 @@ -122,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 @@ -369,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
1 change: 0 additions & 1 deletion typer/rich_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from rich.text import Text
from rich.theme import Theme


# Default styles
STYLE_OPTION = "bold cyan"
STYLE_SWITCH = "bold green"
Expand Down

0 comments on commit 18178cf

Please sign in to comment.