Skip to content

Commit

Permalink
Simplify Union of Literal types (#4246)
Browse files Browse the repository at this point in the history
  • Loading branch information
apepenkov committed Nov 9, 2023
1 parent 4f4db02 commit 35fd0cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/src/telethon/_impl/client/events/filters/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ class Media(Combinable):
__slots__ = "_types"

def __init__(
self, *types: Union[Literal["photo"], Literal["audio"], Literal["video"]]
self, *types: Literal["photo", "audio", "video"]
) -> None:
self._types = types or None

@property
def types(
self,
) -> Tuple[Union[Literal["photo"], Literal["audio"], Literal["video"]], ...]:
) -> Tuple[Literal["photo", "audio", "video"], ...]:
"""
The media types being checked.
"""
Expand Down
2 changes: 1 addition & 1 deletion client/src/telethon/_impl/session/message_box/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __repr__(self) -> str:

ENTRY_ACCOUNT: Literal["ACCOUNT"] = "ACCOUNT"
ENTRY_SECRET: Literal["SECRET"] = "SECRET"
Entry = Union[Literal["ACCOUNT"], Literal["SECRET"], int]
Entry = Union[Literal["ACCOUNT", "SECRET"], int]

# Python's logging doesn't define a TRACE level. Pick halfway between DEBUG and NOTSET.
# We don't define a name for this as libraries shouldn't do that though.
Expand Down

0 comments on commit 35fd0cc

Please sign in to comment.