Skip to content

Commit

Permalink
Fix branching
Browse files Browse the repository at this point in the history
  • Loading branch information
kinuax committed May 20, 2024
1 parent 36c4439 commit 5facc11
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions typer/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,11 @@ def is_callable_type(type_: Type[Any]) -> bool:


def is_literal_type(type_: Type[Any]) -> bool:
return (
Literal is not None
and hasattr(type_, "__values__")
and type_ == Literal[type_.__values__]
)
return Literal is not None and get_origin(type_) is Literal


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


def all_literal_values(type_: Type[Any]) -> Tuple[Any, ...]:
Expand Down

0 comments on commit 5facc11

Please sign in to comment.