2019-05-04 11:21:21 +03:00
|
|
|
import datetime
|
|
|
|
import typing
|
|
|
|
|
|
|
|
from . import helpers
|
|
|
|
from .tl import types, custom
|
|
|
|
|
|
|
|
Phone = str
|
|
|
|
Username = str
|
|
|
|
PeerID = int
|
|
|
|
Entity = typing.Union[types.User, types.Chat, types.Channel]
|
|
|
|
FullEntity = typing.Union[types.UserFull, types.messages.ChatFull, types.ChatFull, types.ChannelFull]
|
|
|
|
|
|
|
|
EntityLike = typing.Union[
|
|
|
|
Phone,
|
|
|
|
Username,
|
|
|
|
PeerID,
|
|
|
|
types.TypePeer,
|
|
|
|
types.TypeInputPeer,
|
|
|
|
Entity,
|
|
|
|
FullEntity
|
|
|
|
]
|
|
|
|
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
|
|
|
|
|
|
|
|
ButtonLike = typing.Union[types.TypeKeyboardButton, custom.Button]
|
|
|
|
MarkupLike = typing.Union[
|
|
|
|
types.TypeReplyMarkup,
|
|
|
|
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
|
|
|
|
|
|
|
|
2019-05-12 14:07:07 +03:00
|
|
|
# Note: we can't use `io.BytesIO` directly due to a bug in
|
|
|
|
# Python 3.5.2's `typing`: https://github.com/python/typing/issues/266
|
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,
|
2019-05-04 11:21:21 +03:00
|
|
|
types.TypeMessageMedia,
|
2019-05-11 21:12:57 +03:00
|
|
|
types.TypeInputFile,
|
|
|
|
types.TypeInputFileLocation
|
2019-05-04 11:21:21 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
OutFileLike = typing.Union[
|
|
|
|
str,
|
|
|
|
typing.Type[bytes],
|
2019-05-12 14:07:07 +03:00
|
|
|
typing.BinaryIO
|
2019-05-04 11:21:21 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
MessageLike = typing.Union[str, types.Message]
|
|
|
|
MessageIDLike = typing.Union[int, types.Message, types.TypeInputMessage]
|
|
|
|
|
|
|
|
ProgressCallback = typing.Callable[[int, int], None]
|