telegram.utils.types Module

This module contains custom typing aliases.

telegram.utils.types.ConversationDict = typing.Dict[typing.Tuple[int, ...], typing.Union[object, NoneType]]

Dicts as maintained by the telegram.ext.ConversationHandler.

telegram.utils.types.DVInput = typing.Union[ForwardRef('DefaultValue[DVType]'), ~DVType]

Generic type for bot method parameters which can have defaults. DVInput[type] is the same as Union[DefaultValue, type].

telegram.utils.types.FileInput = typing.Union[str, bytes, typing.IO, ForwardRef('InputFile'), pathlib.Path]

Valid input for passing files to Telegram. Either a file id as string, a file like object, a local file path as string, pathlib.Path or the file contents as bytes.

telegram.utils.types.FileLike = typing.Union[typing.IO, ForwardRef('InputFile')]

Either an open file handler or a telegram.InputFile.

telegram.utils.types.JSONDict = typing.Dict[str, typing.Any]

Dictionary containing response from Telegram or data to send to the API.

telegram.utils.types.ODVInput = typing.Union[ForwardRef('DefaultValue[DVType]'), ~DVType, NoneType]

Generic type for bot method parameters which can have defaults. ODVInput[type] is the same as Optional[Union[DefaultValue, type]].

telegram.utils.types.SLT = typing.Union[~RT, typing.List[~RT], typing.Tuple[~RT, ...]]

Single instance or list/tuple of instances.