2019-05-04 11:21:21 +03:00
|
|
|
import datetime
|
|
|
|
import typing
|
|
|
|
|
2021-09-12 14:27:13 +03:00
|
|
|
from . import helpers
|
|
|
|
from .. import _tl
|
|
|
|
from .._tl import custom
|
2019-05-04 11:21:21 +03:00
|
|
|
|
|
|
|
Phone = str
|
|
|
|
Username = str
|
|
|
|
PeerID = int
|
2021-09-12 13:16:02 +03:00
|
|
|
Entity = typing.Union[_tl.User, _tl.Chat, _tl.Channel]
|
|
|
|
FullEntity = typing.Union[_tl.UserFull, _tl.messages.ChatFull, _tl.ChatFull, _tl.ChannelFull]
|
2019-05-04 11:21:21 +03:00
|
|
|
|
|
|
|
EntityLike = typing.Union[
|
|
|
|
Phone,
|
|
|
|
Username,
|
|
|
|
PeerID,
|
2021-09-12 13:16:02 +03:00
|
|
|
_tl.TypePeer,
|
|
|
|
_tl.TypeInputPeer,
|
2019-05-04 11:21:21 +03:00
|
|
|
Entity,
|
|
|
|
FullEntity
|
|
|
|
]
|
|
|
|
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
|
|
|
|
|
2021-09-12 13:16:02 +03:00
|
|
|
ButtonLike = typing.Union[_tl.TypeKeyboardButton, custom.Button]
|
2019-05-04 11:21:21 +03:00
|
|
|
MarkupLike = typing.Union[
|
2021-09-12 13:16:02 +03:00
|
|
|
_tl.TypeReplyMarkup,
|
2019-05-04 11:21:21 +03:00
|
|
|
ButtonLike,
|
|
|
|
typing.Sequence[ButtonLike],
|
|
|
|
typing.Sequence[typing.Sequence[ButtonLike]]
|
|
|
|
]
|
|
|
|
|
|
|
|
TotalList = helpers.TotalList
|
|
|
|
|
2019-05-04 13:39:48 +03:00
|
|
|
DateLike = typing.Optional[typing.Union[float, datetime.datetime, datetime.date, datetime.timedelta]]
|
2019-05-04 11:21:21 +03:00
|
|
|
|
|
|
|
LocalPath = str
|
|
|
|
ExternalUrl = str
|
|
|
|
BotFileID = str
|
|
|
|
FileLike = typing.Union[
|
|
|
|
LocalPath,
|
|
|
|
ExternalUrl,
|
|
|
|
BotFileID,
|
|
|
|
bytes,
|
2019-05-12 14:07:07 +03:00
|
|
|
typing.BinaryIO,
|
2021-09-12 13:16:02 +03:00
|
|
|
_tl.TypeMessageMedia,
|
|
|
|
_tl.TypeInputFile,
|
|
|
|
_tl.TypeInputFileLocation
|
2019-05-04 11:21:21 +03:00
|
|
|
]
|
|
|
|
|
2019-06-28 22:25:56 +03:00
|
|
|
# Can't use `typing.Type` in Python 3.5.2
|
|
|
|
# See https://github.com/python/typing/issues/266
|
|
|
|
try:
|
|
|
|
OutFileLike = typing.Union[
|
|
|
|
str,
|
|
|
|
typing.Type[bytes],
|
|
|
|
typing.BinaryIO
|
|
|
|
]
|
|
|
|
except TypeError:
|
|
|
|
OutFileLike = typing.Union[
|
|
|
|
str,
|
|
|
|
typing.BinaryIO
|
|
|
|
]
|
2019-05-04 11:21:21 +03:00
|
|
|
|
2021-09-12 13:16:02 +03:00
|
|
|
MessageLike = typing.Union[str, _tl.Message]
|
|
|
|
MessageIDLike = typing.Union[int, _tl.Message, _tl.TypeInputMessage]
|
2019-05-04 11:21:21 +03:00
|
|
|
|
|
|
|
ProgressCallback = typing.Callable[[int, int], None]
|