Simplify Union of Literal types (#4246)

This commit is contained in:
apepenkov 2023-11-09 19:13:19 +03:00 committed by GitHub
parent 4f4db020da
commit 35fd0cc62b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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.
"""

View File

@ -77,7 +77,7 @@ NO_UPDATES_TIMEOUT = 15 * 60
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.