diff --git a/AUTHORS.rst b/AUTHORS.rst index b3a87a6c348..7976f5f7330 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -77,6 +77,7 @@ The following wonderful people contributed directly or indirectly to this projec - `Matheus Lemos `_ - `Michael Dix `_ - `Michael Elovskikh `_ +- `Miguel C. R. `_ - `miles `_ - `Mischa Krüger `_ - `naveenvhegde `_ diff --git a/examples/contexttypesbot.py b/examples/contexttypesbot.py index 75c541bd859..17f8fb90f34 100644 --- a/examples/contexttypesbot.py +++ b/examples/contexttypesbot.py @@ -57,7 +57,12 @@ def __init__(self) -> None: class CustomContext(CallbackContext[ExtBot, dict, ChatData, dict]): """Custom class for context.""" - def __init__(self, application: Application, chat_id: int = None, user_id: int = None): + def __init__( + self, + application: Application, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, + ): super().__init__(application=application, chat_id=chat_id, user_id=user_id) self._message_id: Optional[int] = None diff --git a/setup.cfg b/setup.cfg index 60c2cf57478..0239640a5d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,7 +64,6 @@ disallow_untyped_defs = True disallow_incomplete_defs = True disallow_untyped_decorators = True show_error_codes = True -implicit_optional = True # For some files, it's easier to just disable strict-optional all together instead of # cluttering the code with `# type: ignore`s or stuff like diff --git a/telegram/_bot.py b/telegram/_bot.py index 37241f70987..9f2cd246723 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -228,10 +228,10 @@ def __init__( token: str, base_url: str = "https://api.telegram.org/bot", base_file_url: str = "https://api.telegram.org/file/bot", - request: BaseRequest = None, - get_updates_request: BaseRequest = None, - private_key: bytes = None, - private_key_password: bytes = None, + request: Optional[BaseRequest] = None, + get_updates_request: Optional[BaseRequest] = None, + private_key: Optional[bytes] = None, + private_key_password: Optional[bytes] = None, local_mode: bool = False, ): super().__init__(api_kwargs=None) @@ -388,8 +388,8 @@ async def decorator(self: "Bot", *args: Any, **kwargs: Any) -> Any: def _parse_file_input( self, file_input: Union[FileInput, "TelegramObject"], - tg_type: Type["TelegramObject"] = None, - filename: str = None, + tg_type: Optional[Type["TelegramObject"]] = None, + filename: Optional[str] = None, attach: bool = False, ) -> Union[str, "InputFile", Any]: return parse_file_input( @@ -443,13 +443,13 @@ def _insert_defaults(self, data: Dict[str, object]) -> None: # skipcq: PYL-R020 async def _post( self, endpoint: str, - data: JSONDict = None, + data: Optional[JSONDict] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Any: # We know that the return type is Union[bool, JSONDict, List[JSONDict]], but it's hard # to tell mypy which methods expects which of these return values and `Any` saves us a @@ -507,22 +507,22 @@ async def _send_message( self, endpoint: str, data: JSONDict, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - caption: str = None, + message_thread_id: Optional[int] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Any: """Protected method to send or edit messages of any type. @@ -721,7 +721,7 @@ async def get_me( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> User: """A simple method for testing your bot's auth token. Requires no parameters. @@ -750,20 +750,20 @@ async def send_message( chat_id: Union[int, str], text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, - message_thread_id: int = None, + reply_markup: Optional[ReplyMarkup] = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send text messages. @@ -832,7 +832,7 @@ async def delete_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to delete a message, including service messages, with the following @@ -889,13 +889,13 @@ async def forward_message( message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to forward messages of any kind. Service messages can't be forwarded. @@ -952,23 +952,23 @@ async def send_photo( self, chat_id: Union[int, str], photo: Union[FileInput, "PhotoSize"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send photos. @@ -1063,27 +1063,27 @@ async def send_audio( self, chat_id: Union[int, str], audio: Union[FileInput, "Audio"], - duration: int = None, - performer: str = None, - title: str = None, - caption: str = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display them in the @@ -1208,25 +1208,25 @@ async def send_document( self, chat_id: Union[int, str], document: Union[FileInput, "Document"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - disable_content_type_detection: bool = None, + thumb: Optional[FileInput] = None, + disable_content_type_detection: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send general files. @@ -1348,18 +1348,18 @@ async def send_sticker( chat_id: Union[int, str], sticker: Union[FileInput, "Sticker"], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - emoji: str = None, + message_thread_id: Optional[int] = None, + emoji: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send static ``.WEBP``, animated ``.TGS``, or video ``.WEBM`` stickers. @@ -1433,29 +1433,29 @@ async def send_video( self, chat_id: Union[int, str], video: Union[FileInput, "Video"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - width: int = None, - height: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + width: Optional[int] = None, + height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - supports_streaming: bool = None, - thumb: FileInput = None, + supports_streaming: Optional[bool] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). @@ -1590,23 +1590,23 @@ async def send_video_note( self, chat_id: Union[int, str], video_note: Union[FileInput, "VideoNote"], - duration: int = None, - length: int = None, + duration: Optional[int] = None, + length: Optional[int] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - thumb: FileInput = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. @@ -1720,28 +1720,28 @@ async def send_animation( self, chat_id: Union[int, str], animation: Union[FileInput, "Animation"], - duration: int = None, - width: int = None, - height: int = None, - thumb: FileInput = None, - caption: str = None, + duration: Optional[int] = None, + width: Optional[int] = None, + height: Optional[int] = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). @@ -1869,23 +1869,23 @@ async def send_voice( self, chat_id: Union[int, str], voice: Union[FileInput, "Voice"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display the file @@ -1988,19 +1988,19 @@ async def send_media_group( Union["InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo"] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, ) -> Tuple[Message, ...]: """Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. @@ -2113,25 +2113,25 @@ async def send_media_group( async def send_location( self, chat_id: Union[int, str], - latitude: float = None, - longitude: float = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send point on the map. @@ -2227,22 +2227,22 @@ async def send_location( @_log async def edit_message_live_location( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - latitude: float = None, - longitude: float = None, - reply_markup: InlineKeyboardMarkup = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its :attr:`telegram.Location.live_period` @@ -2322,16 +2322,16 @@ async def edit_message_live_location( @_log async def stop_message_live_location( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before :paramref:`~telegram.Location.live_period` expires. @@ -2371,27 +2371,27 @@ async def stop_message_live_location( async def send_venue( self, chat_id: Union[int, str], - latitude: float = None, - longitude: float = None, - title: str = None, - address: str = None, - foursquare_id: str = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + title: Optional[str] = None, + address: Optional[str] = None, + foursquare_id: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - venue: Venue = None, + venue: Optional[Venue] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send information about a venue. @@ -2497,23 +2497,23 @@ async def send_venue( async def send_contact( self, chat_id: Union[int, str], - phone_number: str = None, - first_name: str = None, - last_name: str = None, + phone_number: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - vcard: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + vcard: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - contact: Contact = None, + contact: Optional[Contact] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send phone contacts. @@ -2602,17 +2602,17 @@ async def send_game( chat_id: Union[int, str], game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: InlineKeyboardMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send a game. @@ -2664,13 +2664,13 @@ async def send_chat_action( self, chat_id: Union[str, int], action: str, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method when you need to tell the user that something is happening on the bot's @@ -2714,8 +2714,8 @@ def _effective_inline_results( # skipcq: PYL-R0201 results: Union[ Sequence["InlineQueryResult"], Callable[[int], Optional[Sequence["InlineQueryResult"]]] ], - next_offset: str = None, - current_offset: str = None, + next_offset: Optional[str] = None, + current_offset: Optional[str] = None, ) -> Tuple[Sequence["InlineQueryResult"], Optional[str]]: """ Builds the effective results from the results input. @@ -2810,25 +2810,25 @@ async def answer_inline_query( results: Union[ Sequence["InlineQueryResult"], Callable[[int], Optional[Sequence["InlineQueryResult"]]] ], - cache_time: int = None, - is_personal: bool = None, - next_offset: str = None, + cache_time: Optional[int] = None, + is_personal: Optional[bool] = None, + next_offset: Optional[str] = None, # Deprecated params since bot api 6.7 # <---- - switch_pm_text: str = None, - switch_pm_parameter: str = None, + switch_pm_text: Optional[str] = None, + switch_pm_parameter: Optional[str] = None, # ---> # New params since bot api 6.7 # <---- - button: InlineQueryResultsButton = None, + button: Optional[InlineQueryResultsButton] = None, # ---> *, - current_offset: str = None, + current_offset: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to send answers to an inline query. No more than @@ -2946,14 +2946,14 @@ async def answer_inline_query( async def get_user_profile_photos( self, user_id: Union[str, int], - offset: int = None, - limit: int = None, + offset: Optional[int] = None, + limit: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> UserProfilePhotos: """Use this method to get a list of profile pictures for a user. @@ -2998,7 +2998,7 @@ async def get_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> File: """ Use this method to get basic info about a file and prepare it for downloading. For the @@ -3058,14 +3058,14 @@ async def ban_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - until_date: Union[int, datetime] = None, - revoke_messages: bool = None, + until_date: Optional[Union[int, datetime]] = None, + revoke_messages: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to ban a user from a group, supergroup or a channel. In the case of @@ -3127,7 +3127,7 @@ async def ban_chat_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to ban a channel chat in a supergroup or a channel. Until the chat is @@ -3166,13 +3166,13 @@ async def unban_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - only_if_banned: bool = None, + only_if_banned: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to unban a previously kicked user in a supergroup or channel. @@ -3216,7 +3216,7 @@ async def unban_chat_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to unban a previously banned channel in a supergroup or channel. The bot must be an administrator for this to work and must have the @@ -3251,16 +3251,16 @@ async def unban_chat_sender_chat( async def answer_callback_query( self, callback_query_id: str, - text: str = None, - show_alert: bool = None, - url: str = None, - cache_time: int = None, + text: Optional[str] = None, + show_alert: Optional[bool] = None, + url: Optional[str] = None, + cache_time: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to send answers to callback queries sent from inline keyboards. The answer @@ -3317,19 +3317,19 @@ async def answer_callback_query( async def edit_message_text( self, text: str, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, - reply_markup: InlineKeyboardMarkup = None, - entities: Sequence["MessageEntity"] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """ Use this method to edit text and game messages. @@ -3394,19 +3394,19 @@ async def edit_message_text( @_log async def edit_message_caption( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """ Use this method to edit captions of messages. @@ -3465,16 +3465,16 @@ async def edit_message_caption( async def edit_message_media( self, media: "InputMedia", - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """ Use this method to edit animation, audio, document, photo, or video messages. If a message @@ -3528,16 +3528,16 @@ async def edit_message_media( @_log async def edit_message_reply_markup( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, reply_markup: Optional["InlineKeyboardMarkup"] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """ Use this method to edit only the reply markup of messages sent by the bot or via the bot @@ -3584,16 +3584,16 @@ async def edit_message_reply_markup( @_log async def get_updates( self, - offset: int = None, - limit: int = None, - timeout: float = None, - allowed_updates: Sequence[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + timeout: Optional[float] = None, + allowed_updates: Optional[Sequence[str]] = None, *, read_timeout: float = 2, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[Update, ...]: """Use this method to receive incoming updates using long polling. @@ -3680,18 +3680,18 @@ async def get_updates( async def set_webhook( self, url: str, - certificate: FileInput = None, - max_connections: int = None, - allowed_updates: Sequence[str] = None, - ip_address: str = None, - drop_pending_updates: bool = None, - secret_token: str = None, + certificate: Optional[FileInput] = None, + max_connections: Optional[int] = None, + allowed_updates: Optional[Sequence[str]] = None, + ip_address: Optional[str] = None, + drop_pending_updates: Optional[bool] = None, + secret_token: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to specify a url and receive incoming updates via an outgoing webhook. @@ -3804,13 +3804,13 @@ async def set_webhook( @_log async def delete_webhook( self, - drop_pending_updates: bool = None, + drop_pending_updates: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to remove webhook integration if you decide to switch back to @@ -3848,7 +3848,7 @@ async def leave_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method for your bot to leave a group, supergroup or channel. @@ -3883,7 +3883,7 @@ async def get_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Chat: """ Use this method to get up to date information about the chat (current name of the user for @@ -3922,7 +3922,7 @@ async def get_chat_administrators( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[ChatMember, ...]: """ Use this method to get a list of administrators in a chat. @@ -3964,7 +3964,7 @@ async def get_chat_member_count( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> int: """Use this method to get the number of members in a chat. @@ -4001,7 +4001,7 @@ async def get_chat_member( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ChatMember: """Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. @@ -4039,7 +4039,7 @@ async def set_chat_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate @@ -4074,7 +4074,7 @@ async def delete_chat_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. @@ -4106,7 +4106,7 @@ async def get_webhook_info( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> WebhookInfo: """Use this method to get current webhook status. Requires no parameters. @@ -4132,17 +4132,17 @@ async def set_game_score( self, user_id: Union[int, str], score: int, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - force: bool = None, - disable_edit_message: bool = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + force: Optional[bool] = None, + disable_edit_message: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """ Use this method to set the score of the specified user in a game message. @@ -4196,15 +4196,15 @@ async def set_game_score( async def get_game_high_scores( self, user_id: Union[int, str], - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[GameHighScore, ...]: """ Use this method to get data for high score tables. Will return the score of the specified @@ -4263,33 +4263,33 @@ async def send_invoice( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - start_parameter: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - is_flexible: bool = None, + start_parameter: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + is_flexible: Optional[bool] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: InlineKeyboardMarkup = None, - provider_data: Union[str, object] = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + provider_data: Optional[Union[str, object]] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """Use this method to send invoices. @@ -4440,14 +4440,14 @@ async def answer_shipping_query( # pylint: disable=invalid-name self, shipping_query_id: str, ok: bool, - shipping_options: Sequence[ShippingOption] = None, - error_message: str = None, + shipping_options: Optional[Sequence[ShippingOption]] = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ If you sent an invoice requesting a shipping address and the parameter @@ -4499,13 +4499,13 @@ async def answer_pre_checkout_query( # pylint: disable=invalid-name self, pre_checkout_query_id: str, ok: bool, - error_message: str = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Once the user has confirmed their payment and shipping details, the Bot API sends the final @@ -4561,7 +4561,7 @@ async def answer_web_app_query( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> SentWebAppMessage: """Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. @@ -4604,14 +4604,14 @@ async def restrict_chat_member( chat_id: Union[str, int], user_id: Union[str, int], permissions: ChatPermissions, - until_date: Union[int, datetime] = None, - use_independent_chat_permissions: bool = None, + until_date: Optional[Union[int, datetime]] = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to restrict a user in a supergroup. The bot must be an administrator in @@ -4677,24 +4677,24 @@ async def promote_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - can_change_info: bool = None, - can_post_messages: bool = None, - can_edit_messages: bool = None, - can_delete_messages: bool = None, - can_invite_users: bool = None, - can_restrict_members: bool = None, - can_pin_messages: bool = None, - can_promote_members: bool = None, - is_anonymous: bool = None, - can_manage_chat: bool = None, - can_manage_video_chats: bool = None, - can_manage_topics: bool = None, + can_change_info: Optional[bool] = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: Optional[bool] = None, + can_delete_messages: Optional[bool] = None, + can_invite_users: Optional[bool] = None, + can_restrict_members: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_promote_members: Optional[bool] = None, + is_anonymous: Optional[bool] = None, + can_manage_chat: Optional[bool] = None, + can_manage_video_chats: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to promote or demote a user in a supergroup or a channel. The bot must be @@ -4784,13 +4784,13 @@ async def set_chat_permissions( self, chat_id: Union[str, int], permissions: ChatPermissions, - use_independent_chat_permissions: bool = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to set default chat permissions for all members. The bot must be an @@ -4849,7 +4849,7 @@ async def set_chat_administrator_custom_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to set a custom title for administrators promoted by the bot in a @@ -4890,7 +4890,7 @@ async def export_chat_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> str: """ Use this method to generate a new primary invite link for a chat; any previously generated @@ -4929,16 +4929,16 @@ async def export_chat_invite_link( async def create_chat_invite_link( self, chat_id: Union[str, int], - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ChatInviteLink: """ Use this method to create an additional invite link for a chat. The bot must be an @@ -5000,16 +5000,16 @@ async def edit_chat_invite_link( self, chat_id: Union[str, int], invite_link: Union[str, "ChatInviteLink"], - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ChatInviteLink: """ Use this method to edit a non-primary invite link created by the bot. The bot must be an @@ -5087,7 +5087,7 @@ async def revoke_chat_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ChatInviteLink: """ Use this method to revoke an invite link created by the bot. If the primary link is @@ -5135,7 +5135,7 @@ async def approve_chat_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to approve a chat join request. @@ -5176,7 +5176,7 @@ async def decline_chat_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to decline a chat join request. @@ -5217,7 +5217,7 @@ async def set_chat_photo( write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to set a new profile photo for the chat. @@ -5263,7 +5263,7 @@ async def delete_chat_photo( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to delete a chat photo. Photos can't be changed for private chats. The bot @@ -5301,7 +5301,7 @@ async def set_chat_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the title of a chat. Titles can't be changed for private chats. @@ -5336,13 +5336,13 @@ async def set_chat_title( async def set_chat_description( self, chat_id: Union[str, int], - description: str = None, + description: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the description of a group, a supergroup or a channel. The bot @@ -5385,7 +5385,7 @@ async def pin_chat_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to add a message to the list of pinned messages in a chat. If the @@ -5428,13 +5428,13 @@ async def pin_chat_message( async def unpin_chat_message( self, chat_id: Union[str, int], - message_id: int = None, + message_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to remove a message from the list of pinned messages in a chat. If the @@ -5476,7 +5476,7 @@ async def unpin_all_chat_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to clear the list of pinned messages in a chat. If the @@ -5515,7 +5515,7 @@ async def get_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> StickerSet: """Use this method to get a sticker set. @@ -5550,7 +5550,7 @@ async def get_custom_emoji_stickers( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[Sticker, ...]: # skipcq: FLK-D207 """ @@ -5590,18 +5590,20 @@ async def get_custom_emoji_stickers( async def upload_sticker_file( self, user_id: Union[str, int], - png_sticker: FileInput = None, # Deprecated since bot api 6.6. Optional for compatiblity. + png_sticker: Optional[ + FileInput + ] = None, # Deprecated since bot api 6.6. Optional for compatiblity. # New parameters since bot api 6.6: # <--- - sticker: FileInput = None, # Actually required, but optional for compatibility. - sticker_format: str = None, # Actually required, but optional for compatibility. + sticker: Optional[FileInput] = None, # Actually required, but optional for compatibility. + sticker_format: Optional[str] = None, # Actually required, but optional for compatibility. # ---> *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> File: """ Use this method to upload a file with a sticker for later use in the @@ -5703,25 +5705,27 @@ async def create_new_sticker_set( title: str, # Deprecated params since bot api 6.6 # <---- - emojis: str = None, # Was made optional for compatibility purposes - png_sticker: FileInput = None, - mask_position: MaskPosition = None, - tgs_sticker: FileInput = None, - webm_sticker: FileInput = None, + emojis: Optional[str] = None, # Was made optional for compatibility purposes + png_sticker: Optional[FileInput] = None, + mask_position: Optional[MaskPosition] = None, + tgs_sticker: Optional[FileInput] = None, + webm_sticker: Optional[FileInput] = None, # ----> - sticker_type: str = None, + sticker_type: Optional[str] = None, # New params since bot api 6.6 # <---- - stickers: Sequence[InputSticker] = None, # Actually a required param. Optional for compat. - sticker_format: str = None, # Actually a required param. Optional for compat. - needs_repainting: bool = None, + stickers: Optional[ + Sequence[InputSticker] + ] = None, # Actually a required param. Optional for compat. + sticker_format: Optional[str] = None, # Actually a required param. Optional for compat. + needs_repainting: Optional[bool] = None, # ----> *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to create new sticker set owned by a user. @@ -5910,20 +5914,22 @@ async def add_sticker_to_set( name: str, # Deprecated params since bot api 6.6 # ---- - emojis: str = None, # Was made optional for compatibility reasons - png_sticker: FileInput = None, - mask_position: MaskPosition = None, - tgs_sticker: FileInput = None, - webm_sticker: FileInput = None, + emojis: Optional[str] = None, # Was made optional for compatibility reasons + png_sticker: Optional[FileInput] = None, + mask_position: Optional[MaskPosition] = None, + tgs_sticker: Optional[FileInput] = None, + webm_sticker: Optional[FileInput] = None, # ---- # New in bot api 6.6: - sticker: InputSticker = None, # Actually a required param, but is optional for compat. + sticker: Optional[ + InputSticker + ] = None, # Actually a required param, but is optional for compat. *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to add a new sticker to a set created by the bot. The format of the added @@ -6081,7 +6087,7 @@ async def set_sticker_position_in_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to move a sticker in a set created by the bot to a specific position. @@ -6116,7 +6122,7 @@ async def delete_sticker_from_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to delete a sticker from a set created by the bot. @@ -6150,7 +6156,7 @@ async def delete_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to delete a sticker set that was created by the bot. @@ -6183,13 +6189,13 @@ async def set_sticker_set_thumbnail( self, name: str, user_id: Union[str, int], - thumbnail: FileInput = None, + thumbnail: Optional[FileInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. @@ -6243,13 +6249,13 @@ async def set_sticker_set_thumb( self, name: str, user_id: Union[str, int], - thumb: FileInput = None, + thumb: Optional[FileInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets @@ -6308,13 +6314,13 @@ async def _set_sticker_set_thumbnail( self, name: str, user_id: Union[str, int], - thumbnail: FileInput = None, + thumbnail: Optional[FileInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: data: JSONDict = { "name": name, @@ -6342,7 +6348,7 @@ async def set_sticker_set_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to set the title of a created sticker set. @@ -6383,7 +6389,7 @@ async def set_sticker_emoji_list( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the list of emoji assigned to a regular or custom emoji sticker. @@ -6419,13 +6425,13 @@ async def set_sticker_emoji_list( async def set_sticker_keywords( self, sticker: str, - keywords: Sequence[str] = None, + keywords: Optional[Sequence[str]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change search keywords assigned to a regular or custom emoji sticker. @@ -6461,13 +6467,13 @@ async def set_sticker_keywords( async def set_sticker_mask_position( self, sticker: str, - mask_position: MaskPosition = None, + mask_position: Optional[MaskPosition] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the mask position of a mask sticker. @@ -6502,13 +6508,13 @@ async def set_sticker_mask_position( async def set_custom_emoji_sticker_set_thumbnail( self, name: str, - custom_emoji_id: str = None, + custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to set the thumbnail of a custom emoji sticker set. @@ -6550,7 +6556,7 @@ async def set_passport_data_errors( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Informs a user that some of the Telegram Passport elements they provided contains errors. @@ -6593,28 +6599,28 @@ async def send_poll( chat_id: Union[int, str], question: str, options: Sequence[str], - is_anonymous: bool = None, - type: str = None, # pylint: disable=redefined-builtin - allows_multiple_answers: bool = None, - correct_option_id: int = None, - is_closed: bool = None, + is_anonymous: Optional[bool] = None, + type: Optional[str] = None, # pylint: disable=redefined-builtin + allows_multiple_answers: Optional[bool] = None, + correct_option_id: Optional[int] = None, + is_closed: Optional[bool] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - explanation: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + explanation: Optional[str] = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, - open_period: int = None, - close_date: Union[int, datetime] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[int, datetime]] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - explanation_entities: Sequence["MessageEntity"] = None, + explanation_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send a native poll. @@ -6726,13 +6732,13 @@ async def stop_poll( self, chat_id: Union[int, str], message_id: int, - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Poll: """ Use this method to stop a poll which was sent by the bot. @@ -6772,18 +6778,18 @@ async def send_dice( self, chat_id: Union[int, str], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - emoji: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + emoji: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Message: """ Use this method to send an animated emoji that will display a random value. @@ -6847,13 +6853,13 @@ async def send_dice( @_log async def get_my_default_administrator_rights( self, - for_channels: bool = None, + for_channels: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ChatAdministratorRights: """Use this method to get the current default administrator rights of the bot. @@ -6889,14 +6895,14 @@ async def get_my_default_administrator_rights( @_log async def set_my_default_administrator_rights( self, - rights: ChatAdministratorRights = None, - for_channels: bool = None, + rights: Optional[ChatAdministratorRights] = None, + for_channels: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to @@ -6935,14 +6941,14 @@ async def set_my_default_administrator_rights( @_log async def get_my_commands( self, - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[BotCommand, ...]: """ Use this method to get the current list of the bot's commands for the given scope and user @@ -6990,14 +6996,14 @@ async def get_my_commands( async def set_my_commands( self, commands: Sequence[Union[BotCommand, Tuple[str, str]]], - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the list of the bot's commands. See the @@ -7054,14 +7060,14 @@ async def set_my_commands( @_log async def delete_my_commands( self, - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to delete the list of the bot's commands for the given scope and user @@ -7107,7 +7113,7 @@ async def log_out( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to log out from the cloud Bot API server before launching the bot locally. @@ -7140,7 +7146,7 @@ async def close( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to close the bot instance before moving it from one local server to @@ -7170,21 +7176,21 @@ async def copy_message( chat_id: Union[int, str], from_chat_id: Union[str, int], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> MessageId: """ Use this method to copy messages of any kind. Service messages and invoice messages can't @@ -7257,14 +7263,14 @@ async def copy_message( @_log async def set_chat_menu_button( self, - chat_id: int = None, - menu_button: MenuButton = None, + chat_id: Optional[int] = None, + menu_button: Optional[MenuButton] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Use this method to change the bot's menu button in a private chat, or the default menu button. @@ -7299,13 +7305,13 @@ async def set_chat_menu_button( @_log async def get_chat_menu_button( self, - chat_id: int = None, + chat_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> MenuButton: """Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. @@ -7345,26 +7351,26 @@ async def create_invoice_link( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, - provider_data: Union[str, object] = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, - is_flexible: bool = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, + provider_data: Optional[Union[str, object]] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, + is_flexible: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> str: """Use this method to create a link for an invoice. @@ -7473,7 +7479,7 @@ async def get_forum_topic_icon_stickers( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[Sticker, ...]: """Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. @@ -7502,14 +7508,14 @@ async def create_forum_topic( self, chat_id: Union[str, int], name: str, - icon_color: int = None, - icon_custom_emoji_id: str = None, + icon_color: Optional[int] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ForumTopic: """ Use this method to create a topic in a forum supergroup chat. The bot must be @@ -7562,14 +7568,14 @@ async def edit_forum_topic( self, chat_id: Union[str, int], message_thread_id: int, - name: str = None, - icon_custom_emoji_id: str = None, + name: Optional[str] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must @@ -7624,7 +7630,7 @@ async def close_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to close an open topic in a forum supergroup chat. The bot must @@ -7669,7 +7675,7 @@ async def reopen_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to reopen a closed topic in a forum supergroup chat. The bot must @@ -7714,7 +7720,7 @@ async def delete_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to delete a forum topic along with all its messages in a forum supergroup @@ -7758,7 +7764,7 @@ async def unpin_all_forum_topic_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to clear the list of pinned messages in a forum topic. The bot must @@ -7803,7 +7809,7 @@ async def edit_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot @@ -7846,7 +7852,7 @@ async def close_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to close an open 'General' topic in a forum supergroup chat. The bot must @@ -7886,7 +7892,7 @@ async def reopen_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must @@ -7927,7 +7933,7 @@ async def hide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to hide the 'General' topic in a forum supergroup chat. The bot must @@ -7968,7 +7974,7 @@ async def unhide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must @@ -8002,14 +8008,14 @@ async def unhide_general_forum_topic( @_log async def set_my_description( self, - description: str = None, - language_code: str = None, + description: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the bot's description, which is shown in the chat with the bot @@ -8048,14 +8054,14 @@ async def set_my_description( @_log async def set_my_short_description( self, - short_description: str = None, - language_code: str = None, + short_description: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the bot's short description, which is shown on the bot's profile @@ -8094,13 +8100,13 @@ async def set_my_short_description( @_log async def get_my_description( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> BotDescription: """ Use this method to get the current bot description for the given user language. @@ -8133,13 +8139,13 @@ async def get_my_description( @_log async def get_my_short_description( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> BotShortDescription: """ Use this method to get the current bot short description for the given user language. @@ -8173,14 +8179,14 @@ async def get_my_short_description( @_log async def set_my_name( self, - name: str = None, - language_code: str = None, + name: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """ Use this method to change the bot's name. @@ -8222,13 +8228,13 @@ async def set_my_name( @_log async def get_my_name( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> BotName: """ Use this method to get the current bot name for the given user language. diff --git a/telegram/_botcommand.py b/telegram/_botcommand.py index 941c19ca8ac..a196fd5795c 100644 --- a/telegram/_botcommand.py +++ b/telegram/_botcommand.py @@ -18,7 +18,7 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram Bot Command.""" -from typing import ClassVar +from typing import ClassVar, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -52,7 +52,7 @@ class BotCommand(TelegramObject): __slots__ = ("description", "command") - def __init__(self, command: str, description: str, *, api_kwargs: JSONDict = None): + def __init__(self, command: str, description: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.command: str = command self.description: str = description diff --git a/telegram/_botcommandscope.py b/telegram/_botcommandscope.py index 7bd0db4b3cf..55d969e445c 100644 --- a/telegram/_botcommandscope.py +++ b/telegram/_botcommandscope.py @@ -75,7 +75,7 @@ class BotCommandScope(TelegramObject): CHAT_MEMBER: ClassVar[str] = constants.BotCommandScopeType.CHAT_MEMBER """:const:`telegram.constants.BotCommandScopeType.CHAT_MEMBER`""" - def __init__(self, type: str, *, api_kwargs: JSONDict = None): + def __init__(self, type: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.type: str = type self._id_attrs = (self.type,) @@ -128,7 +128,7 @@ class BotCommandScopeDefault(BotCommandScope): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.DEFAULT, api_kwargs=api_kwargs) self._freeze() @@ -144,7 +144,7 @@ class BotCommandScopeAllPrivateChats(BotCommandScope): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.ALL_PRIVATE_CHATS, api_kwargs=api_kwargs) self._freeze() @@ -159,7 +159,7 @@ class BotCommandScopeAllGroupChats(BotCommandScope): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.ALL_GROUP_CHATS, api_kwargs=api_kwargs) self._freeze() @@ -174,7 +174,7 @@ class BotCommandScopeAllChatAdministrators(BotCommandScope): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.ALL_CHAT_ADMINISTRATORS, api_kwargs=api_kwargs) self._freeze() @@ -197,7 +197,7 @@ class BotCommandScopeChat(BotCommandScope): __slots__ = ("chat_id",) - def __init__(self, chat_id: Union[str, int], *, api_kwargs: JSONDict = None): + def __init__(self, chat_id: Union[str, int], *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.CHAT, api_kwargs=api_kwargs) with self._unfrozen(): self.chat_id: Union[str, int] = ( @@ -224,7 +224,7 @@ class BotCommandScopeChatAdministrators(BotCommandScope): __slots__ = ("chat_id",) - def __init__(self, chat_id: Union[str, int], *, api_kwargs: JSONDict = None): + def __init__(self, chat_id: Union[str, int], *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=BotCommandScope.CHAT_ADMINISTRATORS, api_kwargs=api_kwargs) with self._unfrozen(): self.chat_id: Union[str, int] = ( @@ -254,7 +254,9 @@ class BotCommandScopeChatMember(BotCommandScope): __slots__ = ("chat_id", "user_id") - def __init__(self, chat_id: Union[str, int], user_id: int, *, api_kwargs: JSONDict = None): + def __init__( + self, chat_id: Union[str, int], user_id: int, *, api_kwargs: Optional[JSONDict] = None + ): super().__init__(type=BotCommandScope.CHAT_MEMBER, api_kwargs=api_kwargs) with self._unfrozen(): self.chat_id: Union[str, int] = ( diff --git a/telegram/_botdescription.py b/telegram/_botdescription.py index 77388824fa5..f920e3624cf 100644 --- a/telegram/_botdescription.py +++ b/telegram/_botdescription.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains two objects that represent a Telegram bots (short) description.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -39,7 +41,7 @@ class BotDescription(TelegramObject): __slots__ = ("description",) - def __init__(self, description: str, *, api_kwargs: JSONDict = None): + def __init__(self, description: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.description: str = description @@ -66,7 +68,7 @@ class BotShortDescription(TelegramObject): __slots__ = ("short_description",) - def __init__(self, short_description: str, *, api_kwargs: JSONDict = None): + def __init__(self, short_description: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.short_description: str = short_description diff --git a/telegram/_botname.py b/telegram/_botname.py index ed70fb6e699..d4b05f1dfcc 100644 --- a/telegram/_botname.py +++ b/telegram/_botname.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represent a Telegram bots name.""" -from typing import ClassVar +from typing import ClassVar, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -42,7 +42,7 @@ class BotName(TelegramObject): __slots__ = ("name",) - def __init__(self, name: str, *, api_kwargs: JSONDict = None): + def __init__(self, name: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.name: str = name diff --git a/telegram/_callbackquery.py b/telegram/_callbackquery.py index 02bd7dfa2a7..61577df9090 100644 --- a/telegram/_callbackquery.py +++ b/telegram/_callbackquery.py @@ -118,12 +118,12 @@ def __init__( id: str, from_user: User, chat_instance: str, - message: Message = None, - data: str = None, - inline_message_id: str = None, - game_short_name: str = None, + message: Optional[Message] = None, + data: Optional[str] = None, + inline_message_id: Optional[str] = None, + game_short_name: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -155,16 +155,16 @@ def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["CallbackQuer async def answer( self, - text: str = None, - show_alert: bool = None, - url: str = None, - cache_time: int = None, + text: Optional[str] = None, + show_alert: Optional[bool] = None, + url: Optional[str] = None, + cache_time: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -195,14 +195,14 @@ async def edit_message_text( text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, - reply_markup: "InlineKeyboardMarkup" = None, - entities: Sequence["MessageEntity"] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -253,16 +253,16 @@ async def edit_message_text( async def edit_message_caption( self, - caption: str = None, - reply_markup: "InlineKeyboardMarkup" = None, + caption: Optional[str] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -317,7 +317,7 @@ async def edit_message_reply_markup( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -362,13 +362,13 @@ async def edit_message_reply_markup( async def edit_message_media( self, media: "InputMedia", - reply_markup: "InlineKeyboardMarkup" = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -413,19 +413,19 @@ async def edit_message_media( async def edit_message_live_location( self, - latitude: float = None, - longitude: float = None, - reply_markup: "InlineKeyboardMarkup" = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -481,13 +481,13 @@ async def edit_message_live_location( async def stop_message_live_location( self, - reply_markup: "InlineKeyboardMarkup" = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -533,14 +533,14 @@ async def set_game_score( self, user_id: Union[int, str], score: int, - force: bool = None, - disable_edit_message: bool = None, + force: Optional[bool] = None, + disable_edit_message: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -595,7 +595,7 @@ async def get_game_high_scores( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple["GameHighScore", ...]: """Shortcut for either:: @@ -643,7 +643,7 @@ async def delete_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -671,7 +671,7 @@ async def pin_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -699,7 +699,7 @@ async def unpin_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -722,21 +722,21 @@ async def unpin_message( async def copy_message( self, chat_id: Union[int, str], - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: diff --git a/telegram/_chat.py b/telegram/_chat.py index 012758587e1..9dd6618d21d 100644 --- a/telegram/_chat.py +++ b/telegram/_chat.py @@ -321,34 +321,34 @@ def __init__( self, id: int, type: str, - title: str = None, - username: str = None, - first_name: str = None, - last_name: str = None, - photo: ChatPhoto = None, - description: str = None, - invite_link: str = None, - pinned_message: "Message" = None, - permissions: ChatPermissions = None, - sticker_set_name: str = None, - can_set_sticker_set: bool = None, - slow_mode_delay: int = None, - bio: str = None, - linked_chat_id: int = None, - location: ChatLocation = None, - message_auto_delete_time: int = None, - has_private_forwards: bool = None, - has_protected_content: bool = None, - join_to_send_messages: bool = None, - join_by_request: bool = None, - has_restricted_voice_and_video_messages: bool = None, - is_forum: bool = None, - active_usernames: Sequence[str] = None, - emoji_status_custom_emoji_id: str = None, - has_aggressive_anti_spam_enabled: bool = None, - has_hidden_members: bool = None, + title: Optional[str] = None, + username: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + photo: Optional[ChatPhoto] = None, + description: Optional[str] = None, + invite_link: Optional[str] = None, + pinned_message: Optional["Message"] = None, + permissions: Optional[ChatPermissions] = None, + sticker_set_name: Optional[str] = None, + can_set_sticker_set: Optional[bool] = None, + slow_mode_delay: Optional[int] = None, + bio: Optional[str] = None, + linked_chat_id: Optional[int] = None, + location: Optional[ChatLocation] = None, + message_auto_delete_time: Optional[int] = None, + has_private_forwards: Optional[bool] = None, + has_protected_content: Optional[bool] = None, + join_to_send_messages: Optional[bool] = None, + join_by_request: Optional[bool] = None, + has_restricted_voice_and_video_messages: Optional[bool] = None, + is_forum: Optional[bool] = None, + active_usernames: Optional[Sequence[str]] = None, + emoji_status_custom_emoji_id: Optional[str] = None, + has_aggressive_anti_spam_enabled: Optional[bool] = None, + has_hidden_members: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -456,7 +456,7 @@ def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["Chat"]: return super()._de_json(data=data, bot=bot, api_kwargs=api_kwargs) - def mention_markdown(self, name: str = None) -> str: + def mention_markdown(self, name: Optional[str] = None) -> str: """ Note: :tg-const:`telegram.constants.ParseMode.MARKDOWN` is a legacy mode, retained by @@ -493,7 +493,7 @@ def mention_markdown(self, name: str = None) -> str: raise TypeError("Can not create a mention to a public chat without title") raise TypeError("Can not create a mention to a private group chat") - def mention_markdown_v2(self, name: str = None) -> str: + def mention_markdown_v2(self, name: Optional[str] = None) -> str: """ .. versionadded:: 20.0 @@ -525,7 +525,7 @@ def mention_markdown_v2(self, name: str = None) -> str: raise TypeError("Can not create a mention to a public chat without title") raise TypeError("Can not create a mention to a private group chat") - def mention_html(self, name: str = None) -> str: + def mention_html(self, name: Optional[str] = None) -> str: """ .. versionadded:: 20.0 @@ -564,7 +564,7 @@ async def leave( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -592,7 +592,7 @@ async def get_administrators( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple["ChatMember", ...]: """Shortcut for:: @@ -624,7 +624,7 @@ async def get_member_count( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> int: """Shortcut for:: @@ -653,7 +653,7 @@ async def get_member( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "ChatMember": """Shortcut for:: @@ -678,14 +678,14 @@ async def get_member( async def ban_member( self, user_id: Union[str, int], - revoke_messages: bool = None, - until_date: Union[int, datetime] = None, + revoke_messages: Optional[bool] = None, + until_date: Optional[Union[int, datetime]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -717,7 +717,7 @@ async def ban_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -750,7 +750,7 @@ async def ban_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -785,7 +785,7 @@ async def unban_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -818,7 +818,7 @@ async def unban_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -848,13 +848,13 @@ async def unban_chat( async def unban_member( self, user_id: Union[str, int], - only_if_banned: bool = None, + only_if_banned: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -880,24 +880,24 @@ async def unban_member( async def promote_member( self, user_id: Union[str, int], - can_change_info: bool = None, - can_post_messages: bool = None, - can_edit_messages: bool = None, - can_delete_messages: bool = None, - can_invite_users: bool = None, - can_restrict_members: bool = None, - can_pin_messages: bool = None, - can_promote_members: bool = None, - is_anonymous: bool = None, - can_manage_chat: bool = None, - can_manage_video_chats: bool = None, - can_manage_topics: bool = None, + can_change_info: Optional[bool] = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: Optional[bool] = None, + can_delete_messages: Optional[bool] = None, + can_invite_users: Optional[bool] = None, + can_restrict_members: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_promote_members: Optional[bool] = None, + is_anonymous: Optional[bool] = None, + can_manage_chat: Optional[bool] = None, + can_manage_video_chats: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -942,14 +942,14 @@ async def restrict_member( self, user_id: Union[str, int], permissions: ChatPermissions, - until_date: Union[int, datetime] = None, - use_independent_chat_permissions: bool = None, + until_date: Optional[Union[int, datetime]] = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -983,13 +983,13 @@ async def restrict_member( async def set_permissions( self, permissions: ChatPermissions, - use_independent_chat_permissions: bool = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1025,7 +1025,7 @@ async def set_administrator_custom_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1059,7 +1059,7 @@ async def set_photo( write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1093,7 +1093,7 @@ async def delete_photo( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1127,7 +1127,7 @@ async def set_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1156,13 +1156,13 @@ async def set_title( async def set_description( self, - description: str = None, + description: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1198,7 +1198,7 @@ async def pin_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1224,13 +1224,13 @@ async def pin_message( async def unpin_message( self, - message_id: int = None, + message_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1260,7 +1260,7 @@ async def unpin_all_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1288,18 +1288,18 @@ async def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1336,19 +1336,19 @@ async def send_media_group( Union["InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo"] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, ) -> Tuple["Message", ...]: """Shortcut for:: @@ -1382,13 +1382,13 @@ async def send_media_group( async def send_chat_action( self, action: str, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1417,23 +1417,23 @@ async def send_chat_action( async def send_photo( self, photo: Union[FileInput, "PhotoSize"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1468,23 +1468,23 @@ async def send_photo( async def send_contact( self, - phone_number: str = None, - first_name: str = None, - last_name: str = None, + phone_number: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - vcard: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + vcard: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - contact: "Contact" = None, + contact: Optional["Contact"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1519,27 +1519,27 @@ async def send_contact( async def send_audio( self, audio: Union[FileInput, "Audio"], - duration: int = None, - performer: str = None, - title: str = None, - caption: str = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1579,25 +1579,25 @@ async def send_audio( async def send_document( self, document: Union[FileInput, "Document"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - disable_content_type_detection: bool = None, + thumb: Optional[FileInput] = None, + disable_content_type_detection: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1635,18 +1635,18 @@ async def send_document( async def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - emoji: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + emoji: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1678,17 +1678,17 @@ async def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1724,33 +1724,33 @@ async def send_invoice( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - start_parameter: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - is_flexible: bool = None, + start_parameter: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + is_flexible: Optional[bool] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, - provider_data: Union[str, object] = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, + provider_data: Optional[Union[str, object]] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1810,25 +1810,25 @@ async def send_invoice( async def send_location( self, - latitude: float = None, - longitude: float = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - location: "Location" = None, + location: Optional["Location"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1865,28 +1865,28 @@ async def send_location( async def send_animation( self, animation: Union[FileInput, "Animation"], - duration: int = None, - width: int = None, - height: int = None, - thumb: FileInput = None, - caption: str = None, + duration: Optional[int] = None, + width: Optional[int] = None, + height: Optional[int] = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1928,18 +1928,18 @@ async def send_sticker( self, sticker: Union[FileInput, "Sticker"], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - emoji: str = None, + message_thread_id: Optional[int] = None, + emoji: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1970,27 +1970,27 @@ async def send_sticker( async def send_venue( self, - latitude: float = None, - longitude: float = None, - title: str = None, - address: str = None, - foursquare_id: str = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + title: Optional[str] = None, + address: Optional[str] = None, + foursquare_id: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - venue: "Venue" = None, + venue: Optional["Venue"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2029,29 +2029,29 @@ async def send_venue( async def send_video( self, video: Union[FileInput, "Video"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - width: int = None, - height: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + width: Optional[int] = None, + height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - supports_streaming: bool = None, - thumb: FileInput = None, + supports_streaming: Optional[bool] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2093,23 +2093,23 @@ async def send_video( async def send_video_note( self, video_note: Union[FileInput, "VideoNote"], - duration: int = None, - length: int = None, + duration: Optional[int] = None, + length: Optional[int] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - thumb: FileInput = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2145,23 +2145,23 @@ async def send_video_note( async def send_voice( self, voice: Union[FileInput, "Voice"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2198,28 +2198,28 @@ async def send_poll( self, question: str, options: Sequence[str], - is_anonymous: bool = None, - type: str = None, - allows_multiple_answers: bool = None, - correct_option_id: int = None, - is_closed: bool = None, + is_anonymous: Optional[bool] = None, + type: Optional[str] = None, + allows_multiple_answers: Optional[bool] = None, + correct_option_id: Optional[int] = None, + is_closed: Optional[bool] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - explanation: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + explanation: Optional[str] = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, - open_period: int = None, - close_date: Union[int, datetime] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[int, datetime]] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - explanation_entities: Sequence["MessageEntity"] = None, + explanation_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2262,21 +2262,21 @@ async def send_copy( self, from_chat_id: Union[str, int], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -2312,21 +2312,21 @@ async def copy_message( self, chat_id: Union[int, str], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -2364,13 +2364,13 @@ async def forward_from( message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2406,13 +2406,13 @@ async def forward_to( message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2449,7 +2449,7 @@ async def export_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> str: """Shortcut for:: @@ -2475,16 +2475,16 @@ async def export_invite_link( async def create_invite_link( self, - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "ChatInviteLink": """Shortcut for:: @@ -2519,16 +2519,16 @@ async def create_invite_link( async def edit_invite_link( self, invite_link: Union[str, "ChatInviteLink"], - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "ChatInviteLink": """Shortcut for:: @@ -2568,7 +2568,7 @@ async def revoke_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "ChatInviteLink": """Shortcut for:: @@ -2601,7 +2601,7 @@ async def approve_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2634,7 +2634,7 @@ async def decline_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2661,13 +2661,13 @@ async def decline_join_request( async def set_menu_button( self, - menu_button: MenuButton = None, + menu_button: Optional[MenuButton] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2699,14 +2699,14 @@ async def set_menu_button( async def create_forum_topic( self, name: str, - icon_color: int = None, - icon_custom_emoji_id: str = None, + icon_color: Optional[int] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> ForumTopic: """Shortcut for:: @@ -2735,14 +2735,14 @@ async def create_forum_topic( async def edit_forum_topic( self, message_thread_id: int, - name: str = None, - icon_custom_emoji_id: str = None, + name: Optional[str] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2776,7 +2776,7 @@ async def close_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2808,7 +2808,7 @@ async def reopen_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2840,7 +2840,7 @@ async def delete_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2872,7 +2872,7 @@ async def unpin_all_forum_topic_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2905,7 +2905,7 @@ async def edit_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2938,7 +2938,7 @@ async def close_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2968,7 +2968,7 @@ async def reopen_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3000,7 +3000,7 @@ async def hide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3030,7 +3030,7 @@ async def unhide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3062,7 +3062,7 @@ async def get_menu_button( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> MenuButton: """Shortcut for:: diff --git a/telegram/_chatadministratorrights.py b/telegram/_chatadministratorrights.py index 0a86c5d38f2..cea12dd15e5 100644 --- a/telegram/_chatadministratorrights.py +++ b/telegram/_chatadministratorrights.py @@ -127,12 +127,12 @@ def __init__( can_promote_members: bool, can_change_info: bool, can_invite_users: bool, - can_post_messages: bool = None, - can_edit_messages: bool = None, - can_pin_messages: bool = None, - can_manage_topics: bool = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> None: super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_chatinvitelink.py b/telegram/_chatinvitelink.py index 9718d5bf8ce..6b9789ac739 100644 --- a/telegram/_chatinvitelink.py +++ b/telegram/_chatinvitelink.py @@ -118,12 +118,12 @@ def __init__( creates_join_request: bool, is_primary: bool, is_revoked: bool, - expire_date: datetime.datetime = None, - member_limit: int = None, - name: str = None, - pending_join_request_count: int = None, + expire_date: Optional[datetime.datetime] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + pending_join_request_count: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_chatjoinrequest.py b/telegram/_chatjoinrequest.py index 9629569d634..5c70f230c0a 100644 --- a/telegram/_chatjoinrequest.py +++ b/telegram/_chatjoinrequest.py @@ -102,10 +102,10 @@ def __init__( from_user: User, date: datetime.datetime, user_chat_id: int, - bio: str = None, - invite_link: ChatInviteLink = None, + bio: Optional[str] = None, + invite_link: Optional[ChatInviteLink] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -147,7 +147,7 @@ async def approve( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -179,7 +179,7 @@ async def decline( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: diff --git a/telegram/_chatlocation.py b/telegram/_chatlocation.py index 7bc878766e1..1811ecb706d 100644 --- a/telegram/_chatlocation.py +++ b/telegram/_chatlocation.py @@ -57,7 +57,7 @@ def __init__( location: Location, address: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.location: Location = location diff --git a/telegram/_chatmember.py b/telegram/_chatmember.py index bea0d593eb1..e0dbf763ce4 100644 --- a/telegram/_chatmember.py +++ b/telegram/_chatmember.py @@ -92,7 +92,7 @@ def __init__( user: User, status: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required by all subclasses @@ -162,9 +162,9 @@ def __init__( self, user: User, is_anonymous: bool, - custom_title: str = None, + custom_title: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.OWNER, user=user, api_kwargs=api_kwargs) with self._unfrozen(): @@ -295,13 +295,13 @@ def __init__( can_promote_members: bool, can_change_info: bool, can_invite_users: bool, - can_post_messages: bool = None, - can_edit_messages: bool = None, - can_pin_messages: bool = None, - can_manage_topics: bool = None, - custom_title: str = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, + custom_title: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.ADMINISTRATOR, user=user, api_kwargs=api_kwargs) with self._unfrozen(): @@ -344,7 +344,7 @@ def __init__( self, user: User, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.MEMBER, user=user, api_kwargs=api_kwargs) self._freeze() @@ -511,7 +511,7 @@ def __init__( can_send_video_notes: bool, can_send_voice_notes: bool, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.RESTRICTED, user=user, api_kwargs=api_kwargs) with self._unfrozen(): @@ -556,7 +556,7 @@ def __init__( self, user: User, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.LEFT, user=user, api_kwargs=api_kwargs) self._freeze() @@ -596,7 +596,7 @@ def __init__( user: User, until_date: datetime.datetime, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(status=ChatMember.BANNED, user=user, api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_chatmemberupdated.py b/telegram/_chatmemberupdated.py index 44d6a55fd85..9340c7bef2c 100644 --- a/telegram/_chatmemberupdated.py +++ b/telegram/_chatmemberupdated.py @@ -100,10 +100,10 @@ def __init__( date: datetime.datetime, old_chat_member: ChatMember, new_chat_member: ChatMember, - invite_link: ChatInviteLink = None, - via_chat_folder_invite_link: bool = None, + invite_link: Optional[ChatInviteLink] = None, + via_chat_folder_invite_link: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_chatpermissions.py b/telegram/_chatpermissions.py index 0fb269b3ee4..a2385d2becc 100644 --- a/telegram/_chatpermissions.py +++ b/telegram/_chatpermissions.py @@ -166,23 +166,23 @@ class ChatPermissions(TelegramObject): def __init__( self, - can_send_messages: bool = None, - can_send_media_messages: bool = None, - can_send_polls: bool = None, - can_send_other_messages: bool = None, - can_add_web_page_previews: bool = None, - can_change_info: bool = None, - can_invite_users: bool = None, - can_pin_messages: bool = None, - can_manage_topics: bool = None, - can_send_audios: bool = None, - can_send_documents: bool = None, - can_send_photos: bool = None, - can_send_videos: bool = None, - can_send_video_notes: bool = None, - can_send_voice_notes: bool = None, + can_send_messages: Optional[bool] = None, + can_send_media_messages: Optional[bool] = None, + can_send_polls: Optional[bool] = None, + can_send_other_messages: Optional[bool] = None, + can_add_web_page_previews: Optional[bool] = None, + can_change_info: Optional[bool] = None, + can_invite_users: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, + can_send_audios: Optional[bool] = None, + can_send_documents: Optional[bool] = None, + can_send_photos: Optional[bool] = None, + can_send_videos: Optional[bool] = None, + can_send_video_notes: Optional[bool] = None, + can_send_voice_notes: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_choseninlineresult.py b/telegram/_choseninlineresult.py index 94a91ba13ae..d6e29fb94f6 100644 --- a/telegram/_choseninlineresult.py +++ b/telegram/_choseninlineresult.py @@ -72,10 +72,10 @@ def __init__( result_id: str, from_user: User, query: str, - location: Location = None, - inline_message_id: str = None, + location: Optional[Location] = None, + inline_message_id: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_dice.py b/telegram/_dice.py index 48964527a26..5182f802e5a 100644 --- a/telegram/_dice.py +++ b/telegram/_dice.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram Dice.""" -from typing import ClassVar, List +from typing import ClassVar, List, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -89,7 +89,7 @@ class Dice(TelegramObject): __slots__ = ("emoji", "value") - def __init__(self, value: int, emoji: str, *, api_kwargs: JSONDict = None): + def __init__(self, value: int, emoji: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.value: int = value self.emoji: str = emoji diff --git a/telegram/_files/_basemedium.py b/telegram/_files/_basemedium.py index 403c4842f31..c8bbbd333cc 100644 --- a/telegram/_files/_basemedium.py +++ b/telegram/_files/_basemedium.py @@ -56,9 +56,9 @@ def __init__( self, file_id: str, file_unique_id: str, - file_size: int = None, + file_size: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) @@ -77,7 +77,7 @@ async def get_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "File": """Convenience wrapper over :meth:`telegram.Bot.get_file` diff --git a/telegram/_files/_basethumbedmedium.py b/telegram/_files/_basethumbedmedium.py index a23e8b8d42e..e0ba2ec9e3b 100644 --- a/telegram/_files/_basethumbedmedium.py +++ b/telegram/_files/_basethumbedmedium.py @@ -74,11 +74,11 @@ def __init__( self, file_id: str, file_unique_id: str, - file_size: int = None, - thumb: PhotoSize = None, - thumbnail: PhotoSize = None, + file_size: Optional[int] = None, + thumb: Optional[PhotoSize] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/animation.py b/telegram/_files/animation.py index c8c8478ff99..aa7c9160069 100644 --- a/telegram/_files/animation.py +++ b/telegram/_files/animation.py @@ -79,13 +79,13 @@ def __init__( width: int, height: int, duration: int, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - thumbnail: PhotoSize = None, + thumb: Optional[PhotoSize] = None, + file_name: Optional[str] = None, + mime_type: Optional[str] = None, + file_size: Optional[int] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/audio.py b/telegram/_files/audio.py index 92cee789af5..f0e315ce11f 100644 --- a/telegram/_files/audio.py +++ b/telegram/_files/audio.py @@ -80,15 +80,15 @@ def __init__( file_id: str, file_unique_id: str, duration: int, - performer: str = None, - title: str = None, - mime_type: str = None, - file_size: int = None, - thumb: PhotoSize = None, - file_name: str = None, - thumbnail: PhotoSize = None, + performer: Optional[str] = None, + title: Optional[str] = None, + mime_type: Optional[str] = None, + file_size: Optional[int] = None, + thumb: Optional[PhotoSize] = None, + file_name: Optional[str] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/chatphoto.py b/telegram/_files/chatphoto.py index 5ab606380fc..afc99e07dae 100644 --- a/telegram/_files/chatphoto.py +++ b/telegram/_files/chatphoto.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram ChatPhoto.""" -from typing import TYPE_CHECKING, ClassVar +from typing import TYPE_CHECKING, ClassVar, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -87,7 +87,7 @@ def __init__( big_file_id: str, big_file_unique_id: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.small_file_id: str = small_file_id @@ -109,7 +109,7 @@ async def get_small_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "File": """Convenience wrapper over :meth:`telegram.Bot.get_file` for getting the small (:tg-const:`telegram.ChatPhoto.SIZE_SMALL` x :tg-const:`telegram.ChatPhoto.SIZE_SMALL`) @@ -140,7 +140,7 @@ async def get_big_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "File": """Convenience wrapper over :meth:`telegram.Bot.get_file` for getting the big (:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`) diff --git a/telegram/_files/contact.py b/telegram/_files/contact.py index aff65deb556..9133841174f 100644 --- a/telegram/_files/contact.py +++ b/telegram/_files/contact.py @@ -51,11 +51,11 @@ def __init__( self, phone_number: str, first_name: str, - last_name: str = None, - user_id: int = None, - vcard: str = None, + last_name: Optional[str] = None, + user_id: Optional[int] = None, + vcard: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_files/document.py b/telegram/_files/document.py index 650eb38db4b..a16c6900e29 100644 --- a/telegram/_files/document.py +++ b/telegram/_files/document.py @@ -67,13 +67,13 @@ def __init__( self, file_id: str, file_unique_id: str, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - thumbnail: PhotoSize = None, + thumb: Optional[PhotoSize] = None, + file_name: Optional[str] = None, + mime_type: Optional[str] = None, + file_size: Optional[int] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/file.py b/telegram/_files/file.py index 7cd86f1bccb..e96860f5f17 100644 --- a/telegram/_files/file.py +++ b/telegram/_files/file.py @@ -85,10 +85,10 @@ def __init__( self, file_id: str, file_unique_id: str, - file_size: int = None, - file_path: str = None, + file_size: Optional[int] = None, + file_path: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) @@ -119,7 +119,7 @@ def _prepare_decrypt(self, buf: bytes) -> bytes: async def download_to_drive( self, - custom_path: FilePathInput = None, + custom_path: Optional[FilePathInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, @@ -270,7 +270,7 @@ async def download_to_memory( async def download_as_bytearray( self, - buf: bytearray = None, + buf: Optional[bytearray] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_files/inputfile.py b/telegram/_files/inputfile.py index 8cc8b8ba9f9..730301869bd 100644 --- a/telegram/_files/inputfile.py +++ b/telegram/_files/inputfile.py @@ -66,7 +66,10 @@ class InputFile: __slots__ = ("filename", "attach_name", "input_file_content", "mimetype") def __init__( - self, obj: Union[IO[bytes], bytes, str], filename: str = None, attach: bool = False + self, + obj: Union[IO[bytes], bytes, str], + filename: Optional[str] = None, + attach: bool = False, ): if isinstance(obj, bytes): self.input_file_content: bytes = obj diff --git a/telegram/_files/inputmedia.py b/telegram/_files/inputmedia.py index 0967be8e3a7..1c978ebf315 100644 --- a/telegram/_files/inputmedia.py +++ b/telegram/_files/inputmedia.py @@ -91,11 +91,11 @@ def __init__( self, media_type: str, media: Union[str, InputFile, MediaType], - caption: str = None, - caption_entities: Sequence[MessageEntity] = None, + caption: Optional[str] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.type: str = media_type @@ -196,18 +196,18 @@ class InputMediaAnimation(InputMedia): def __init__( self, media: Union[FileInput, Animation], - thumb: FileInput = None, - caption: str = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - width: int = None, - height: int = None, - duration: int = None, - caption_entities: Sequence[MessageEntity] = None, - filename: str = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + width: Optional[int] = None, + height: Optional[int] = None, + duration: Optional[int] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + filename: Optional[str] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if isinstance(media, Animation): width = media.width if width is None else width @@ -304,13 +304,13 @@ class InputMediaPhoto(InputMedia): def __init__( self, media: Union[FileInput, PhotoSize], - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, - filename: str = None, - has_spoiler: bool = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + filename: Optional[str] = None, + has_spoiler: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # We use local_mode=True because we don't have access to the actual setting and want # things to work in local mode. @@ -423,19 +423,19 @@ class InputMediaVideo(InputMedia): def __init__( self, media: Union[FileInput, Video], - caption: str = None, - width: int = None, - height: int = None, - duration: int = None, - supports_streaming: bool = None, + caption: Optional[str] = None, + width: Optional[int] = None, + height: Optional[int] = None, + duration: Optional[int] = None, + supports_streaming: Optional[bool] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - caption_entities: Sequence[MessageEntity] = None, - filename: str = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + thumb: Optional[FileInput] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + filename: Optional[str] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if isinstance(media, Video): width = width if width is not None else media.width @@ -555,17 +555,17 @@ class InputMediaAudio(InputMedia): def __init__( self, media: Union[FileInput, Audio], - thumb: FileInput = None, - caption: str = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - duration: int = None, - performer: str = None, - title: str = None, - caption_entities: Sequence[MessageEntity] = None, - filename: str = None, - thumbnail: FileInput = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + filename: Optional[str] = None, + thumbnail: Optional[FileInput] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if isinstance(media, Audio): duration = media.duration if duration is None else duration @@ -675,15 +675,15 @@ class InputMediaDocument(InputMedia): def __init__( self, media: Union[FileInput, Document], - thumb: FileInput = None, - caption: str = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - disable_content_type_detection: bool = None, - caption_entities: Sequence[MessageEntity] = None, - filename: str = None, - thumbnail: FileInput = None, + disable_content_type_detection: Optional[bool] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + filename: Optional[str] = None, + thumbnail: Optional[FileInput] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # We use local_mode=True because we don't have access to the actual setting and want # things to work in local mode. diff --git a/telegram/_files/inputsticker.py b/telegram/_files/inputsticker.py index 44bab4c2efb..da78bb00f3d 100644 --- a/telegram/_files/inputsticker.py +++ b/telegram/_files/inputsticker.py @@ -74,10 +74,10 @@ def __init__( self, sticker: FileInput, emoji_list: Sequence[str], - mask_position: MaskPosition = None, - keywords: Sequence[str] = None, + mask_position: Optional[MaskPosition] = None, + keywords: Optional[Sequence[str]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_files/location.py b/telegram/_files/location.py index e818f1bdb1f..1666a8bd154 100644 --- a/telegram/_files/location.py +++ b/telegram/_files/location.py @@ -72,12 +72,12 @@ def __init__( self, longitude: float, latitude: float, - horizontal_accuracy: float = None, - live_period: int = None, - heading: int = None, - proximity_alert_radius: int = None, + horizontal_accuracy: Optional[float] = None, + live_period: Optional[int] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_files/photosize.py b/telegram/_files/photosize.py index c31897c02cd..2a267b881f7 100644 --- a/telegram/_files/photosize.py +++ b/telegram/_files/photosize.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram PhotoSize.""" +from typing import Optional + from telegram._files._basemedium import _BaseMedium from telegram._utils.types import JSONDict @@ -59,9 +61,9 @@ def __init__( file_unique_id: str, width: int, height: int, - file_size: int = None, + file_size: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/sticker.py b/telegram/_files/sticker.py index 7477e10f9d4..cf291225040 100644 --- a/telegram/_files/sticker.py +++ b/telegram/_files/sticker.py @@ -157,17 +157,17 @@ def __init__( is_animated: bool, is_video: bool, type: str, # pylint: disable=redefined-builtin - thumb: PhotoSize = None, - emoji: str = None, - file_size: int = None, - set_name: str = None, - mask_position: "MaskPosition" = None, - premium_animation: "File" = None, - custom_emoji_id: str = None, - thumbnail: PhotoSize = None, - needs_repainting: bool = None, + thumb: Optional[PhotoSize] = None, + emoji: Optional[str] = None, + file_size: Optional[int] = None, + set_name: Optional[str] = None, + mask_position: Optional["MaskPosition"] = None, + premium_animation: Optional["File"] = None, + custom_emoji_id: Optional[str] = None, + thumbnail: Optional[PhotoSize] = None, + needs_repainting: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, @@ -302,10 +302,10 @@ def __init__( stickers: Sequence[Sticker], is_video: bool, sticker_type: str, - thumb: PhotoSize = None, - thumbnail: PhotoSize = None, + thumb: Optional[PhotoSize] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.name: str = name @@ -406,7 +406,7 @@ def __init__( y_shift: float, scale: float, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.point: str = point diff --git a/telegram/_files/venue.py b/telegram/_files/venue.py index f737c914100..f47c5863b34 100644 --- a/telegram/_files/venue.py +++ b/telegram/_files/venue.py @@ -79,12 +79,12 @@ def __init__( location: Location, title: str, address: str, - foursquare_id: str = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + foursquare_id: Optional[str] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_files/video.py b/telegram/_files/video.py index a6b0a4d3202..b77acc71b19 100644 --- a/telegram/_files/video.py +++ b/telegram/_files/video.py @@ -76,13 +76,13 @@ def __init__( width: int, height: int, duration: int, - thumb: PhotoSize = None, - mime_type: str = None, - file_size: int = None, - file_name: str = None, - thumbnail: PhotoSize = None, + thumb: Optional[PhotoSize] = None, + mime_type: Optional[str] = None, + file_size: Optional[int] = None, + file_name: Optional[str] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/videonote.py b/telegram/_files/videonote.py index 12580cbc297..463b717fe6e 100644 --- a/telegram/_files/videonote.py +++ b/telegram/_files/videonote.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram VideoNote.""" +from typing import Optional + from telegram._files._basethumbedmedium import _BaseThumbedMedium from telegram._files.photosize import PhotoSize from telegram._utils.types import JSONDict @@ -71,11 +73,11 @@ def __init__( file_unique_id: str, length: int, duration: int, - thumb: PhotoSize = None, - file_size: int = None, - thumbnail: PhotoSize = None, + thumb: Optional[PhotoSize] = None, + file_size: Optional[int] = None, + thumbnail: Optional[PhotoSize] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_files/voice.py b/telegram/_files/voice.py index 2f557d93e45..155b4fd58b7 100644 --- a/telegram/_files/voice.py +++ b/telegram/_files/voice.py @@ -58,10 +58,10 @@ def __init__( file_id: str, file_unique_id: str, duration: int, - mime_type: str = None, - file_size: int = None, + mime_type: Optional[str] = None, + file_size: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__( file_id=file_id, diff --git a/telegram/_forcereply.py b/telegram/_forcereply.py index 32acd38e26d..569edf19dfc 100644 --- a/telegram/_forcereply.py +++ b/telegram/_forcereply.py @@ -79,10 +79,10 @@ class ForceReply(TelegramObject): def __init__( self, - selective: bool = None, - input_field_placeholder: str = None, + selective: Optional[bool] = None, + input_field_placeholder: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.force_reply: bool = True diff --git a/telegram/_forumtopic.py b/telegram/_forumtopic.py index d46c787e971..69d53eb75d5 100644 --- a/telegram/_forumtopic.py +++ b/telegram/_forumtopic.py @@ -55,9 +55,9 @@ def __init__( message_thread_id: int, name: str, icon_color: int, - icon_custom_emoji_id: str = None, + icon_custom_emoji_id: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.message_thread_id: int = message_thread_id @@ -99,9 +99,9 @@ def __init__( self, name: str, icon_color: int, - icon_custom_emoji_id: str = None, + icon_custom_emoji_id: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.name: str = name @@ -123,7 +123,7 @@ class ForumTopicClosed(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: super().__init__(api_kwargs=api_kwargs) self._freeze() @@ -139,7 +139,7 @@ class ForumTopicReopened(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: super().__init__(api_kwargs=api_kwargs) self._freeze() @@ -169,10 +169,10 @@ class ForumTopicEdited(TelegramObject): def __init__( self, - name: str = None, - icon_custom_emoji_id: str = None, + name: Optional[str] = None, + icon_custom_emoji_id: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.name: Optional[str] = name @@ -193,7 +193,7 @@ class GeneralForumTopicHidden(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self._freeze() @@ -209,7 +209,7 @@ class GeneralForumTopicUnhidden(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self._freeze() diff --git a/telegram/_games/callbackgame.py b/telegram/_games/callbackgame.py index d02ed2c5870..20b788920e1 100644 --- a/telegram/_games/callbackgame.py +++ b/telegram/_games/callbackgame.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram CallbackGame.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -27,7 +29,7 @@ class CallbackGame(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: super().__init__(api_kwargs=api_kwargs) self._freeze() diff --git a/telegram/_games/game.py b/telegram/_games/game.py index 9efd4871b06..148b75a964a 100644 --- a/telegram/_games/game.py +++ b/telegram/_games/game.py @@ -101,11 +101,11 @@ def __init__( title: str, description: str, photo: Sequence[PhotoSize], - text: str = None, - text_entities: Sequence[MessageEntity] = None, - animation: Animation = None, + text: Optional[str] = None, + text_entities: Optional[Sequence[MessageEntity]] = None, + animation: Optional[Animation] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -162,7 +162,7 @@ def parse_text_entity(self, entity: MessageEntity) -> str: return entity_text.decode("utf-16-le") - def parse_text_entities(self, types: List[str] = None) -> Dict[MessageEntity, str]: + def parse_text_entities(self, types: Optional[List[str]] = None) -> Dict[MessageEntity, str]: """ Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`. It contains entities from this message filtered by their diff --git a/telegram/_games/gamehighscore.py b/telegram/_games/gamehighscore.py index 8f5622190a7..c98540a6514 100644 --- a/telegram/_games/gamehighscore.py +++ b/telegram/_games/gamehighscore.py @@ -48,7 +48,9 @@ class GameHighScore(TelegramObject): __slots__ = ("position", "user", "score") - def __init__(self, position: int, user: User, score: int, *, api_kwargs: JSONDict = None): + def __init__( + self, position: int, user: User, score: int, *, api_kwargs: Optional[JSONDict] = None + ): super().__init__(api_kwargs=api_kwargs) self.position: int = position self.user: User = user diff --git a/telegram/_inline/inlinekeyboardbutton.py b/telegram/_inline/inlinekeyboardbutton.py index 6b8a634b587..83163948ca4 100644 --- a/telegram/_inline/inlinekeyboardbutton.py +++ b/telegram/_inline/inlinekeyboardbutton.py @@ -220,17 +220,17 @@ class InlineKeyboardButton(TelegramObject): def __init__( self, text: str, - url: str = None, - callback_data: Union[str, object] = None, - switch_inline_query: str = None, - switch_inline_query_current_chat: str = None, - callback_game: CallbackGame = None, - pay: bool = None, - login_url: LoginUrl = None, - web_app: WebAppInfo = None, - switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat = None, + url: Optional[str] = None, + callback_data: Optional[Union[str, object]] = None, + switch_inline_query: Optional[str] = None, + switch_inline_query_current_chat: Optional[str] = None, + callback_game: Optional[CallbackGame] = None, + pay: Optional[bool] = None, + login_url: Optional[LoginUrl] = None, + web_app: Optional[WebAppInfo] = None, + switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_inline/inlinekeyboardmarkup.py b/telegram/_inline/inlinekeyboardmarkup.py index 923813ac126..78b04fec755 100644 --- a/telegram/_inline/inlinekeyboardmarkup.py +++ b/telegram/_inline/inlinekeyboardmarkup.py @@ -72,7 +72,7 @@ def __init__( self, inline_keyboard: Sequence[Sequence[InlineKeyboardButton]], *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) if not check_keyboard_type(inline_keyboard): diff --git a/telegram/_inline/inlinequery.py b/telegram/_inline/inlinequery.py index ae5abe23847..786430ebede 100644 --- a/telegram/_inline/inlinequery.py +++ b/telegram/_inline/inlinequery.py @@ -104,10 +104,10 @@ def __init__( from_user: User, query: str, offset: str, - location: Location = None, - chat_type: str = None, + location: Optional[Location] = None, + chat_type: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -142,20 +142,20 @@ async def answer( results: Union[ Sequence["InlineQueryResult"], Callable[[int], Optional[Sequence["InlineQueryResult"]]] ], - cache_time: int = None, - is_personal: bool = None, - next_offset: str = None, - switch_pm_text: str = None, - switch_pm_parameter: str = None, - button: InlineQueryResultsButton = None, + cache_time: Optional[int] = None, + is_personal: Optional[bool] = None, + next_offset: Optional[str] = None, + switch_pm_text: Optional[str] = None, + switch_pm_parameter: Optional[str] = None, + button: Optional[InlineQueryResultsButton] = None, *, - current_offset: str = None, + current_offset: Optional[str] = None, auto_pagination: bool = False, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: diff --git a/telegram/_inline/inlinequeryresult.py b/telegram/_inline/inlinequeryresult.py index 14149682f69..69d7f5de9ca 100644 --- a/telegram/_inline/inlinequeryresult.py +++ b/telegram/_inline/inlinequeryresult.py @@ -19,7 +19,7 @@ # pylint: disable=redefined-builtin """This module contains the classes that represent Telegram InlineQueryResult.""" -from typing import ClassVar +from typing import ClassVar, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -55,7 +55,7 @@ class InlineQueryResult(TelegramObject): __slots__ = ("type", "id") - def __init__(self, type: str, id: str, *, api_kwargs: JSONDict = None): + def __init__(self, type: str, id: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_inline/inlinequeryresultarticle.py b/telegram/_inline/inlinequeryresultarticle.py index 52d6afe33e1..d82ee58c657 100644 --- a/telegram/_inline/inlinequeryresultarticle.py +++ b/telegram/_inline/inlinequeryresultarticle.py @@ -117,18 +117,18 @@ def __init__( id: str, # pylint: disable=redefined-builtin title: str, input_message_content: "InputMessageContent", - reply_markup: InlineKeyboardMarkup = None, - url: str = None, - hide_url: bool = None, - description: str = None, - thumb_url: str = None, - thumb_width: int = None, - thumb_height: int = None, - thumbnail_url: str = None, - thumbnail_width: int = None, - thumbnail_height: int = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + url: Optional[str] = None, + hide_url: Optional[bool] = None, + description: Optional[str] = None, + thumb_url: Optional[str] = None, + thumb_width: Optional[int] = None, + thumb_height: Optional[int] = None, + thumbnail_url: Optional[str] = None, + thumbnail_width: Optional[int] = None, + thumbnail_height: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.ARTICLE, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultaudio.py b/telegram/_inline/inlinequeryresultaudio.py index 23df9993295..cd821db9aa7 100644 --- a/telegram/_inline/inlinequeryresultaudio.py +++ b/telegram/_inline/inlinequeryresultaudio.py @@ -103,15 +103,15 @@ def __init__( id: str, # pylint: disable=redefined-builtin audio_url: str, title: str, - performer: str = None, - audio_duration: int = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + performer: Optional[str] = None, + audio_duration: Optional[int] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.AUDIO, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedaudio.py b/telegram/_inline/inlinequeryresultcachedaudio.py index 92a6c94eaef..a30ede99391 100644 --- a/telegram/_inline/inlinequeryresultcachedaudio.py +++ b/telegram/_inline/inlinequeryresultcachedaudio.py @@ -94,13 +94,13 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin audio_file_id: str, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.AUDIO, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcacheddocument.py b/telegram/_inline/inlinequeryresultcacheddocument.py index 000196fd758..4e189e6f201 100644 --- a/telegram/_inline/inlinequeryresultcacheddocument.py +++ b/telegram/_inline/inlinequeryresultcacheddocument.py @@ -101,14 +101,14 @@ def __init__( id: str, # pylint: disable=redefined-builtin title: str, document_file_id: str, - description: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + description: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.DOCUMENT, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedgif.py b/telegram/_inline/inlinequeryresultcachedgif.py index a590f1f30f7..636fd00ffad 100644 --- a/telegram/_inline/inlinequeryresultcachedgif.py +++ b/telegram/_inline/inlinequeryresultcachedgif.py @@ -98,14 +98,14 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin gif_file_id: str, - title: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + title: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.GIF, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedmpeg4gif.py b/telegram/_inline/inlinequeryresultcachedmpeg4gif.py index b741e7b735b..64eb805a64a 100644 --- a/telegram/_inline/inlinequeryresultcachedmpeg4gif.py +++ b/telegram/_inline/inlinequeryresultcachedmpeg4gif.py @@ -98,14 +98,14 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin mpeg4_file_id: str, - title: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + title: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.MPEG4GIF, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedphoto.py b/telegram/_inline/inlinequeryresultcachedphoto.py index 1197a8d2a95..9a4387b40c4 100644 --- a/telegram/_inline/inlinequeryresultcachedphoto.py +++ b/telegram/_inline/inlinequeryresultcachedphoto.py @@ -101,15 +101,15 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin photo_file_id: str, - title: str = None, - description: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + title: Optional[str] = None, + description: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.PHOTO, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedsticker.py b/telegram/_inline/inlinequeryresultcachedsticker.py index c1e3bdab5ee..b16bbc10fc5 100644 --- a/telegram/_inline/inlinequeryresultcachedsticker.py +++ b/telegram/_inline/inlinequeryresultcachedsticker.py @@ -66,10 +66,10 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin sticker_file_id: str, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.STICKER, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedvideo.py b/telegram/_inline/inlinequeryresultcachedvideo.py index de1ede6a2e7..4f2943580db 100644 --- a/telegram/_inline/inlinequeryresultcachedvideo.py +++ b/telegram/_inline/inlinequeryresultcachedvideo.py @@ -98,14 +98,14 @@ def __init__( id: str, # pylint: disable=redefined-builtin video_file_id: str, title: str, - description: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + description: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.VIDEO, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcachedvoice.py b/telegram/_inline/inlinequeryresultcachedvoice.py index 6ca2482b1be..a14af762402 100644 --- a/telegram/_inline/inlinequeryresultcachedvoice.py +++ b/telegram/_inline/inlinequeryresultcachedvoice.py @@ -98,13 +98,13 @@ def __init__( id: str, # pylint: disable=redefined-builtin voice_file_id: str, title: str, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.VOICE, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultcontact.py b/telegram/_inline/inlinequeryresultcontact.py index 1e08323f165..6a5653e4137 100644 --- a/telegram/_inline/inlinequeryresultcontact.py +++ b/telegram/_inline/inlinequeryresultcontact.py @@ -117,18 +117,18 @@ def __init__( id: str, # pylint: disable=redefined-builtin phone_number: str, first_name: str, - last_name: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - thumb_url: str = None, - thumb_width: int = None, - thumb_height: int = None, - vcard: str = None, - thumbnail_url: str = None, - thumbnail_width: int = None, - thumbnail_height: int = None, + last_name: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + thumb_url: Optional[str] = None, + thumb_width: Optional[int] = None, + thumb_height: Optional[int] = None, + vcard: Optional[str] = None, + thumbnail_url: Optional[str] = None, + thumbnail_width: Optional[int] = None, + thumbnail_height: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.CONTACT, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultdocument.py b/telegram/_inline/inlinequeryresultdocument.py index 75e6594befe..ac81a628f64 100644 --- a/telegram/_inline/inlinequeryresultdocument.py +++ b/telegram/_inline/inlinequeryresultdocument.py @@ -146,20 +146,20 @@ def __init__( document_url: str, title: str, mime_type: str, - caption: str = None, - description: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - thumb_url: str = None, - thumb_width: int = None, - thumb_height: int = None, + caption: Optional[str] = None, + description: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + thumb_url: Optional[str] = None, + thumb_width: Optional[int] = None, + thumb_height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, - thumbnail_url: str = None, - thumbnail_width: int = None, - thumbnail_height: int = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + thumbnail_url: Optional[str] = None, + thumbnail_width: Optional[int] = None, + thumbnail_height: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.DOCUMENT, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultgame.py b/telegram/_inline/inlinequeryresultgame.py index 513372f4411..f05a22bbc8d 100644 --- a/telegram/_inline/inlinequeryresultgame.py +++ b/telegram/_inline/inlinequeryresultgame.py @@ -53,9 +53,9 @@ def __init__( self, id: str, # pylint: disable=redefined-builtin game_short_name: str, - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.GAME, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultgif.py b/telegram/_inline/inlinequeryresultgif.py index cd65e4af308..62db88b3d1d 100644 --- a/telegram/_inline/inlinequeryresultgif.py +++ b/telegram/_inline/inlinequeryresultgif.py @@ -151,22 +151,22 @@ def __init__( # thumbnail_url is not optional in Telegram API, but we want to support thumb_url as well, # so thumbnail_url may not be passed. We will raise ValueError manually if neither # thumbnail_url nor thumb_url are passed - thumbnail_url: str = None, - gif_width: int = None, - gif_height: int = None, - title: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - gif_duration: int = None, + thumbnail_url: Optional[str] = None, + gif_width: Optional[int] = None, + gif_height: Optional[int] = None, + title: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + gif_duration: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb_mime_type: str = None, - caption_entities: Sequence[MessageEntity] = None, - thumbnail_mime_type: str = None, + thumb_mime_type: Optional[str] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + thumbnail_mime_type: Optional[str] = None, # thumb_url is not optional in Telegram API, but it is here, along with thumbnail_url. - thumb_url: str = None, + thumb_url: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if not (thumbnail_url or thumb_url): raise ValueError( diff --git a/telegram/_inline/inlinequeryresultlocation.py b/telegram/_inline/inlinequeryresultlocation.py index c6dd7e0138c..84fbe93c932 100644 --- a/telegram/_inline/inlinequeryresultlocation.py +++ b/telegram/_inline/inlinequeryresultlocation.py @@ -149,20 +149,20 @@ def __init__( latitude: float, longitude: float, title: str, - live_period: int = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - thumb_url: str = None, - thumb_width: int = None, - thumb_height: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, - thumbnail_url: str = None, - thumbnail_width: int = None, - thumbnail_height: int = None, + live_period: Optional[int] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + thumb_url: Optional[str] = None, + thumb_width: Optional[int] = None, + thumb_height: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, + thumbnail_url: Optional[str] = None, + thumbnail_width: Optional[int] = None, + thumbnail_height: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(constants.InlineQueryResultType.LOCATION, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultmpeg4gif.py b/telegram/_inline/inlinequeryresultmpeg4gif.py index fbedef276c0..2872743327d 100644 --- a/telegram/_inline/inlinequeryresultmpeg4gif.py +++ b/telegram/_inline/inlinequeryresultmpeg4gif.py @@ -144,22 +144,22 @@ def __init__( # thumbnail_url is not optional in Telegram API, but we want to support thumb_url as well, # so thumbnail_url may not be passed. We will raise ValueError manually if neither # thumbnail_url nor thumb_url are passed - thumbnail_url: str = None, - mpeg4_width: int = None, - mpeg4_height: int = None, - title: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - mpeg4_duration: int = None, + thumbnail_url: Optional[str] = None, + mpeg4_width: Optional[int] = None, + mpeg4_height: Optional[int] = None, + title: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + mpeg4_duration: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb_mime_type: str = None, - caption_entities: Sequence[MessageEntity] = None, - thumbnail_mime_type: str = None, + thumb_mime_type: Optional[str] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, + thumbnail_mime_type: Optional[str] = None, # thumb_url is not optional in Telegram API, but it is here, along with thumbnail_url. - thumb_url: str = None, + thumb_url: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if not (thumbnail_url or thumb_url): raise ValueError( diff --git a/telegram/_inline/inlinequeryresultphoto.py b/telegram/_inline/inlinequeryresultphoto.py index 6313246285c..b27096162a8 100644 --- a/telegram/_inline/inlinequeryresultphoto.py +++ b/telegram/_inline/inlinequeryresultphoto.py @@ -134,20 +134,20 @@ def __init__( # thumbnail_url is not optional in Telegram API, but we want to support thumb_url as well, # so thumbnail_url may not be passed. We will raise ValueError manually if neither # thumbnail_url nor thumb_url are passed - thumbnail_url: str = None, - photo_width: int = None, - photo_height: int = None, - title: str = None, - description: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + thumbnail_url: Optional[str] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + title: Optional[str] = None, + description: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, # thumb_url is not optional in Telegram API, but it is here, along with thumbnail_url. - thumb_url: str = None, + thumb_url: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if not (thumbnail_url or thumb_url): raise ValueError( diff --git a/telegram/_inline/inlinequeryresultsbutton.py b/telegram/_inline/inlinequeryresultsbutton.py index 7d19b2ef95c..a200fb8389e 100644 --- a/telegram/_inline/inlinequeryresultsbutton.py +++ b/telegram/_inline/inlinequeryresultsbutton.py @@ -79,10 +79,10 @@ class InlineQueryResultsButton(TelegramObject): def __init__( self, text: str, - web_app: WebAppInfo = None, - start_parameter: str = None, + web_app: Optional[WebAppInfo] = None, + start_parameter: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultvenue.py b/telegram/_inline/inlinequeryresultvenue.py index fd0733a9bb1..df2179f6ef4 100644 --- a/telegram/_inline/inlinequeryresultvenue.py +++ b/telegram/_inline/inlinequeryresultvenue.py @@ -141,20 +141,20 @@ def __init__( longitude: float, title: str, address: str, - foursquare_id: str = None, - foursquare_type: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, - thumb_url: str = None, - thumb_width: int = None, - thumb_height: int = None, - google_place_id: str = None, - google_place_type: str = None, - thumbnail_url: str = None, - thumbnail_width: int = None, - thumbnail_height: int = None, + foursquare_id: Optional[str] = None, + foursquare_type: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, + thumb_url: Optional[str] = None, + thumb_width: Optional[int] = None, + thumb_height: Optional[int] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, + thumbnail_url: Optional[str] = None, + thumbnail_width: Optional[int] = None, + thumbnail_height: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.VENUE, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inlinequeryresultvideo.py b/telegram/_inline/inlinequeryresultvideo.py index cbfd31e45c5..f0e5339d22f 100644 --- a/telegram/_inline/inlinequeryresultvideo.py +++ b/telegram/_inline/inlinequeryresultvideo.py @@ -159,23 +159,23 @@ def __init__( # thumbnail_url and title are not optional in Telegram API, but we want to support # thumb_url as well, so thumbnail_url may not be passed if thumb_url is passed. # We will raise ValueError manually if neither thumbnail_url nor thumb_url are passed. - thumbnail_url: str = None, + thumbnail_url: Optional[str] = None, # title had to be made optional because of thumbnail_url. This is compensated by raising # TypeError manually if title is not passed. - title: str = None, - caption: str = None, - video_width: int = None, - video_height: int = None, - video_duration: int = None, - description: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + title: Optional[str] = None, + caption: Optional[str] = None, + video_width: Optional[int] = None, + video_height: Optional[int] = None, + video_duration: Optional[int] = None, + description: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, # thumb_url is not optional in Telegram API, but it is here, along with thumbnail_url. - thumb_url: str = None, + thumb_url: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): if not (thumbnail_url or thumb_url): raise ValueError( diff --git a/telegram/_inline/inlinequeryresultvoice.py b/telegram/_inline/inlinequeryresultvoice.py index deddccd6dd2..abc29914bbd 100644 --- a/telegram/_inline/inlinequeryresultvoice.py +++ b/telegram/_inline/inlinequeryresultvoice.py @@ -102,14 +102,14 @@ def __init__( id: str, # pylint: disable=redefined-builtin voice_url: str, title: str, - voice_duration: int = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, - input_message_content: "InputMessageContent" = None, + voice_duration: Optional[int] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + input_message_content: Optional["InputMessageContent"] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence[MessageEntity] = None, + caption_entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__(InlineQueryResultType.VOICE, id, api_kwargs=api_kwargs) diff --git a/telegram/_inline/inputcontactmessagecontent.py b/telegram/_inline/inputcontactmessagecontent.py index ef24f5a95e6..22ebb77f295 100644 --- a/telegram/_inline/inputcontactmessagecontent.py +++ b/telegram/_inline/inputcontactmessagecontent.py @@ -51,10 +51,10 @@ def __init__( self, phone_number: str, first_name: str, - last_name: str = None, - vcard: str = None, + last_name: Optional[str] = None, + vcard: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_inline/inputinvoicemessagecontent.py b/telegram/_inline/inputinvoicemessagecontent.py index aea0ea3c78f..2fa89fcc99c 100644 --- a/telegram/_inline/inputinvoicemessagecontent.py +++ b/telegram/_inline/inputinvoicemessagecontent.py @@ -193,22 +193,22 @@ def __init__( provider_token: str, currency: str, prices: Sequence[LabeledPrice], - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, - provider_data: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, - is_flexible: bool = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, + provider_data: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, + is_flexible: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_inline/inputlocationmessagecontent.py b/telegram/_inline/inputlocationmessagecontent.py index 1f852600edc..4f9fa227783 100644 --- a/telegram/_inline/inputlocationmessagecontent.py +++ b/telegram/_inline/inputlocationmessagecontent.py @@ -83,12 +83,12 @@ def __init__( self, latitude: float, longitude: float, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_inline/inputmessagecontent.py b/telegram/_inline/inputmessagecontent.py index 98568d81524..e4e26a39834 100644 --- a/telegram/_inline/inputmessagecontent.py +++ b/telegram/_inline/inputmessagecontent.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains the classes that represent Telegram InputMessageContent.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -34,7 +36,7 @@ class InputMessageContent(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: super().__init__(api_kwargs=api_kwargs) self._freeze() diff --git a/telegram/_inline/inputtextmessagecontent.py b/telegram/_inline/inputtextmessagecontent.py index 9724f6ef5a0..676d36af61a 100644 --- a/telegram/_inline/inputtextmessagecontent.py +++ b/telegram/_inline/inputtextmessagecontent.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains the classes that represent Telegram InputTextMessageContent.""" -from typing import Sequence, Tuple +from typing import Optional, Sequence, Tuple from telegram._inline.inputmessagecontent import InputMessageContent from telegram._messageentity import MessageEntity @@ -74,9 +74,9 @@ def __init__( message_text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence[MessageEntity] = None, + entities: Optional[Sequence[MessageEntity]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_inline/inputvenuemessagecontent.py b/telegram/_inline/inputvenuemessagecontent.py index 0e6b9335a06..5b2eab29afa 100644 --- a/telegram/_inline/inputvenuemessagecontent.py +++ b/telegram/_inline/inputvenuemessagecontent.py @@ -81,12 +81,12 @@ def __init__( longitude: float, title: str, address: str, - foursquare_id: str = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + foursquare_id: Optional[str] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_keyboardbutton.py b/telegram/_keyboardbutton.py index 143f46899cb..9f08d7f3c23 100644 --- a/telegram/_keyboardbutton.py +++ b/telegram/_keyboardbutton.py @@ -131,14 +131,14 @@ class KeyboardButton(TelegramObject): def __init__( self, text: str, - request_contact: bool = None, - request_location: bool = None, - request_poll: KeyboardButtonPollType = None, - web_app: WebAppInfo = None, - request_user: KeyboardButtonRequestUser = None, - request_chat: KeyboardButtonRequestChat = None, + request_contact: Optional[bool] = None, + request_location: Optional[bool] = None, + request_poll: Optional[KeyboardButtonPollType] = None, + web_app: Optional[WebAppInfo] = None, + request_user: Optional[KeyboardButtonRequestUser] = None, + request_chat: Optional[KeyboardButtonRequestChat] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_keyboardbuttonpolltype.py b/telegram/_keyboardbuttonpolltype.py index b54c215371d..911caaafa61 100644 --- a/telegram/_keyboardbuttonpolltype.py +++ b/telegram/_keyboardbuttonpolltype.py @@ -48,8 +48,11 @@ class KeyboardButtonPollType(TelegramObject): __slots__ = ("type",) def __init__( - self, type: str = None, *, api_kwargs: JSONDict = None # skipcq: PYL-W0622 - ): # pylint: disable=redefined-builtin + self, + type: Optional[str] = None, # pylint: disable=redefined-builtin + *, + api_kwargs: Optional[JSONDict] = None, # skipcq: PYL-W0622 + ): super().__init__(api_kwargs=api_kwargs) self.type: Optional[str] = type diff --git a/telegram/_keyboardbuttonrequest.py b/telegram/_keyboardbuttonrequest.py index 7df40b02fcb..f9a58500afd 100644 --- a/telegram/_keyboardbuttonrequest.py +++ b/telegram/_keyboardbuttonrequest.py @@ -66,10 +66,10 @@ class KeyboardButtonRequestUser(TelegramObject): def __init__( self, request_id: int, - user_is_bot: bool = None, - user_is_premium: bool = None, + user_is_bot: Optional[bool] = None, + user_is_premium: Optional[bool] = None, *, - api_kwargs: JSONDict = None, # skipcq: PYL-W0622 + api_kwargs: Optional[JSONDict] = None, # skipcq: PYL-W0622 ): super().__init__(api_kwargs=api_kwargs) # Required @@ -157,14 +157,14 @@ def __init__( self, request_id: int, chat_is_channel: bool, - chat_is_forum: bool = None, - chat_has_username: bool = None, - chat_is_created: bool = None, - user_administrator_rights: ChatAdministratorRights = None, - bot_administrator_rights: ChatAdministratorRights = None, - bot_is_member: bool = None, + chat_is_forum: Optional[bool] = None, + chat_has_username: Optional[bool] = None, + chat_is_created: Optional[bool] = None, + user_administrator_rights: Optional[ChatAdministratorRights] = None, + bot_administrator_rights: Optional[ChatAdministratorRights] = None, + bot_is_member: Optional[bool] = None, *, - api_kwargs: JSONDict = None, # skipcq: PYL-W0622 + api_kwargs: Optional[JSONDict] = None, # skipcq: PYL-W0622 ): super().__init__(api_kwargs=api_kwargs) # required diff --git a/telegram/_loginurl.py b/telegram/_loginurl.py index 2fe54d4cc60..a8a05a07ec6 100644 --- a/telegram/_loginurl.py +++ b/telegram/_loginurl.py @@ -86,11 +86,11 @@ class LoginUrl(TelegramObject): def __init__( self, url: str, - forward_text: bool = None, - bot_username: str = None, - request_write_access: bool = None, + forward_text: Optional[bool] = None, + bot_username: Optional[str] = None, + request_write_access: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_menubutton.py b/telegram/_menubutton.py index b0541410845..0ceae233969 100644 --- a/telegram/_menubutton.py +++ b/telegram/_menubutton.py @@ -55,7 +55,7 @@ class MenuButton(TelegramObject): __slots__ = ("type",) def __init__( - self, type: str, *, api_kwargs: JSONDict = None # skipcq: PYL-W0622 + self, type: str, *, api_kwargs: Optional[JSONDict] = None # skipcq: PYL-W0622 ): # pylint: disable=redefined-builtin super().__init__(api_kwargs=api_kwargs) self.type: str = type @@ -115,7 +115,7 @@ class MenuButtonCommands(MenuButton): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=constants.MenuButtonType.COMMANDS, api_kwargs=api_kwargs) self._freeze() @@ -148,7 +148,7 @@ class MenuButtonWebApp(MenuButton): __slots__ = ("text", "web_app") - def __init__(self, text: str, web_app: WebAppInfo, *, api_kwargs: JSONDict = None): + def __init__(self, text: str, web_app: WebAppInfo, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=constants.MenuButtonType.WEB_APP, api_kwargs=api_kwargs) with self._unfrozen(): self.text: str = text @@ -179,6 +179,6 @@ class MenuButtonDefault(MenuButton): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None): + def __init__(self, *, api_kwargs: Optional[JSONDict] = None): super().__init__(type=constants.MenuButtonType.DEFAULT, api_kwargs=api_kwargs) self._freeze() diff --git a/telegram/_message.py b/telegram/_message.py index 02b652d375e..e854142eb4c 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -670,76 +670,76 @@ def __init__( message_id: int, date: datetime.datetime, chat: Chat, - from_user: User = None, - forward_from: User = None, - forward_from_chat: Chat = None, - forward_from_message_id: int = None, - forward_date: datetime.datetime = None, - reply_to_message: "Message" = None, - edit_date: datetime.datetime = None, - text: str = None, - entities: Sequence["MessageEntity"] = None, - caption_entities: Sequence["MessageEntity"] = None, - audio: Audio = None, - document: Document = None, - game: Game = None, - photo: Sequence[PhotoSize] = None, - sticker: Sticker = None, - video: Video = None, - voice: Voice = None, - video_note: VideoNote = None, - new_chat_members: Sequence[User] = None, - caption: str = None, - contact: Contact = None, - location: Location = None, - venue: Venue = None, - left_chat_member: User = None, - new_chat_title: str = None, - new_chat_photo: Sequence[PhotoSize] = None, - delete_chat_photo: bool = None, - group_chat_created: bool = None, - supergroup_chat_created: bool = None, - channel_chat_created: bool = None, - migrate_to_chat_id: int = None, - migrate_from_chat_id: int = None, - pinned_message: "Message" = None, - invoice: Invoice = None, - successful_payment: SuccessfulPayment = None, - forward_signature: str = None, - author_signature: str = None, - media_group_id: str = None, - connected_website: str = None, - animation: Animation = None, - passport_data: PassportData = None, - poll: Poll = None, - forward_sender_name: str = None, - reply_markup: InlineKeyboardMarkup = None, - dice: Dice = None, - via_bot: User = None, - proximity_alert_triggered: ProximityAlertTriggered = None, - sender_chat: Chat = None, - video_chat_started: VideoChatStarted = None, - video_chat_ended: VideoChatEnded = None, - video_chat_participants_invited: VideoChatParticipantsInvited = None, - message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged = None, - video_chat_scheduled: VideoChatScheduled = None, - is_automatic_forward: bool = None, - has_protected_content: bool = None, - web_app_data: WebAppData = None, - is_topic_message: bool = None, - message_thread_id: int = None, - forum_topic_created: ForumTopicCreated = None, - forum_topic_closed: ForumTopicClosed = None, - forum_topic_reopened: ForumTopicReopened = None, - forum_topic_edited: ForumTopicEdited = None, - general_forum_topic_hidden: GeneralForumTopicHidden = None, - general_forum_topic_unhidden: GeneralForumTopicUnhidden = None, - write_access_allowed: WriteAccessAllowed = None, - has_media_spoiler: bool = None, - user_shared: UserShared = None, - chat_shared: ChatShared = None, + from_user: Optional[User] = None, + forward_from: Optional[User] = None, + forward_from_chat: Optional[Chat] = None, + forward_from_message_id: Optional[int] = None, + forward_date: Optional[datetime.datetime] = None, + reply_to_message: Optional["Message"] = None, + edit_date: Optional[datetime.datetime] = None, + text: Optional[str] = None, + entities: Optional[Sequence["MessageEntity"]] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, + audio: Optional[Audio] = None, + document: Optional[Document] = None, + game: Optional[Game] = None, + photo: Optional[Sequence[PhotoSize]] = None, + sticker: Optional[Sticker] = None, + video: Optional[Video] = None, + voice: Optional[Voice] = None, + video_note: Optional[VideoNote] = None, + new_chat_members: Optional[Sequence[User]] = None, + caption: Optional[str] = None, + contact: Optional[Contact] = None, + location: Optional[Location] = None, + venue: Optional[Venue] = None, + left_chat_member: Optional[User] = None, + new_chat_title: Optional[str] = None, + new_chat_photo: Optional[Sequence[PhotoSize]] = None, + delete_chat_photo: Optional[bool] = None, + group_chat_created: Optional[bool] = None, + supergroup_chat_created: Optional[bool] = None, + channel_chat_created: Optional[bool] = None, + migrate_to_chat_id: Optional[int] = None, + migrate_from_chat_id: Optional[int] = None, + pinned_message: Optional["Message"] = None, + invoice: Optional[Invoice] = None, + successful_payment: Optional[SuccessfulPayment] = None, + forward_signature: Optional[str] = None, + author_signature: Optional[str] = None, + media_group_id: Optional[str] = None, + connected_website: Optional[str] = None, + animation: Optional[Animation] = None, + passport_data: Optional[PassportData] = None, + poll: Optional[Poll] = None, + forward_sender_name: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + dice: Optional[Dice] = None, + via_bot: Optional[User] = None, + proximity_alert_triggered: Optional[ProximityAlertTriggered] = None, + sender_chat: Optional[Chat] = None, + video_chat_started: Optional[VideoChatStarted] = None, + video_chat_ended: Optional[VideoChatEnded] = None, + video_chat_participants_invited: Optional[VideoChatParticipantsInvited] = None, + message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = None, + video_chat_scheduled: Optional[VideoChatScheduled] = None, + is_automatic_forward: Optional[bool] = None, + has_protected_content: Optional[bool] = None, + web_app_data: Optional[WebAppData] = None, + is_topic_message: Optional[bool] = None, + message_thread_id: Optional[int] = None, + forum_topic_created: Optional[ForumTopicCreated] = None, + forum_topic_closed: Optional[ForumTopicClosed] = None, + forum_topic_reopened: Optional[ForumTopicReopened] = None, + forum_topic_edited: Optional[ForumTopicEdited] = None, + general_forum_topic_hidden: Optional[GeneralForumTopicHidden] = None, + general_forum_topic_unhidden: Optional[GeneralForumTopicUnhidden] = None, + write_access_allowed: Optional[WriteAccessAllowed] = None, + has_media_spoiler: Optional[bool] = None, + user_shared: Optional[UserShared] = None, + chat_shared: Optional[ChatShared] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) @@ -1041,19 +1041,19 @@ async def reply_text( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1095,19 +1095,19 @@ async def reply_markdown( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1159,19 +1159,19 @@ async def reply_markdown_v2( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1219,19 +1219,19 @@ async def reply_html( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1280,20 +1280,20 @@ async def reply_media_group( Union["InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo"] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, ) -> Tuple["Message", ...]: """Shortcut for:: @@ -1335,24 +1335,24 @@ async def reply_media_group( async def reply_photo( self, photo: Union[FileInput, "PhotoSize"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1394,28 +1394,28 @@ async def reply_photo( async def reply_audio( self, audio: Union[FileInput, "Audio"], - duration: int = None, - performer: str = None, - title: str = None, - caption: str = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1461,26 +1461,26 @@ async def reply_audio( async def reply_document( self, document: Union[FileInput, "Document"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - disable_content_type_detection: bool = None, + thumb: Optional[FileInput] = None, + disable_content_type_detection: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1524,29 +1524,29 @@ async def reply_document( async def reply_animation( self, animation: Union[FileInput, "Animation"], - duration: int = None, - width: int = None, - height: int = None, - thumb: FileInput = None, - caption: str = None, + duration: Optional[int] = None, + width: Optional[int] = None, + height: Optional[int] = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1595,19 +1595,19 @@ async def reply_sticker( self, sticker: Union[FileInput, "Sticker"], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - emoji: str = None, + message_thread_id: Optional[int] = None, + emoji: Optional[str] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1645,30 +1645,30 @@ async def reply_sticker( async def reply_video( self, video: Union[FileInput, "Video"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - width: int = None, - height: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + width: Optional[int] = None, + height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - supports_streaming: bool = None, - thumb: FileInput = None, + supports_streaming: Optional[bool] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1716,24 +1716,24 @@ async def reply_video( async def reply_video_note( self, video_note: Union[FileInput, "VideoNote"], - duration: int = None, - length: int = None, + duration: Optional[int] = None, + length: Optional[int] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - thumb: FileInput = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1776,24 +1776,24 @@ async def reply_video_note( async def reply_voice( self, voice: Union[FileInput, "Voice"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - filename: str = None, - quote: bool = None, + filename: Optional[str] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1835,26 +1835,26 @@ async def reply_voice( async def reply_location( self, - latitude: float = None, - longitude: float = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - location: Location = None, - quote: bool = None, + location: Optional[Location] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1896,28 +1896,28 @@ async def reply_location( async def reply_venue( self, - latitude: float = None, - longitude: float = None, - title: str = None, - address: str = None, - foursquare_id: str = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + title: Optional[str] = None, + address: Optional[str] = None, + foursquare_id: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - venue: Venue = None, - quote: bool = None, + venue: Optional[Venue] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1961,24 +1961,24 @@ async def reply_venue( async def reply_contact( self, - phone_number: str = None, - first_name: str = None, - last_name: str = None, + phone_number: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - vcard: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + vcard: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - contact: Contact = None, - quote: bool = None, + contact: Optional[Contact] = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2020,29 +2020,29 @@ async def reply_poll( self, question: str, options: Sequence[str], - is_anonymous: bool = None, - type: str = None, # pylint: disable=redefined-builtin - allows_multiple_answers: bool = None, - correct_option_id: int = None, - is_closed: bool = None, + is_anonymous: Optional[bool] = None, + type: Optional[str] = None, # pylint: disable=redefined-builtin + allows_multiple_answers: Optional[bool] = None, + correct_option_id: Optional[int] = None, + is_closed: Optional[bool] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - explanation: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + explanation: Optional[str] = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, - open_period: int = None, - close_date: Union[int, datetime.datetime] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[int, datetime.datetime]] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - explanation_entities: Sequence["MessageEntity"] = None, + explanation_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2090,19 +2090,19 @@ async def reply_poll( async def reply_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - emoji: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + emoji: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2139,13 +2139,13 @@ async def reply_dice( async def reply_chat_action( self, action: str, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2174,18 +2174,18 @@ async def reply_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2229,34 +2229,34 @@ async def reply_invoice( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - start_parameter: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - is_flexible: bool = None, + start_parameter: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + is_flexible: Optional[bool] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, - provider_data: Union[str, object] = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, + provider_data: Optional[Union[str, object]] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2327,13 +2327,13 @@ async def forward( chat_id: Union[int, str], disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -2375,21 +2375,21 @@ async def forward( async def copy( self, chat_id: Union[int, str], - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -2431,22 +2431,22 @@ async def reply_copy( self, from_chat_id: Union[str, int], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - quote: bool = None, + quote: Optional[bool] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -2496,14 +2496,14 @@ async def edit_text( text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, - reply_markup: InlineKeyboardMarkup = None, - entities: Sequence["MessageEntity"] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2541,16 +2541,16 @@ async def edit_text( async def edit_caption( self, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2589,13 +2589,13 @@ async def edit_caption( async def edit_media( self, media: "InputMedia", - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2637,7 +2637,7 @@ async def edit_reply_markup( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2671,19 +2671,19 @@ async def edit_reply_markup( async def edit_live_location( self, - latitude: float = None, - longitude: float = None, - reply_markup: InlineKeyboardMarkup = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2723,13 +2723,13 @@ async def edit_live_location( async def stop_live_location( self, - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2765,14 +2765,14 @@ async def set_game_score( self, user_id: Union[int, str], score: int, - force: bool = None, - disable_edit_message: bool = None, + force: Optional[bool] = None, + disable_edit_message: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2814,7 +2814,7 @@ async def get_game_high_scores( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple["GameHighScore", ...]: """Shortcut for:: @@ -2852,7 +2852,7 @@ async def delete( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2878,13 +2878,13 @@ async def delete( async def stop_poll( self, - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Poll: """Shortcut for:: @@ -2918,7 +2918,7 @@ async def pin( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2950,7 +2950,7 @@ async def unpin( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -2976,14 +2976,14 @@ async def unpin( async def edit_forum_topic( self, - name: str = None, - icon_custom_emoji_id: str = None, + name: Optional[str] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3019,7 +3019,7 @@ async def close_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3053,7 +3053,7 @@ async def reopen_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3087,7 +3087,7 @@ async def delete_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3121,7 +3121,7 @@ async def unpin_all_forum_topic_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -3200,7 +3200,7 @@ def parse_caption_entity(self, entity: MessageEntity) -> str: entity_text = entity_text[entity.offset * 2 : (entity.offset + entity.length) * 2] return entity_text.decode("utf-16-le") - def parse_entities(self, types: List[str] = None) -> Dict[MessageEntity, str]: + def parse_entities(self, types: Optional[List[str]] = None) -> Dict[MessageEntity, str]: """ Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`. It contains entities from this message filtered by their @@ -3230,7 +3230,9 @@ def parse_entities(self, types: List[str] = None) -> Dict[MessageEntity, str]: entity: self.parse_entity(entity) for entity in self.entities if entity.type in types } - def parse_caption_entities(self, types: List[str] = None) -> Dict[MessageEntity, str]: + def parse_caption_entities( + self, types: Optional[List[str]] = None + ) -> Dict[MessageEntity, str]: """ Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`. It contains entities from this message's caption filtered by their diff --git a/telegram/_messageautodeletetimerchanged.py b/telegram/_messageautodeletetimerchanged.py index ada02456353..9a96b93c868 100644 --- a/telegram/_messageautodeletetimerchanged.py +++ b/telegram/_messageautodeletetimerchanged.py @@ -20,6 +20,8 @@ deletion. """ +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -48,7 +50,7 @@ def __init__( self, message_auto_delete_time: int, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.message_auto_delete_time: int = message_auto_delete_time diff --git a/telegram/_messageentity.py b/telegram/_messageentity.py index 3edddf27b67..e95bf9d9656 100644 --- a/telegram/_messageentity.py +++ b/telegram/_messageentity.py @@ -96,12 +96,12 @@ def __init__( type: str, # pylint: disable=redefined-builtin offset: int, length: int, - url: str = None, - user: User = None, - language: str = None, - custom_emoji_id: str = None, + url: Optional[str] = None, + user: Optional[User] = None, + language: Optional[str] = None, + custom_emoji_id: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_messageid.py b/telegram/_messageid.py index 4ffa5d3cf48..2ad575f18cf 100644 --- a/telegram/_messageid.py +++ b/telegram/_messageid.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents an instance of a Telegram MessageId.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -37,7 +39,7 @@ class MessageId(TelegramObject): __slots__ = ("message_id",) - def __init__(self, message_id: int, *, api_kwargs: JSONDict = None): + def __init__(self, message_id: int, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.message_id: int = message_id diff --git a/telegram/_passport/credentials.py b/telegram/_passport/credentials.py index 5a53d4b6871..8fbe7589c0f 100644 --- a/telegram/_passport/credentials.py +++ b/telegram/_passport/credentials.py @@ -143,7 +143,7 @@ def __init__( hash: str, # skipcq: PYL-W0622 secret: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -222,7 +222,7 @@ def __init__( secure_data: "SecureData", nonce: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -310,19 +310,19 @@ class SecureData(TelegramObject): def __init__( self, - personal_details: "SecureValue" = None, - passport: "SecureValue" = None, - internal_passport: "SecureValue" = None, - driver_license: "SecureValue" = None, - identity_card: "SecureValue" = None, - address: "SecureValue" = None, - utility_bill: "SecureValue" = None, - bank_statement: "SecureValue" = None, - rental_agreement: "SecureValue" = None, - passport_registration: "SecureValue" = None, - temporary_registration: "SecureValue" = None, + personal_details: Optional["SecureValue"] = None, + passport: Optional["SecureValue"] = None, + internal_passport: Optional["SecureValue"] = None, + driver_license: Optional["SecureValue"] = None, + identity_card: Optional["SecureValue"] = None, + address: Optional["SecureValue"] = None, + utility_bill: Optional["SecureValue"] = None, + bank_statement: Optional["SecureValue"] = None, + rental_agreement: Optional["SecureValue"] = None, + passport_registration: Optional["SecureValue"] = None, + temporary_registration: Optional["SecureValue"] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) @@ -428,14 +428,14 @@ class SecureValue(TelegramObject): def __init__( self, - data: "DataCredentials" = None, - front_side: "FileCredentials" = None, - reverse_side: "FileCredentials" = None, - selfie: "FileCredentials" = None, - files: Sequence["FileCredentials"] = None, - translation: Sequence["FileCredentials"] = None, + data: Optional["DataCredentials"] = None, + front_side: Optional["FileCredentials"] = None, + reverse_side: Optional["FileCredentials"] = None, + selfie: Optional["FileCredentials"] = None, + files: Optional[Sequence["FileCredentials"]] = None, + translation: Optional[Sequence["FileCredentials"]] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.data: Optional[DataCredentials] = data @@ -471,7 +471,7 @@ class _CredentialsBase(TelegramObject): __slots__ = ("hash", "secret", "file_hash", "data_hash") def __init__( - self, hash: str, secret: str, *, api_kwargs: JSONDict = None # skipcq: PYL-W0622 + self, hash: str, secret: str, *, api_kwargs: Optional[JSONDict] = None # skipcq: PYL-W0622 ): super().__init__(api_kwargs=api_kwargs) with self._unfrozen(): @@ -499,7 +499,7 @@ class DataCredentials(_CredentialsBase): __slots__ = () - def __init__(self, data_hash: str, secret: str, *, api_kwargs: JSONDict = None): + def __init__(self, data_hash: str, secret: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(hash=data_hash, secret=secret, api_kwargs=api_kwargs) self._freeze() @@ -520,6 +520,6 @@ class FileCredentials(_CredentialsBase): __slots__ = () - def __init__(self, file_hash: str, secret: str, *, api_kwargs: JSONDict = None): + def __init__(self, file_hash: str, secret: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(hash=file_hash, secret=secret, api_kwargs=api_kwargs) self._freeze() diff --git a/telegram/_passport/data.py b/telegram/_passport/data.py index d58f9c05a95..8e3827059e8 100644 --- a/telegram/_passport/data.py +++ b/telegram/_passport/data.py @@ -81,12 +81,12 @@ def __init__( gender: str, country_code: str, residence_country_code: str, - first_name_native: str = None, - last_name_native: str = None, - middle_name: str = None, - middle_name_native: str = None, + first_name_native: Optional[str] = None, + last_name_native: Optional[str] = None, + middle_name: Optional[str] = None, + middle_name_native: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -143,7 +143,7 @@ def __init__( country_code: str, post_code: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -177,7 +177,7 @@ def __init__( document_no: str, expiry_date: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.document_no: str = document_no diff --git a/telegram/_passport/encryptedpassportelement.py b/telegram/_passport/encryptedpassportelement.py index d1dc7a92603..d680e3686da 100644 --- a/telegram/_passport/encryptedpassportelement.py +++ b/telegram/_passport/encryptedpassportelement.py @@ -151,17 +151,17 @@ def __init__( self, type: str, # pylint: disable=redefined-builtin hash: str, # pylint: disable=redefined-builtin - data: PersonalDetails = None, - phone_number: str = None, - email: str = None, - files: Sequence[PassportFile] = None, - front_side: PassportFile = None, - reverse_side: PassportFile = None, - selfie: PassportFile = None, - translation: Sequence[PassportFile] = None, - credentials: "Credentials" = None, # pylint: disable=unused-argument + data: Optional[PersonalDetails] = None, + phone_number: Optional[str] = None, + email: Optional[str] = None, + files: Optional[Sequence[PassportFile]] = None, + front_side: Optional[PassportFile] = None, + reverse_side: Optional[PassportFile] = None, + selfie: Optional[PassportFile] = None, + translation: Optional[Sequence[PassportFile]] = None, + credentials: Optional["Credentials"] = None, # pylint: disable=unused-argument *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_passport/passportdata.py b/telegram/_passport/passportdata.py index 92d395118dd..805203b058f 100644 --- a/telegram/_passport/passportdata.py +++ b/telegram/_passport/passportdata.py @@ -68,7 +68,7 @@ def __init__( data: Sequence[EncryptedPassportElement], credentials: EncryptedCredentials, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_passport/passportelementerrors.py b/telegram/_passport/passportelementerrors.py index c7b4de7dda1..96fd9322795 100644 --- a/telegram/_passport/passportelementerrors.py +++ b/telegram/_passport/passportelementerrors.py @@ -19,6 +19,8 @@ # pylint: disable=redefined-builtin """This module contains the classes that represent Telegram PassportElementError.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -46,7 +48,9 @@ class PassportElementError(TelegramObject): __slots__ = ("message", "source", "type") - def __init__(self, source: str, type: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, source: str, type: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): super().__init__(api_kwargs=api_kwargs) # Required self.source: str = str(source) @@ -94,7 +98,7 @@ def __init__( data_hash: str, message: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): # Required super().__init__("data", type, message, api_kwargs=api_kwargs) @@ -138,7 +142,9 @@ class PassportElementErrorFile(PassportElementError): __slots__ = ("file_hash",) - def __init__(self, type: str, file_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("file", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -174,7 +180,9 @@ class PassportElementErrorFiles(PassportElementError): __slots__ = ("file_hashes",) - def __init__(self, type: str, file_hashes: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hashes: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("files", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -210,7 +218,9 @@ class PassportElementErrorFrontSide(PassportElementError): __slots__ = ("file_hash",) - def __init__(self, type: str, file_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("front_side", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -246,7 +256,9 @@ class PassportElementErrorReverseSide(PassportElementError): __slots__ = ("file_hash",) - def __init__(self, type: str, file_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("reverse_side", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -280,7 +292,9 @@ class PassportElementErrorSelfie(PassportElementError): __slots__ = ("file_hash",) - def __init__(self, type: str, file_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("selfie", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -318,7 +332,9 @@ class PassportElementErrorTranslationFile(PassportElementError): __slots__ = ("file_hash",) - def __init__(self, type: str, file_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("translation_file", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -356,7 +372,9 @@ class PassportElementErrorTranslationFiles(PassportElementError): __slots__ = ("file_hashes",) - def __init__(self, type: str, file_hashes: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, file_hashes: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("translation_files", type, message, api_kwargs=api_kwargs) with self._unfrozen(): @@ -388,7 +406,9 @@ class PassportElementErrorUnspecified(PassportElementError): __slots__ = ("element_hash",) - def __init__(self, type: str, element_hash: str, message: str, *, api_kwargs: JSONDict = None): + def __init__( + self, type: str, element_hash: str, message: str, *, api_kwargs: Optional[JSONDict] = None + ): # Required super().__init__("unspecified", type, message, api_kwargs=api_kwargs) with self._unfrozen(): diff --git a/telegram/_passport/passportfile.py b/telegram/_passport/passportfile.py index e3d12ee81a9..5d12838e0f6 100644 --- a/telegram/_passport/passportfile.py +++ b/telegram/_passport/passportfile.py @@ -71,9 +71,9 @@ def __init__( file_unique_id: str, file_date: int, file_size: int, - credentials: "FileCredentials" = None, + credentials: Optional["FileCredentials"] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) @@ -155,7 +155,7 @@ async def get_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "File": """ Wrapper over :meth:`telegram.Bot.get_file`. Will automatically assign the correct diff --git a/telegram/_payment/invoice.py b/telegram/_payment/invoice.py index 031f20f26b3..1f72830c470 100644 --- a/telegram/_payment/invoice.py +++ b/telegram/_payment/invoice.py @@ -18,7 +18,7 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram Invoice.""" -from typing import ClassVar +from typing import ClassVar, Optional from telegram import constants from telegram._telegramobject import TelegramObject @@ -76,7 +76,7 @@ def __init__( currency: str, total_amount: int, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.title: str = title diff --git a/telegram/_payment/labeledprice.py b/telegram/_payment/labeledprice.py index ec205b4b6bb..6abfacbe612 100644 --- a/telegram/_payment/labeledprice.py +++ b/telegram/_payment/labeledprice.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram LabeledPrice.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -53,7 +55,7 @@ class LabeledPrice(TelegramObject): __slots__ = ("label", "amount") - def __init__(self, label: str, amount: int, *, api_kwargs: JSONDict = None): + def __init__(self, label: str, amount: int, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.label: str = label self.amount: int = amount diff --git a/telegram/_payment/orderinfo.py b/telegram/_payment/orderinfo.py index d6b8d2942bf..f7d7ac73402 100644 --- a/telegram/_payment/orderinfo.py +++ b/telegram/_payment/orderinfo.py @@ -53,12 +53,12 @@ class OrderInfo(TelegramObject): def __init__( self, - name: str = None, - phone_number: str = None, - email: str = None, - shipping_address: str = None, + name: Optional[str] = None, + phone_number: Optional[str] = None, + email: Optional[str] = None, + shipping_address: Optional[str] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.name: Optional[str] = name diff --git a/telegram/_payment/precheckoutquery.py b/telegram/_payment/precheckoutquery.py index 011038bf24e..a6b1528124a 100644 --- a/telegram/_payment/precheckoutquery.py +++ b/telegram/_payment/precheckoutquery.py @@ -89,10 +89,10 @@ def __init__( currency: str, total_amount: int, invoice_payload: str, - shipping_option_id: str = None, - order_info: OrderInfo = None, + shipping_option_id: Optional[str] = None, + order_info: Optional[OrderInfo] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.id: str = id # pylint: disable=invalid-name @@ -123,13 +123,13 @@ def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["PreCheckoutQ async def answer( # pylint: disable=invalid-name self, ok: bool, - error_message: str = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: diff --git a/telegram/_payment/shippingaddress.py b/telegram/_payment/shippingaddress.py index d56db45e62c..9c55e6dcba2 100644 --- a/telegram/_payment/shippingaddress.py +++ b/telegram/_payment/shippingaddress.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram ShippingAddress.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -65,7 +67,7 @@ def __init__( street_line2: str, post_code: str, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.country_code: str = country_code diff --git a/telegram/_payment/shippingoption.py b/telegram/_payment/shippingoption.py index 6b2af30dbea..4526f68c230 100644 --- a/telegram/_payment/shippingoption.py +++ b/telegram/_payment/shippingoption.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram ShippingOption.""" -from typing import TYPE_CHECKING, Sequence, Tuple +from typing import TYPE_CHECKING, Optional, Sequence, Tuple from telegram._telegramobject import TelegramObject from telegram._utils.argumentparsing import parse_sequence_arg @@ -62,7 +62,7 @@ def __init__( title: str, prices: Sequence["LabeledPrice"], *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) diff --git a/telegram/_payment/shippingquery.py b/telegram/_payment/shippingquery.py index fbc97029563..85e94170d9e 100644 --- a/telegram/_payment/shippingquery.py +++ b/telegram/_payment/shippingquery.py @@ -64,7 +64,7 @@ def __init__( invoice_payload: str, shipping_address: ShippingAddress, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.id: str = id # pylint: disable=invalid-name @@ -92,14 +92,14 @@ def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["ShippingQuer async def answer( # pylint: disable=invalid-name self, ok: bool, - shipping_options: Sequence[ShippingOption] = None, - error_message: str = None, + shipping_options: Optional[Sequence[ShippingOption]] = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: diff --git a/telegram/_payment/successfulpayment.py b/telegram/_payment/successfulpayment.py index 8d01f8ca24d..1fc863b3f56 100644 --- a/telegram/_payment/successfulpayment.py +++ b/telegram/_payment/successfulpayment.py @@ -84,10 +84,10 @@ def __init__( invoice_payload: str, telegram_payment_charge_id: str, provider_payment_charge_id: str, - shipping_option_id: str = None, - order_info: OrderInfo = None, + shipping_option_id: Optional[str] = None, + order_info: Optional[OrderInfo] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.currency: str = currency diff --git a/telegram/_poll.py b/telegram/_poll.py index 5b92bddcd15..1c8018a64f2 100644 --- a/telegram/_poll.py +++ b/telegram/_poll.py @@ -56,7 +56,7 @@ class PollOption(TelegramObject): __slots__ = ("voter_count", "text") - def __init__(self, text: str, voter_count: int, *, api_kwargs: JSONDict = None): + def __init__(self, text: str, voter_count: int, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) self.text: str = text self.voter_count: int = voter_count @@ -107,7 +107,12 @@ class PollAnswer(TelegramObject): __slots__ = ("option_ids", "user", "poll_id") def __init__( - self, poll_id: str, user: User, option_ids: Sequence[int], *, api_kwargs: JSONDict = None + self, + poll_id: str, + user: User, + option_ids: Sequence[int], + *, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.poll_id: str = poll_id @@ -240,13 +245,13 @@ def __init__( is_anonymous: bool, type: str, # pylint: disable=redefined-builtin allows_multiple_answers: bool, - correct_option_id: int = None, - explanation: str = None, - explanation_entities: Sequence[MessageEntity] = None, - open_period: int = None, - close_date: datetime.datetime = None, + correct_option_id: Optional[int] = None, + explanation: Optional[str] = None, + explanation_entities: Optional[Sequence[MessageEntity]] = None, + open_period: Optional[int] = None, + close_date: Optional[datetime.datetime] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.id: str = id # pylint: disable=invalid-name @@ -313,7 +318,9 @@ def parse_explanation_entity(self, entity: MessageEntity) -> str: return entity_text.decode("utf-16-le") - def parse_explanation_entities(self, types: List[str] = None) -> Dict[MessageEntity, str]: + def parse_explanation_entities( + self, types: Optional[List[str]] = None + ) -> Dict[MessageEntity, str]: """ Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`. It contains entities from this polls explanation filtered by their ``type`` attribute as diff --git a/telegram/_proximityalerttriggered.py b/telegram/_proximityalerttriggered.py index c297d22b892..c394131ed6c 100644 --- a/telegram/_proximityalerttriggered.py +++ b/telegram/_proximityalerttriggered.py @@ -50,7 +50,12 @@ class ProximityAlertTriggered(TelegramObject): __slots__ = ("traveler", "distance", "watcher") def __init__( - self, traveler: User, watcher: User, distance: int, *, api_kwargs: JSONDict = None + self, + traveler: User, + watcher: User, + distance: int, + *, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.traveler: User = traveler diff --git a/telegram/_replykeyboardmarkup.py b/telegram/_replykeyboardmarkup.py index 6d36d3215d0..685a73bf93d 100644 --- a/telegram/_replykeyboardmarkup.py +++ b/telegram/_replykeyboardmarkup.py @@ -131,13 +131,13 @@ class ReplyKeyboardMarkup(TelegramObject): def __init__( self, keyboard: Sequence[Sequence[Union[str, KeyboardButton]]], - resize_keyboard: bool = None, - one_time_keyboard: bool = None, - selective: bool = None, - input_field_placeholder: str = None, - is_persistent: bool = None, + resize_keyboard: Optional[bool] = None, + one_time_keyboard: Optional[bool] = None, + selective: Optional[bool] = None, + input_field_placeholder: Optional[str] = None, + is_persistent: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) if not check_keyboard_type(keyboard): @@ -170,8 +170,8 @@ def from_button( resize_keyboard: bool = False, one_time_keyboard: bool = False, selective: bool = False, - input_field_placeholder: str = None, - is_persistent: bool = None, + input_field_placeholder: Optional[str] = None, + is_persistent: Optional[bool] = None, **kwargs: object, ) -> "ReplyKeyboardMarkup": """Shortcut for:: @@ -228,8 +228,8 @@ def from_row( resize_keyboard: bool = False, one_time_keyboard: bool = False, selective: bool = False, - input_field_placeholder: str = None, - is_persistent: bool = None, + input_field_placeholder: Optional[str] = None, + is_persistent: Optional[bool] = None, **kwargs: object, ) -> "ReplyKeyboardMarkup": """Shortcut for:: @@ -290,8 +290,8 @@ def from_column( resize_keyboard: bool = False, one_time_keyboard: bool = False, selective: bool = False, - input_field_placeholder: str = None, - is_persistent: bool = None, + input_field_placeholder: Optional[str] = None, + is_persistent: Optional[bool] = None, **kwargs: object, ) -> "ReplyKeyboardMarkup": """Shortcut for:: diff --git a/telegram/_replykeyboardremove.py b/telegram/_replykeyboardremove.py index 1508ac39a3a..9832bcc93a8 100644 --- a/telegram/_replykeyboardremove.py +++ b/telegram/_replykeyboardremove.py @@ -62,7 +62,7 @@ class ReplyKeyboardRemove(TelegramObject): __slots__ = ("selective", "remove_keyboard") - def __init__(self, selective: bool = None, *, api_kwargs: JSONDict = None): + def __init__(self, selective: Optional[bool] = None, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) # Required self.remove_keyboard: bool = True diff --git a/telegram/_sentwebappmessage.py b/telegram/_sentwebappmessage.py index 409818bbca7..395d12cfe28 100644 --- a/telegram/_sentwebappmessage.py +++ b/telegram/_sentwebappmessage.py @@ -44,7 +44,9 @@ class SentWebAppMessage(TelegramObject): __slots__ = ("inline_message_id",) - def __init__(self, inline_message_id: str = None, *, api_kwargs: JSONDict = None): + def __init__( + self, inline_message_id: Optional[str] = None, *, api_kwargs: Optional[JSONDict] = None + ): super().__init__(api_kwargs=api_kwargs) # Optionals self.inline_message_id: Optional[str] = inline_message_id diff --git a/telegram/_shared.py b/telegram/_shared.py index d4b4697deaa..3cfc19ad93b 100644 --- a/telegram/_shared.py +++ b/telegram/_shared.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains two objects used for request chats/users service messages.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -53,7 +55,7 @@ def __init__( request_id: int, user_id: int, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.request_id: int = request_id @@ -96,7 +98,7 @@ def __init__( request_id: int, chat_id: int, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) self.request_id: int = request_id diff --git a/telegram/_switchinlinequerychosenchat.py b/telegram/_switchinlinequerychosenchat.py index ee32aec4dc5..8b0a3c9ad0f 100644 --- a/telegram/_switchinlinequerychosenchat.py +++ b/telegram/_switchinlinequerychosenchat.py @@ -73,13 +73,13 @@ class SwitchInlineQueryChosenChat(TelegramObject): def __init__( self, - query: str = None, - allow_user_chats: bool = None, - allow_bot_chats: bool = None, - allow_group_chats: bool = None, - allow_channel_chats: bool = None, + query: Optional[str] = None, + allow_user_chats: Optional[bool] = None, + allow_bot_chats: Optional[bool] = None, + allow_group_chats: Optional[bool] = None, + allow_channel_chats: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Optional diff --git a/telegram/_telegramobject.py b/telegram/_telegramobject.py index 9a2d5413529..96fd4f8e9b1 100644 --- a/telegram/_telegramobject.py +++ b/telegram/_telegramobject.py @@ -98,7 +98,7 @@ class TelegramObject: # unless it's overridden __INIT_PARAMS_CHECK: Optional[Type["TelegramObject"]] = None - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: # Setting _frozen to `False` here means that classes without arguments still need to # implement __init__. However, with `True` would mean increased usage of # `with self._unfrozen()` in the `__init__` of subclasses and we have fewer empty @@ -446,7 +446,10 @@ def de_json(cls: Type[Tele_co], data: Optional[JSONDict], bot: "Bot") -> Optiona @classmethod def _de_json( - cls: Type[Tele_co], data: Optional[JSONDict], bot: "Bot", api_kwargs: JSONDict = None + cls: Type[Tele_co], + data: Optional[JSONDict], + bot: "Bot", + api_kwargs: Optional[JSONDict] = None, ) -> Optional[Tele_co]: if data is None: return None diff --git a/telegram/_update.py b/telegram/_update.py index 771b68732a9..5d6ad07330e 100644 --- a/telegram/_update.py +++ b/telegram/_update.py @@ -235,22 +235,22 @@ class Update(TelegramObject): def __init__( self, update_id: int, - message: Message = None, - edited_message: Message = None, - channel_post: Message = None, - edited_channel_post: Message = None, - inline_query: InlineQuery = None, - chosen_inline_result: ChosenInlineResult = None, - callback_query: CallbackQuery = None, - shipping_query: ShippingQuery = None, - pre_checkout_query: PreCheckoutQuery = None, - poll: Poll = None, - poll_answer: PollAnswer = None, - my_chat_member: ChatMemberUpdated = None, - chat_member: ChatMemberUpdated = None, - chat_join_request: ChatJoinRequest = None, + message: Optional[Message] = None, + edited_message: Optional[Message] = None, + channel_post: Optional[Message] = None, + edited_channel_post: Optional[Message] = None, + inline_query: Optional[InlineQuery] = None, + chosen_inline_result: Optional[ChosenInlineResult] = None, + callback_query: Optional[CallbackQuery] = None, + shipping_query: Optional[ShippingQuery] = None, + pre_checkout_query: Optional[PreCheckoutQuery] = None, + poll: Optional[Poll] = None, + poll_answer: Optional[PollAnswer] = None, + my_chat_member: Optional[ChatMemberUpdated] = None, + chat_member: Optional[ChatMemberUpdated] = None, + chat_join_request: Optional[ChatJoinRequest] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_user.py b/telegram/_user.py index 42da2d0287d..abafce0c380 100644 --- a/telegram/_user.py +++ b/telegram/_user.py @@ -133,16 +133,16 @@ def __init__( id: int, first_name: str, is_bot: bool, - last_name: str = None, - username: str = None, - language_code: str = None, - can_join_groups: bool = None, - can_read_all_group_messages: bool = None, - supports_inline_queries: bool = None, - is_premium: bool = None, - added_to_attachment_menu: bool = None, + last_name: Optional[str] = None, + username: Optional[str] = None, + language_code: Optional[str] = None, + can_join_groups: Optional[bool] = None, + can_read_all_group_messages: Optional[bool] = None, + supports_inline_queries: Optional[bool] = None, + is_premium: Optional[bool] = None, + added_to_attachment_menu: Optional[bool] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required @@ -192,14 +192,14 @@ def link(self) -> Optional[str]: async def get_profile_photos( self, - offset: int = None, - limit: int = None, + offset: Optional[int] = None, + limit: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Optional["UserProfilePhotos"]: """Shortcut for:: @@ -220,7 +220,7 @@ async def get_profile_photos( api_kwargs=api_kwargs, ) - def mention_markdown(self, name: str = None) -> str: + def mention_markdown(self, name: Optional[str] = None) -> str: """ Note: :tg-const:`telegram.constants.ParseMode.MARKDOWN` is a legacy mode, retained by @@ -238,7 +238,7 @@ def mention_markdown(self, name: str = None) -> str: return helpers_mention_markdown(self.id, name) return helpers_mention_markdown(self.id, self.full_name) - def mention_markdown_v2(self, name: str = None) -> str: + def mention_markdown_v2(self, name: Optional[str] = None) -> str: """ Args: name (:obj:`str`): The name used as a link for the user. Defaults to :attr:`full_name`. @@ -251,7 +251,7 @@ def mention_markdown_v2(self, name: str = None) -> str: return helpers_mention_markdown(self.id, name, version=2) return helpers_mention_markdown(self.id, self.full_name, version=2) - def mention_html(self, name: str = None) -> str: + def mention_html(self, name: Optional[str] = None) -> str: """ Args: name (:obj:`str`): The name used as a link for the user. Defaults to :attr:`full_name`. @@ -264,7 +264,7 @@ def mention_html(self, name: str = None) -> str: return helpers_mention_html(self.id, name) return helpers_mention_html(self.id, self.full_name) - def mention_button(self, name: str = None) -> InlineKeyboardButton: + def mention_button(self, name: Optional[str] = None) -> InlineKeyboardButton: """Shortcut for:: InlineKeyboardButton(text=name, url=f"tg://user?id={update.effective_user.id}") @@ -288,7 +288,7 @@ async def pin_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -316,13 +316,13 @@ async def pin_message( async def unpin_message( self, - message_id: int = None, + message_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -354,7 +354,7 @@ async def unpin_all_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -385,18 +385,18 @@ async def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -433,23 +433,23 @@ async def send_message( async def send_photo( self, photo: Union[FileInput, "PhotoSize"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -491,19 +491,19 @@ async def send_media_group( Union["InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo"] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, ) -> Tuple["Message", ...]: """Shortcut for:: @@ -540,27 +540,27 @@ async def send_media_group( async def send_audio( self, audio: Union[FileInput, "Audio"], - duration: int = None, - performer: str = None, - title: str = None, - caption: str = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -603,13 +603,13 @@ async def send_audio( async def send_chat_action( self, action: str, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -640,23 +640,23 @@ async def send_chat_action( async def send_contact( self, - phone_number: str = None, - first_name: str = None, - last_name: str = None, + phone_number: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - vcard: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + vcard: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - contact: "Contact" = None, + contact: Optional["Contact"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -694,18 +694,18 @@ async def send_contact( async def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - emoji: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + emoji: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -739,25 +739,25 @@ async def send_dice( async def send_document( self, document: Union[FileInput, "Document"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - disable_content_type_detection: bool = None, + thumb: Optional[FileInput] = None, + disable_content_type_detection: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -799,17 +799,17 @@ async def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -848,33 +848,33 @@ async def send_invoice( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - start_parameter: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - is_flexible: bool = None, + start_parameter: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + is_flexible: Optional[bool] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: "InlineKeyboardMarkup" = None, - provider_data: Union[str, object] = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional["InlineKeyboardMarkup"] = None, + provider_data: Optional[Union[str, object]] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -937,25 +937,25 @@ async def send_invoice( async def send_location( self, - latitude: float = None, - longitude: float = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - location: "Location" = None, + location: Optional["Location"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -995,28 +995,28 @@ async def send_location( async def send_animation( self, animation: Union[FileInput, "Animation"], - duration: int = None, - width: int = None, - height: int = None, - thumb: FileInput = None, - caption: str = None, + duration: Optional[int] = None, + width: Optional[int] = None, + height: Optional[int] = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1061,18 +1061,18 @@ async def send_sticker( self, sticker: Union[FileInput, "Sticker"], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - emoji: str = None, + message_thread_id: Optional[int] = None, + emoji: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1107,29 +1107,29 @@ async def send_sticker( async def send_video( self, video: Union[FileInput, "Video"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - width: int = None, - height: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + width: Optional[int] = None, + height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - supports_streaming: bool = None, - thumb: FileInput = None, + supports_streaming: Optional[bool] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1173,27 +1173,27 @@ async def send_video( async def send_venue( self, - latitude: float = None, - longitude: float = None, - title: str = None, - address: str = None, - foursquare_id: str = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + title: Optional[str] = None, + address: Optional[str] = None, + foursquare_id: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - venue: "Venue" = None, + venue: Optional["Venue"] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1235,23 +1235,23 @@ async def send_venue( async def send_video_note( self, video_note: Union[FileInput, "VideoNote"], - duration: int = None, - length: int = None, + duration: Optional[int] = None, + length: Optional[int] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - thumb: FileInput = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1290,23 +1290,23 @@ async def send_video_note( async def send_voice( self, voice: Union[FileInput, "Voice"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1346,28 +1346,28 @@ async def send_poll( self, question: str, options: Sequence[str], - is_anonymous: bool = None, - type: str = None, - allows_multiple_answers: bool = None, - correct_option_id: int = None, - is_closed: bool = None, + is_anonymous: Optional[bool] = None, + type: Optional[str] = None, + allows_multiple_answers: Optional[bool] = None, + correct_option_id: Optional[int] = None, + is_closed: Optional[bool] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - explanation: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + explanation: Optional[str] = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, - open_period: int = None, - close_date: Union[int, datetime] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[int, datetime]] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - explanation_entities: Sequence["MessageEntity"] = None, + explanation_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "Message": """Shortcut for:: @@ -1413,21 +1413,21 @@ async def send_copy( self, from_chat_id: Union[str, int], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -1466,21 +1466,21 @@ async def copy_message( self, chat_id: Union[int, str], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> "MessageId": """Shortcut for:: @@ -1523,7 +1523,7 @@ async def approve_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1559,7 +1559,7 @@ async def decline_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1589,13 +1589,13 @@ async def decline_join_request( async def set_menu_button( self, - menu_button: MenuButton = None, + menu_button: Optional[MenuButton] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> bool: """Shortcut for:: @@ -1631,7 +1631,7 @@ async def get_menu_button( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> MenuButton: """Shortcut for:: diff --git a/telegram/_userprofilephotos.py b/telegram/_userprofilephotos.py index 6c1a519ec2e..60aa926053f 100644 --- a/telegram/_userprofilephotos.py +++ b/telegram/_userprofilephotos.py @@ -58,7 +58,7 @@ def __init__( total_count: int, photos: Sequence[Sequence[PhotoSize]], *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_utils/datetime.py b/telegram/_utils/datetime.py index c513f73c8c3..d8a6e3dda0a 100644 --- a/telegram/_utils/datetime.py +++ b/telegram/_utils/datetime.py @@ -54,8 +54,8 @@ def _localize(datetime: dtm.datetime, tzinfo: dtm.tzinfo) -> dtm.datetime: def to_float_timestamp( time_object: Union[int, float, dtm.timedelta, dtm.datetime, dtm.time], - reference_timestamp: float = None, - tzinfo: dtm.tzinfo = None, + reference_timestamp: Optional[float] = None, + tzinfo: Optional[dtm.tzinfo] = None, ) -> float: """ Converts a given time object to a float POSIX timestamp. @@ -149,8 +149,8 @@ def to_float_timestamp( def to_timestamp( dt_obj: Union[int, float, dtm.timedelta, dtm.datetime, dtm.time, None], - reference_timestamp: float = None, - tzinfo: dtm.tzinfo = None, + reference_timestamp: Optional[float] = None, + tzinfo: Optional[dtm.tzinfo] = None, ) -> Optional[int]: """ Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated diff --git a/telegram/_utils/files.py b/telegram/_utils/files.py index 0d93edfc10d..37bc0332e54 100644 --- a/telegram/_utils/files.py +++ b/telegram/_utils/files.py @@ -90,8 +90,8 @@ def is_local_file(obj: Optional[FilePathInput]) -> bool: def parse_file_input( # pylint: disable=too-many-return-statements file_input: Union[FileInput, "TelegramObject"], - tg_type: Type["TelegramObject"] = None, - filename: str = None, + tg_type: Optional[Type["TelegramObject"]] = None, + filename: Optional[str] = None, attach: bool = False, local_mode: bool = False, ) -> Union[str, "InputFile", Any]: diff --git a/telegram/_utils/logging.py b/telegram/_utils/logging.py index e6a79274400..da888cc83aa 100644 --- a/telegram/_utils/logging.py +++ b/telegram/_utils/logging.py @@ -24,9 +24,10 @@ the changelog. """ import logging +from typing import Optional -def get_logger(file_name: str, class_name: str = None) -> logging.Logger: +def get_logger(file_name: str, class_name: Optional[str] = None) -> logging.Logger: """Returns a logger with an appropriate name. Use as follows:: diff --git a/telegram/_videochat.py b/telegram/_videochat.py index 459427e8118..ae854ae9103 100644 --- a/telegram/_videochat.py +++ b/telegram/_videochat.py @@ -42,7 +42,7 @@ class VideoChatStarted(TelegramObject): __slots__ = () - def __init__(self, *, api_kwargs: JSONDict = None) -> None: + def __init__(self, *, api_kwargs: Optional[JSONDict] = None) -> None: super().__init__(api_kwargs=api_kwargs) self._freeze() @@ -75,7 +75,7 @@ def __init__( self, duration: int, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> None: super().__init__(api_kwargs=api_kwargs) self.duration: int = duration @@ -115,7 +115,7 @@ def __init__( self, users: Sequence[User], *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> None: super().__init__(api_kwargs=api_kwargs) self.users: Tuple[User, ...] = parse_sequence_arg(users) @@ -167,7 +167,7 @@ def __init__( self, start_date: dtm.datetime, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> None: super().__init__(api_kwargs=api_kwargs) self.start_date: dtm.datetime = start_date diff --git a/telegram/_webappdata.py b/telegram/_webappdata.py index c40e0ba3da9..2922d2e23b0 100644 --- a/telegram/_webappdata.py +++ b/telegram/_webappdata.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram WebAppData.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -51,7 +53,7 @@ class WebAppData(TelegramObject): __slots__ = ("data", "button_text") - def __init__(self, data: str, button_text: str, *, api_kwargs: JSONDict = None): + def __init__(self, data: str, button_text: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) # Required self.data: str = data diff --git a/telegram/_webappinfo.py b/telegram/_webappinfo.py index bef08a7487a..4c83af1c272 100644 --- a/telegram/_webappinfo.py +++ b/telegram/_webappinfo.py @@ -18,6 +18,8 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains an object that represents a Telegram Web App Info.""" +from typing import Optional + from telegram._telegramobject import TelegramObject from telegram._utils.types import JSONDict @@ -47,7 +49,7 @@ class WebAppInfo(TelegramObject): __slots__ = ("url",) - def __init__(self, url: str, *, api_kwargs: JSONDict = None): + def __init__(self, url: str, *, api_kwargs: Optional[JSONDict] = None): super().__init__(api_kwargs=api_kwargs) # Required self.url: str = url diff --git a/telegram/_webhookinfo.py b/telegram/_webhookinfo.py index 26703b37867..5e94b8c8e8c 100644 --- a/telegram/_webhookinfo.py +++ b/telegram/_webhookinfo.py @@ -123,14 +123,14 @@ def __init__( url: str, has_custom_certificate: bool, pending_update_count: int, - last_error_date: int = None, - last_error_message: str = None, - max_connections: int = None, - allowed_updates: Sequence[str] = None, - ip_address: str = None, - last_synchronization_error_date: int = None, + last_error_date: Optional[int] = None, + last_error_message: Optional[str] = None, + max_connections: Optional[int] = None, + allowed_updates: Optional[Sequence[str]] = None, + ip_address: Optional[str] = None, + last_synchronization_error_date: Optional[int] = None, *, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ): super().__init__(api_kwargs=api_kwargs) # Required diff --git a/telegram/_writeaccessallowed.py b/telegram/_writeaccessallowed.py index 209412eca23..698cbc9f042 100644 --- a/telegram/_writeaccessallowed.py +++ b/telegram/_writeaccessallowed.py @@ -44,7 +44,9 @@ class WriteAccessAllowed(TelegramObject): __slots__ = ("web_app_name",) - def __init__(self, web_app_name: str = None, *, api_kwargs: JSONDict = None): + def __init__( + self, web_app_name: Optional[str] = None, *, api_kwargs: Optional[JSONDict] = None + ): super().__init__(api_kwargs=api_kwargs) self.web_app_name: Optional[str] = web_app_name diff --git a/telegram/error.py b/telegram/error.py index 29714834be9..2334b005aa7 100644 --- a/telegram/error.py +++ b/telegram/error.py @@ -35,7 +35,7 @@ "TimedOut", ) -from typing import Tuple, Union +from typing import Optional, Tuple, Union def _lstrip_str(in_s: str, lstr: str) -> str: @@ -111,7 +111,7 @@ class InvalidToken(TelegramError): __slots__ = () - def __init__(self, message: str = None) -> None: + def __init__(self, message: Optional[str] = None) -> None: super().__init__("Invalid token" if message is None else message) @@ -142,7 +142,7 @@ class TimedOut(NetworkError): __slots__ = () - def __init__(self, message: str = None) -> None: + def __init__(self, message: Optional[str] = None) -> None: super().__init__(message or "Timed out") diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index 09c89222ff7..af292167251 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -106,7 +106,7 @@ async def conversation_callback(update, context): __slots__ = ("state",) - def __init__(self, state: object = None) -> None: + def __init__(self, state: Optional[object] = None) -> None: super().__init__() self.state: Optional[object] = state @@ -637,8 +637,8 @@ def run_polling( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - allowed_updates: List[str] = None, - drop_pending_updates: bool = None, + allowed_updates: Optional[List[str]] = None, + drop_pending_updates: Optional[bool] = None, close_loop: bool = True, stop_signals: ODVInput[Sequence[int]] = DEFAULT_NONE, ) -> None: @@ -746,17 +746,17 @@ def run_webhook( listen: str = "127.0.0.1", port: int = 80, url_path: str = "", - cert: Union[str, Path] = None, - key: Union[str, Path] = None, + cert: Optional[Union[str, Path]] = None, + key: Optional[Union[str, Path]] = None, bootstrap_retries: int = 0, - webhook_url: str = None, - allowed_updates: List[str] = None, - drop_pending_updates: bool = None, - ip_address: str = None, + webhook_url: Optional[str] = None, + allowed_updates: Optional[List[str]] = None, + drop_pending_updates: Optional[bool] = None, + ip_address: Optional[str] = None, max_connections: int = 40, close_loop: bool = True, stop_signals: ODVInput[Sequence[int]] = DEFAULT_NONE, - secret_token: str = None, + secret_token: Optional[str] = None, ) -> None: """Convenience method that takes care of initializing and starting the app, listening for updates from Telegram using :meth:`telegram.ext.Updater.start_webhook` and @@ -939,7 +939,7 @@ def __run( def create_task( self, coroutine: Union[Generator[Optional["asyncio.Future[object]"], None, RT], Awaitable[RT]], - update: object = None, + update: Optional[object] = None, ) -> "asyncio.Task[RT]": """Thin wrapper around :func:`asyncio.create_task` that handles exceptions raised by the :paramref:`coroutine` with :meth:`process_error`. @@ -970,7 +970,7 @@ def create_task( def __create_task( self, coroutine: Union[Generator[Optional["asyncio.Future[object]"], None, RT], Awaitable[RT]], - update: object = None, + update: Optional[object] = None, is_error_handler: bool = False, ) -> "asyncio.Task[RT]": # Unfortunately, we can't know if `coroutine` runs one of the error handler functions @@ -1005,7 +1005,7 @@ def __create_task_done_callback(self, task: asyncio.Task) -> None: async def __create_task_callback( self, coroutine: Union[Generator[Optional["asyncio.Future[object]"], None, RT], Awaitable[RT]], - update: object = None, + update: Optional[object] = None, is_error_handler: bool = False, ) -> RT: try: @@ -1306,7 +1306,10 @@ def drop_user_data(self, user_id: int) -> None: self._user_ids_to_be_deleted_in_persistence.add(user_id) def migrate_chat_data( - self, message: "Message" = None, old_chat_id: int = None, new_chat_id: int = None + self, + message: Optional["Message"] = None, + old_chat_id: Optional[int] = None, + new_chat_id: Optional[int] = None, ) -> None: """Moves the contents of :attr:`chat_data` at key :paramref:`old_chat_id` to the key :paramref:`new_chat_id`. Also marks the entries to be updated accordingly in the next run @@ -1369,7 +1372,9 @@ def migrate_chat_data( self._chat_ids_to_be_updated_in_persistence.add(new_chat_id) # old_chat_id is marked for deletion by drop_chat_data above - def _mark_for_persistence_update(self, *, update: object = None, job: "Job" = None) -> None: + def _mark_for_persistence_update( + self, *, update: Optional[object] = None, job: Optional["Job"] = None + ) -> None: if isinstance(update, Update): if update.effective_chat: self._chat_ids_to_be_updated_in_persistence.add(update.effective_chat.id) @@ -1383,7 +1388,7 @@ def _mark_for_persistence_update(self, *, update: object = None, job: "Job" = No self._user_ids_to_be_updated_in_persistence.add(job.user_id) def mark_data_for_update_persistence( - self, chat_ids: SCT[int] = None, user_ids: SCT[int] = None + self, chat_ids: Optional[SCT[int]] = None, user_ids: Optional[SCT[int]] = None ) -> None: """Mark entries of :attr:`chat_data` and :attr:`user_data` to be updated on the next run of :meth:`update_persistence`. @@ -1613,9 +1618,9 @@ async def process_error( self, update: Optional[object], error: Exception, - job: "Job[CCT]" = None, - coroutine: Union[ - Generator[Optional["asyncio.Future[object]"], None, RT], Awaitable[RT] + job: Optional["Job[CCT]"] = None, + coroutine: Optional[ + Union[Generator[Optional["asyncio.Future[object]"], None, RT], Awaitable[RT]] ] = None, ) -> bool: """Processes an error by passing it to all error handlers registered with diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index f4688a09f53..8188105b7f1 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -329,7 +329,7 @@ def build( def application_class( self: BuilderType, application_class: Type[Application[Any, Any, Any, Any, Any, Any]], - kwargs: Dict[str, object] = None, + kwargs: Optional[Dict[str, object]] = None, ) -> BuilderType: """Sets a custom subclass instead of :class:`telegram.ext.Application`. The subclass's ``__init__`` should look like this @@ -759,7 +759,7 @@ def get_updates_http_version(self: BuilderType, get_updates_http_version: str) - def private_key( self: BuilderType, private_key: Union[bytes, FilePathInput], - password: Union[bytes, FilePathInput] = None, + password: Optional[Union[bytes, FilePathInput]] = None, ) -> BuilderType: """Sets the private key and corresponding password for decryption of telegram passport data for :attr:`telegram.ext.Application.bot`. diff --git a/telegram/ext/_basepersistence.py b/telegram/ext/_basepersistence.py index dd96478a841..85fb18f9dc3 100644 --- a/telegram/ext/_basepersistence.py +++ b/telegram/ext/_basepersistence.py @@ -145,7 +145,7 @@ class BasePersistence(Generic[UD, CD, BD], ABC): def __init__( self, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, update_interval: float = 60, ): self.store_data: PersistenceInput = store_data or PersistenceInput() diff --git a/telegram/ext/_callbackcontext.py b/telegram/ext/_callbackcontext.py index 52894d551c1..1fde626d6b9 100644 --- a/telegram/ext/_callbackcontext.py +++ b/telegram/ext/_callbackcontext.py @@ -135,8 +135,8 @@ class CallbackContext(Generic[BT, UD, CD, BD]): def __init__( self: "CCT", application: "Application[BT, CCT, UD, CD, BD, Any]", - chat_id: int = None, - user_id: int = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, ): self._application: Application[BT, CCT, UD, CD, BD, Any] = application self._chat_id: Optional[int] = chat_id @@ -278,8 +278,10 @@ def from_error( update: object, error: Exception, application: "Application[BT, CCT, UD, CD, BD, Any]", - job: "Job[Any]" = None, - coroutine: Union[Generator[Optional["Future[object]"], None, Any], Awaitable[Any]] = None, + job: Optional["Job[Any]"] = None, + coroutine: Optional[ + Union[Generator[Optional["Future[object]"], None, Any], Awaitable[Any]] + ] = None, ) -> "CCT": """ Constructs an instance of :class:`telegram.ext.CallbackContext` to be passed to the error diff --git a/telegram/ext/_callbackdatacache.py b/telegram/ext/_callbackdatacache.py index 5089048f8e4..42d32da24b3 100644 --- a/telegram/ext/_callbackdatacache.py +++ b/telegram/ext/_callbackdatacache.py @@ -61,7 +61,7 @@ class InvalidCallbackData(TelegramError): __slots__ = ("callback_data",) - def __init__(self, callback_data: str = None) -> None: + def __init__(self, callback_data: Optional[str] = None) -> None: super().__init__( "The object belonging to this callback_data was deleted or the callback_data was " "manipulated." @@ -76,7 +76,10 @@ class _KeyboardData: __slots__ = ("keyboard_uuid", "button_data", "access_time") def __init__( - self, keyboard_uuid: str, access_time: float = None, button_data: Dict[str, object] = None + self, + keyboard_uuid: str, + access_time: Optional[float] = None, + button_data: Optional[Dict[str, object]] = None, ): self.keyboard_uuid = keyboard_uuid self.button_data = button_data or {} @@ -145,7 +148,7 @@ def __init__( self, bot: "ExtBot[Any]", maxsize: int = 1024, - persistent_data: CDCData = None, + persistent_data: Optional[CDCData] = None, ): if not CACHE_TOOLS_AVAILABLE: raise RuntimeError( @@ -419,7 +422,7 @@ def __drop_keyboard(self, keyboard_uuid: str) -> None: except KeyError: return - def clear_callback_data(self, time_cutoff: Union[float, datetime] = None) -> None: + def clear_callback_data(self, time_cutoff: Optional[Union[float, datetime]] = None) -> None: """Clears the stored callback data. Args: @@ -436,7 +439,9 @@ def clear_callback_queries(self) -> None: """Clears the stored callback query IDs.""" self.__clear(self._callback_queries) - def __clear(self, mapping: MutableMapping, time_cutoff: Union[float, datetime] = None) -> None: + def __clear( + self, mapping: MutableMapping, time_cutoff: Optional[Union[float, datetime]] = None + ) -> None: if not time_cutoff: mapping.clear() return diff --git a/telegram/ext/_callbackqueryhandler.py b/telegram/ext/_callbackqueryhandler.py index 93fb18601f0..9e19f88960d 100644 --- a/telegram/ext/_callbackqueryhandler.py +++ b/telegram/ext/_callbackqueryhandler.py @@ -109,7 +109,9 @@ async def callback(update: Update, context: CallbackContext) def __init__( self, callback: HandlerCallback[Update, CCT, RT], - pattern: Union[str, Pattern[str], type, Callable[[object], Optional[bool]]] = None, + pattern: Optional[ + Union[str, Pattern[str], type, Callable[[object], Optional[bool]]] + ] = None, block: DVType[bool] = DEFAULT_TRUE, ): super().__init__(callback, block=block) diff --git a/telegram/ext/_chatjoinrequesthandler.py b/telegram/ext/_chatjoinrequesthandler.py index 2204136af1c..d9875813185 100644 --- a/telegram/ext/_chatjoinrequesthandler.py +++ b/telegram/ext/_chatjoinrequesthandler.py @@ -82,8 +82,8 @@ async def callback(update: Update, context: CallbackContext) def __init__( self, callback: HandlerCallback[Update, CCT, RT], - chat_id: SCT[int] = None, - username: SCT[str] = None, + chat_id: Optional[SCT[int]] = None, + username: Optional[SCT[str]] = None, block: DVType[bool] = DEFAULT_TRUE, ): super().__init__(callback, block=block) diff --git a/telegram/ext/_choseninlineresulthandler.py b/telegram/ext/_choseninlineresulthandler.py index 80669590f08..4836905a860 100644 --- a/telegram/ext/_choseninlineresulthandler.py +++ b/telegram/ext/_choseninlineresulthandler.py @@ -79,7 +79,7 @@ def __init__( self, callback: HandlerCallback[Update, CCT, RT], block: DVType[bool] = DEFAULT_TRUE, - pattern: Union[str, Pattern[str]] = None, + pattern: Optional[Union[str, Pattern[str]]] = None, ): super().__init__(callback, block=block) diff --git a/telegram/ext/_commandhandler.py b/telegram/ext/_commandhandler.py index a6e5f38986f..c68035208f2 100644 --- a/telegram/ext/_commandhandler.py +++ b/telegram/ext/_commandhandler.py @@ -108,7 +108,7 @@ def __init__( self, command: SCT[str], callback: HandlerCallback[Update, CCT, RT], - filters: filters_module.BaseFilter = None, + filters: Optional[filters_module.BaseFilter] = None, block: DVType[bool] = DEFAULT_TRUE, ): super().__init__(callback, block=block) diff --git a/telegram/ext/_conversationhandler.py b/telegram/ext/_conversationhandler.py index 5d7281d0cb2..a7ee91436a8 100644 --- a/telegram/ext/_conversationhandler.py +++ b/telegram/ext/_conversationhandler.py @@ -303,10 +303,10 @@ def __init__( per_chat: bool = True, per_user: bool = True, per_message: bool = False, - conversation_timeout: Union[float, datetime.timedelta] = None, - name: str = None, + conversation_timeout: Optional[Union[float, datetime.timedelta]] = None, + name: Optional[str] = None, persistent: bool = False, - map_to_parent: Dict[object, object] = None, + map_to_parent: Optional[Dict[object, object]] = None, block: DVType[bool] = DEFAULT_TRUE, ): # these imports need to be here because of circular import error otherwise @@ -877,7 +877,7 @@ async def handle_update( # type: ignore[override] return None def _update_state( - self, new_state: object, key: ConversationKey, handler: BaseHandler = None + self, new_state: object, key: ConversationKey, handler: Optional[BaseHandler] = None ) -> None: if new_state == self.END: if key in self._conversations: diff --git a/telegram/ext/_defaults.py b/telegram/ext/_defaults.py index 69510138122..7117fd1851b 100644 --- a/telegram/ext/_defaults.py +++ b/telegram/ext/_defaults.py @@ -71,14 +71,14 @@ class Defaults: def __init__( self, - parse_mode: str = None, - disable_notification: bool = None, - disable_web_page_preview: bool = None, - quote: bool = None, + parse_mode: Optional[str] = None, + disable_notification: Optional[bool] = None, + disable_web_page_preview: Optional[bool] = None, + quote: Optional[bool] = None, tzinfo: datetime.tzinfo = UTC, block: bool = True, - allow_sending_without_reply: bool = None, - protect_content: bool = None, + allow_sending_without_reply: Optional[bool] = None, + protect_content: Optional[bool] = None, ): self._parse_mode: Optional[str] = parse_mode self._disable_notification: Optional[bool] = disable_notification diff --git a/telegram/ext/_dictpersistence.py b/telegram/ext/_dictpersistence.py index a328c621280..d6f35f554a0 100644 --- a/telegram/ext/_dictpersistence.py +++ b/telegram/ext/_dictpersistence.py @@ -90,7 +90,7 @@ class DictPersistence(BasePersistence[Dict[Any, Any], Dict[Any, Any], Dict[Any, def __init__( self, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, user_data_json: str = "", chat_data_json: str = "", bot_data_json: str = "", diff --git a/telegram/ext/_extbot.py b/telegram/ext/_extbot.py index eea4ad963ae..704957fcdbd 100644 --- a/telegram/ext/_extbot.py +++ b/telegram/ext/_extbot.py @@ -169,11 +169,11 @@ def __init__( token: str, base_url: str = "https://api.telegram.org/bot", base_file_url: str = "https://api.telegram.org/file/bot", - request: BaseRequest = None, - get_updates_request: BaseRequest = None, - private_key: bytes = None, - private_key_password: bytes = None, - defaults: "Defaults" = None, + request: Optional[BaseRequest] = None, + get_updates_request: Optional[BaseRequest] = None, + private_key: Optional[bytes] = None, + private_key_password: Optional[bytes] = None, + defaults: Optional["Defaults"] = None, arbitrary_callback_data: Union[bool, int] = False, local_mode: bool = False, ): @@ -185,14 +185,14 @@ def __init__( token: str, base_url: str = "https://api.telegram.org/bot", base_file_url: str = "https://api.telegram.org/file/bot", - request: BaseRequest = None, - get_updates_request: BaseRequest = None, - private_key: bytes = None, - private_key_password: bytes = None, - defaults: "Defaults" = None, + request: Optional[BaseRequest] = None, + get_updates_request: Optional[BaseRequest] = None, + private_key: Optional[bytes] = None, + private_key_password: Optional[bytes] = None, + defaults: Optional["Defaults"] = None, arbitrary_callback_data: Union[bool, int] = False, local_mode: bool = False, - rate_limiter: "BaseRateLimiter[RLARGS]" = None, + rate_limiter: Optional["BaseRateLimiter[RLARGS]"] = None, ): ... @@ -201,14 +201,14 @@ def __init__( token: str, base_url: str = "https://api.telegram.org/bot", base_file_url: str = "https://api.telegram.org/file/bot", - request: BaseRequest = None, - get_updates_request: BaseRequest = None, - private_key: bytes = None, - private_key_password: bytes = None, - defaults: "Defaults" = None, + request: Optional[BaseRequest] = None, + get_updates_request: Optional[BaseRequest] = None, + private_key: Optional[bytes] = None, + private_key_password: Optional[bytes] = None, + defaults: Optional["Defaults"] = None, arbitrary_callback_data: Union[bool, int] = False, local_mode: bool = False, - rate_limiter: "BaseRateLimiter[RLARGS]" = None, + rate_limiter: Optional["BaseRateLimiter[RLARGS]"] = None, ): super().__init__( token=token, @@ -485,22 +485,22 @@ async def _send_message( self, endpoint: str, data: JSONDict, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - caption: str = None, + message_thread_id: Optional[int] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Any: # We override this method to call self._replace_keyboard and self._insert_callback_data. # This covers most methods that have a reply_markup @@ -529,16 +529,16 @@ async def _send_message( async def get_updates( self, - offset: int = None, - limit: int = None, - timeout: float = None, - allowed_updates: Sequence[str] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + timeout: Optional[float] = None, + allowed_updates: Optional[Sequence[str]] = None, *, read_timeout: float = 2, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, + api_kwargs: Optional[JSONDict] = None, ) -> Tuple[Update, ...]: updates = await super().get_updates( offset=offset, @@ -562,8 +562,8 @@ def _effective_inline_results( results: Union[ Sequence["InlineQueryResult"], Callable[[int], Optional[Sequence["InlineQueryResult"]]] ], - next_offset: str = None, - current_offset: str = None, + next_offset: Optional[str] = None, + current_offset: Optional[str] = None, ) -> Tuple[Sequence["InlineQueryResult"], Optional[str]]: """This method is called by Bot.answer_inline_query to build the actual results list. Overriding this to call self._replace_keyboard suffices @@ -635,14 +635,14 @@ async def stop_poll( self, chat_id: Union[int, str], message_id: int, - reply_markup: InlineKeyboardMarkup = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Poll: # We override this method to call self._replace_keyboard return await super().stop_poll( @@ -661,22 +661,22 @@ async def copy_message( chat_id: Union[int, str], from_chat_id: Union[str, int], message_id: int, - caption: str = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, + reply_markup: Optional[ReplyMarkup] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> MessageId: # We override this method to call self._replace_keyboard return await super().copy_message( @@ -707,8 +707,8 @@ async def get_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Chat: # We override this method to call self._insert_callback_data result = await super().get_chat( @@ -725,19 +725,21 @@ async def add_sticker_to_set( self, user_id: Union[str, int], name: str, - emojis: str = None, # Was made optional for compatibility reasons - png_sticker: FileInput = None, - mask_position: MaskPosition = None, - tgs_sticker: FileInput = None, - webm_sticker: FileInput = None, - sticker: InputSticker = None, # Actually a required param, but is optional for compat. + emojis: Optional[str] = None, # Was made optional for compatibility reasons + png_sticker: Optional[FileInput] = None, + mask_position: Optional[MaskPosition] = None, + tgs_sticker: Optional[FileInput] = None, + webm_sticker: Optional[FileInput] = None, + sticker: Optional[ + InputSticker + ] = None, # Actually a required param, but is optional for compat. *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().add_sticker_to_set( user_id=user_id, @@ -758,17 +760,17 @@ async def add_sticker_to_set( async def answer_callback_query( self, callback_query_id: str, - text: str = None, - show_alert: bool = None, - url: str = None, - cache_time: int = None, + text: Optional[str] = None, + show_alert: Optional[bool] = None, + url: Optional[str] = None, + cache_time: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().answer_callback_query( callback_query_id=callback_query_id, @@ -789,20 +791,20 @@ async def answer_inline_query( results: Union[ Sequence["InlineQueryResult"], Callable[[int], Optional[Sequence["InlineQueryResult"]]] ], - cache_time: int = None, - is_personal: bool = None, - next_offset: str = None, - switch_pm_text: str = None, - switch_pm_parameter: str = None, - button: InlineQueryResultsButton = None, + cache_time: Optional[int] = None, + is_personal: Optional[bool] = None, + next_offset: Optional[str] = None, + switch_pm_text: Optional[str] = None, + switch_pm_parameter: Optional[str] = None, + button: Optional[InlineQueryResultsButton] = None, *, - current_offset: str = None, + current_offset: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().answer_inline_query( inline_query_id=inline_query_id, @@ -825,14 +827,14 @@ async def answer_pre_checkout_query( self, pre_checkout_query_id: str, ok: bool, - error_message: str = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().answer_pre_checkout_query( pre_checkout_query_id=pre_checkout_query_id, @@ -849,15 +851,15 @@ async def answer_shipping_query( self, shipping_query_id: str, ok: bool, - shipping_options: Sequence[ShippingOption] = None, - error_message: str = None, + shipping_options: Optional[Sequence[ShippingOption]] = None, + error_message: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().answer_shipping_query( shipping_query_id=shipping_query_id, @@ -880,8 +882,8 @@ async def answer_web_app_query( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> SentWebAppMessage: return await super().answer_web_app_query( web_app_query_id=web_app_query_id, @@ -902,8 +904,8 @@ async def approve_chat_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().approve_chat_join_request( chat_id=chat_id, @@ -919,15 +921,15 @@ async def ban_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - until_date: Union[int, datetime] = None, - revoke_messages: bool = None, + until_date: Optional[Union[int, datetime]] = None, + revoke_messages: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().ban_chat_member( chat_id=chat_id, @@ -950,8 +952,8 @@ async def ban_chat_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().ban_chat_sender_chat( chat_id=chat_id, @@ -966,17 +968,17 @@ async def ban_chat_sender_chat( async def create_chat_invite_link( self, chat_id: Union[str, int], - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ChatInviteLink: return await super().create_chat_invite_link( chat_id=chat_id, @@ -999,27 +1001,27 @@ async def create_invoice_link( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, - provider_data: Union[str, object] = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, - is_flexible: bool = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, + provider_data: Optional[Union[str, object]] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, + is_flexible: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> str: return await super().create_invoice_link( title=title, @@ -1054,22 +1056,24 @@ async def create_new_sticker_set( user_id: Union[str, int], name: str, title: str, - emojis: str = None, # Was made optional for compatibility purposes - png_sticker: FileInput = None, - mask_position: MaskPosition = None, - tgs_sticker: FileInput = None, - webm_sticker: FileInput = None, - sticker_type: str = None, - stickers: Sequence[InputSticker] = None, # Actually a required param. Optional for compat. - sticker_format: str = None, # Actually a required param. Optional for compat. - needs_repainting: bool = None, + emojis: Optional[str] = None, # Was made optional for compatibility purposes + png_sticker: Optional[FileInput] = None, + mask_position: Optional[MaskPosition] = None, + tgs_sticker: Optional[FileInput] = None, + webm_sticker: Optional[FileInput] = None, + sticker_type: Optional[str] = None, + stickers: Optional[ + Sequence[InputSticker] + ] = None, # Actually a required param. Optional for compat. + sticker_format: Optional[str] = None, # Actually a required param. Optional for compat. + needs_repainting: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().create_new_sticker_set( user_id=user_id, @@ -1100,8 +1104,8 @@ async def decline_chat_join_request( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().decline_chat_join_request( chat_id=chat_id, @@ -1121,8 +1125,8 @@ async def delete_chat_photo( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_chat_photo( chat_id=chat_id, @@ -1141,8 +1145,8 @@ async def delete_chat_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_chat_sticker_set( chat_id=chat_id, @@ -1162,8 +1166,8 @@ async def delete_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_forum_topic( chat_id=chat_id, @@ -1184,8 +1188,8 @@ async def delete_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_message( chat_id=chat_id, @@ -1199,15 +1203,15 @@ async def delete_message( async def delete_my_commands( self, - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_my_commands( scope=scope, @@ -1227,8 +1231,8 @@ async def delete_sticker_from_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_sticker_from_set( sticker=sticker, @@ -1241,14 +1245,14 @@ async def delete_sticker_from_set( async def delete_webhook( self, - drop_pending_updates: bool = None, + drop_pending_updates: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_webhook( drop_pending_updates=drop_pending_updates, @@ -1263,17 +1267,17 @@ async def edit_chat_invite_link( self, chat_id: Union[str, int], invite_link: Union[str, "ChatInviteLink"], - expire_date: Union[int, datetime] = None, - member_limit: int = None, - name: str = None, - creates_join_request: bool = None, + expire_date: Optional[Union[int, datetime]] = None, + member_limit: Optional[int] = None, + name: Optional[str] = None, + creates_join_request: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ChatInviteLink: return await super().edit_chat_invite_link( chat_id=chat_id, @@ -1293,15 +1297,15 @@ async def edit_forum_topic( self, chat_id: Union[str, int], message_thread_id: int, - name: str = None, - icon_custom_emoji_id: str = None, + name: Optional[str] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().edit_forum_topic( chat_id=chat_id, @@ -1324,8 +1328,8 @@ async def edit_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().edit_general_forum_topic( chat_id=chat_id, @@ -1339,20 +1343,20 @@ async def edit_general_forum_topic( async def edit_message_caption( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - caption: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + caption: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().edit_message_caption( chat_id=chat_id, @@ -1371,23 +1375,23 @@ async def edit_message_caption( async def edit_message_live_location( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - latitude: float = None, - longitude: float = None, - reply_markup: InlineKeyboardMarkup = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().edit_message_live_location( chat_id=chat_id, @@ -1410,17 +1414,17 @@ async def edit_message_live_location( async def edit_message_media( self, media: "InputMedia", - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().edit_message_media( media=media, @@ -1437,17 +1441,17 @@ async def edit_message_media( async def edit_message_reply_markup( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, reply_markup: Optional["InlineKeyboardMarkup"] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().edit_message_reply_markup( chat_id=chat_id, @@ -1464,20 +1468,20 @@ async def edit_message_reply_markup( async def edit_message_text( self, text: str, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, - reply_markup: InlineKeyboardMarkup = None, - entities: Sequence["MessageEntity"] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + entities: Optional[Sequence["MessageEntity"]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().edit_message_text( text=text, @@ -1503,8 +1507,8 @@ async def export_chat_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> str: return await super().export_chat_invite_link( chat_id=chat_id, @@ -1522,14 +1526,14 @@ async def forward_message( message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().forward_message( chat_id=chat_id, @@ -1553,8 +1557,8 @@ async def get_chat_administrators( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Tuple[ChatMember, ...]: return await super().get_chat_administrators( chat_id=chat_id, @@ -1574,8 +1578,8 @@ async def get_chat_member( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ChatMember: return await super().get_chat_member( chat_id=chat_id, @@ -1595,8 +1599,8 @@ async def get_chat_member_count( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> int: return await super().get_chat_member_count( chat_id=chat_id, @@ -1609,14 +1613,14 @@ async def get_chat_member_count( async def get_chat_menu_button( self, - chat_id: int = None, + chat_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> MenuButton: return await super().get_chat_menu_button( chat_id=chat_id, @@ -1637,8 +1641,8 @@ async def get_file( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> File: return await super().get_file( file_id=file_id, @@ -1656,8 +1660,8 @@ async def get_forum_topic_icon_stickers( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Tuple[Sticker, ...]: return await super().get_forum_topic_icon_stickers( read_timeout=read_timeout, @@ -1670,16 +1674,16 @@ async def get_forum_topic_icon_stickers( async def get_game_high_scores( self, user_id: Union[int, str], - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Tuple[GameHighScore, ...]: return await super().get_game_high_scores( user_id=user_id, @@ -1700,8 +1704,8 @@ async def get_me( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> User: return await super().get_me( read_timeout=read_timeout, @@ -1713,15 +1717,15 @@ async def get_me( async def get_my_commands( self, - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Tuple[BotCommand, ...]: return await super().get_my_commands( scope=scope, @@ -1735,14 +1739,14 @@ async def get_my_commands( async def get_my_default_administrator_rights( self, - for_channels: bool = None, + for_channels: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ChatAdministratorRights: return await super().get_my_default_administrator_rights( for_channels=for_channels, @@ -1761,8 +1765,8 @@ async def get_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> StickerSet: return await super().get_sticker_set( name=name, @@ -1781,8 +1785,8 @@ async def get_custom_emoji_stickers( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Tuple[Sticker, ...]: return await super().get_custom_emoji_stickers( custom_emoji_ids=custom_emoji_ids, @@ -1796,15 +1800,15 @@ async def get_custom_emoji_stickers( async def get_user_profile_photos( self, user_id: Union[str, int], - offset: int = None, - limit: int = None, + offset: Optional[int] = None, + limit: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> UserProfilePhotos: return await super().get_user_profile_photos( user_id=user_id, @@ -1824,8 +1828,8 @@ async def get_webhook_info( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> WebhookInfo: return await super().get_webhook_info( read_timeout=read_timeout, @@ -1843,8 +1847,8 @@ async def leave_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().leave_chat( chat_id=chat_id, @@ -1862,8 +1866,8 @@ async def log_out( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().log_out( read_timeout=read_timeout, @@ -1880,8 +1884,8 @@ async def close( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().close( read_timeout=read_timeout, @@ -1900,8 +1904,8 @@ async def close_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().close_forum_topic( chat_id=chat_id, @@ -1921,8 +1925,8 @@ async def close_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().close_general_forum_topic( chat_id=chat_id, @@ -1937,15 +1941,15 @@ async def create_forum_topic( self, chat_id: Union[str, int], name: str, - icon_color: int = None, - icon_custom_emoji_id: str = None, + icon_color: Optional[int] = None, + icon_custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ForumTopic: return await super().create_forum_topic( chat_id=chat_id, @@ -1967,8 +1971,8 @@ async def reopen_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().reopen_general_forum_topic( chat_id=chat_id, @@ -1987,8 +1991,8 @@ async def hide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().hide_general_forum_topic( chat_id=chat_id, @@ -2007,8 +2011,8 @@ async def unhide_general_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unhide_general_forum_topic( chat_id=chat_id, @@ -2029,8 +2033,8 @@ async def pin_chat_message( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().pin_chat_message( chat_id=chat_id, @@ -2047,25 +2051,25 @@ async def promote_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - can_change_info: bool = None, - can_post_messages: bool = None, - can_edit_messages: bool = None, - can_delete_messages: bool = None, - can_invite_users: bool = None, - can_restrict_members: bool = None, - can_pin_messages: bool = None, - can_promote_members: bool = None, - is_anonymous: bool = None, - can_manage_chat: bool = None, - can_manage_video_chats: bool = None, - can_manage_topics: bool = None, + can_change_info: Optional[bool] = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: Optional[bool] = None, + can_delete_messages: Optional[bool] = None, + can_invite_users: Optional[bool] = None, + can_restrict_members: Optional[bool] = None, + can_pin_messages: Optional[bool] = None, + can_promote_members: Optional[bool] = None, + is_anonymous: Optional[bool] = None, + can_manage_chat: Optional[bool] = None, + can_manage_video_chats: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().promote_chat_member( chat_id=chat_id, @@ -2098,8 +2102,8 @@ async def reopen_forum_topic( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().reopen_forum_topic( chat_id=chat_id, @@ -2116,15 +2120,15 @@ async def restrict_chat_member( chat_id: Union[str, int], user_id: Union[str, int], permissions: ChatPermissions, - until_date: Union[int, datetime] = None, - use_independent_chat_permissions: bool = None, + until_date: Optional[Union[int, datetime]] = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().restrict_chat_member( chat_id=chat_id, @@ -2148,8 +2152,8 @@ async def revoke_chat_invite_link( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> ChatInviteLink: return await super().revoke_chat_invite_link( chat_id=chat_id, @@ -2165,29 +2169,29 @@ async def send_animation( self, chat_id: Union[int, str], animation: Union[FileInput, "Animation"], - duration: int = None, - width: int = None, - height: int = None, - thumb: FileInput = None, - caption: str = None, + duration: Optional[int] = None, + width: Optional[int] = None, + height: Optional[int] = None, + thumb: Optional[FileInput] = None, + caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_animation( chat_id=chat_id, @@ -2219,28 +2223,28 @@ async def send_audio( self, chat_id: Union[int, str], audio: Union[FileInput, "Audio"], - duration: int = None, - performer: str = None, - title: str = None, - caption: str = None, + duration: Optional[int] = None, + performer: Optional[str] = None, + title: Optional[str] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_audio( chat_id=chat_id, @@ -2271,14 +2275,14 @@ async def send_chat_action( self, chat_id: Union[str, int], action: str, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().send_chat_action( chat_id=chat_id, @@ -2294,24 +2298,24 @@ async def send_chat_action( async def send_contact( self, chat_id: Union[int, str], - phone_number: str = None, - first_name: str = None, - last_name: str = None, + phone_number: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - vcard: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + vcard: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - contact: Contact = None, + contact: Optional[Contact] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_contact( chat_id=chat_id, @@ -2337,19 +2341,19 @@ async def send_dice( self, chat_id: Union[int, str], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - emoji: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + emoji: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_dice( chat_id=chat_id, @@ -2371,26 +2375,26 @@ async def send_document( self, chat_id: Union[int, str], document: Union[FileInput, "Document"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, - disable_content_type_detection: bool = None, + thumb: Optional[FileInput] = None, + disable_content_type_detection: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_document( chat_id=chat_id, @@ -2420,18 +2424,18 @@ async def send_game( chat_id: Union[int, str], game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: InlineKeyboardMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_game( chat_id=chat_id, @@ -2458,34 +2462,34 @@ async def send_invoice( provider_token: str, currency: str, prices: Sequence["LabeledPrice"], - start_parameter: str = None, - photo_url: str = None, - photo_size: int = None, - photo_width: int = None, - photo_height: int = None, - need_name: bool = None, - need_phone_number: bool = None, - need_email: bool = None, - need_shipping_address: bool = None, - is_flexible: bool = None, + start_parameter: Optional[str] = None, + photo_url: Optional[str] = None, + photo_size: Optional[int] = None, + photo_width: Optional[int] = None, + photo_height: Optional[int] = None, + need_name: Optional[bool] = None, + need_phone_number: Optional[bool] = None, + need_email: Optional[bool] = None, + need_shipping_address: Optional[bool] = None, + is_flexible: Optional[bool] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: InlineKeyboardMarkup = None, - provider_data: Union[str, object] = None, - send_phone_number_to_provider: bool = None, - send_email_to_provider: bool = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, + provider_data: Optional[Union[str, object]] = None, + send_phone_number_to_provider: Optional[bool] = None, + send_email_to_provider: Optional[bool] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: Sequence[int] = None, + max_tip_amount: Optional[int] = None, + suggested_tip_amounts: Optional[Sequence[int]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_invoice( chat_id=chat_id, @@ -2526,26 +2530,26 @@ async def send_invoice( async def send_location( self, chat_id: Union[int, str], - latitude: float = None, - longitude: float = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - live_period: int = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + live_period: Optional[int] = None, + horizontal_accuracy: Optional[float] = None, + heading: Optional[int] = None, + proximity_alert_radius: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - location: Location = None, + location: Optional[Location] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_location( chat_id=chat_id, @@ -2576,20 +2580,20 @@ async def send_media_group( Union["InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo"] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, caption: Optional[str] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, ) -> Tuple[Message, ...]: return await super().send_media_group( chat_id=chat_id, @@ -2614,21 +2618,21 @@ async def send_message( chat_id: Union[int, str], text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, - entities: Sequence["MessageEntity"] = None, + entities: Optional[Sequence["MessageEntity"]] = None, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Optional[int] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - reply_markup: ReplyMarkup = None, - message_thread_id: int = None, + reply_markup: Optional[ReplyMarkup] = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_message( chat_id=chat_id, @@ -2653,24 +2657,24 @@ async def send_photo( self, chat_id: Union[int, str], photo: Union[FileInput, "PhotoSize"], - caption: str = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_photo( chat_id=chat_id, @@ -2698,29 +2702,29 @@ async def send_poll( chat_id: Union[int, str], question: str, options: Sequence[str], - is_anonymous: bool = None, - type: str = None, # pylint: disable=redefined-builtin - allows_multiple_answers: bool = None, - correct_option_id: int = None, - is_closed: bool = None, + is_anonymous: Optional[bool] = None, + type: Optional[str] = None, # pylint: disable=redefined-builtin + allows_multiple_answers: Optional[bool] = None, + correct_option_id: Optional[int] = None, + is_closed: Optional[bool] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - explanation: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + explanation: Optional[str] = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, - open_period: int = None, - close_date: Union[int, datetime] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[int, datetime]] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - explanation_entities: Sequence["MessageEntity"] = None, + explanation_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_poll( chat_id=chat_id, @@ -2754,19 +2758,19 @@ async def send_sticker( chat_id: Union[int, str], sticker: Union[FileInput, "Sticker"], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - emoji: str = None, + message_thread_id: Optional[int] = None, + emoji: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_sticker( chat_id=chat_id, @@ -2788,28 +2792,28 @@ async def send_sticker( async def send_venue( self, chat_id: Union[int, str], - latitude: float = None, - longitude: float = None, - title: str = None, - address: str = None, - foursquare_id: str = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + title: Optional[str] = None, + address: Optional[str] = None, + foursquare_id: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - foursquare_type: str = None, - google_place_id: str = None, - google_place_type: str = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + foursquare_type: Optional[str] = None, + google_place_id: Optional[str] = None, + google_place_type: Optional[str] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - venue: Venue = None, + venue: Optional[Venue] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_venue( chat_id=chat_id, @@ -2839,30 +2843,30 @@ async def send_video( self, chat_id: Union[int, str], video: Union[FileInput, "Video"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - width: int = None, - height: int = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + width: Optional[int] = None, + height: Optional[int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, - supports_streaming: bool = None, - thumb: FileInput = None, + supports_streaming: Optional[bool] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - has_spoiler: bool = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + has_spoiler: Optional[bool] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_video( chat_id=chat_id, @@ -2895,24 +2899,24 @@ async def send_video_note( self, chat_id: Union[int, str], video_note: Union[FileInput, "VideoNote"], - duration: int = None, - length: int = None, + duration: Optional[int] = None, + length: Optional[int] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, - thumb: FileInput = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, + thumb: Optional[FileInput] = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, - thumbnail: FileInput = None, + message_thread_id: Optional[int] = None, + thumbnail: Optional[FileInput] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_video_note( chat_id=chat_id, @@ -2939,24 +2943,24 @@ async def send_voice( self, chat_id: Union[int, str], voice: Union[FileInput, "Voice"], - duration: int = None, - caption: str = None, + duration: Optional[int] = None, + caption: Optional[str] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, - reply_markup: ReplyMarkup = None, + reply_to_message_id: Optional[int] = None, + reply_markup: Optional[ReplyMarkup] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Sequence["MessageEntity"] = None, + caption_entities: Optional[Sequence["MessageEntity"]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, - message_thread_id: int = None, + message_thread_id: Optional[int] = None, *, - filename: str = None, + filename: Optional[str] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Message: return await super().send_voice( chat_id=chat_id, @@ -2989,8 +2993,8 @@ async def set_chat_administrator_custom_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_administrator_custom_title( chat_id=chat_id, @@ -3006,14 +3010,14 @@ async def set_chat_administrator_custom_title( async def set_chat_description( self, chat_id: Union[str, int], - description: str = None, + description: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_description( chat_id=chat_id, @@ -3027,15 +3031,15 @@ async def set_chat_description( async def set_chat_menu_button( self, - chat_id: int = None, - menu_button: MenuButton = None, + chat_id: Optional[int] = None, + menu_button: Optional[MenuButton] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_menu_button( chat_id=chat_id, @@ -3051,14 +3055,14 @@ async def set_chat_permissions( self, chat_id: Union[str, int], permissions: ChatPermissions, - use_independent_chat_permissions: bool = None, + use_independent_chat_permissions: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_permissions( chat_id=chat_id, @@ -3080,8 +3084,8 @@ async def set_chat_photo( write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_photo( chat_id=chat_id, @@ -3102,8 +3106,8 @@ async def set_chat_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_sticker_set( chat_id=chat_id, @@ -3124,8 +3128,8 @@ async def set_chat_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_chat_title( chat_id=chat_id, @@ -3141,18 +3145,18 @@ async def set_game_score( self, user_id: Union[int, str], score: int, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - force: bool = None, - disable_edit_message: bool = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + force: Optional[bool] = None, + disable_edit_message: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().set_game_score( user_id=user_id, @@ -3172,15 +3176,15 @@ async def set_game_score( async def set_my_commands( self, commands: Sequence[Union[BotCommand, Tuple[str, str]]], - scope: BotCommandScope = None, - language_code: str = None, + scope: Optional[BotCommandScope] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_my_commands( commands=commands, @@ -3195,15 +3199,15 @@ async def set_my_commands( async def set_my_default_administrator_rights( self, - rights: ChatAdministratorRights = None, - for_channels: bool = None, + rights: Optional[ChatAdministratorRights] = None, + for_channels: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_my_default_administrator_rights( rights=rights, @@ -3224,8 +3228,8 @@ async def set_passport_data_errors( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_passport_data_errors( user_id=user_id, @@ -3246,8 +3250,8 @@ async def set_sticker_position_in_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_position_in_set( sticker=sticker, @@ -3263,14 +3267,14 @@ async def set_sticker_set_thumbnail( self, name: str, user_id: Union[str, int], - thumbnail: FileInput = None, + thumbnail: Optional[FileInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_set_thumbnail( name=name, @@ -3287,14 +3291,14 @@ async def set_sticker_set_thumb( self, name: str, user_id: Union[str, int], - thumb: FileInput = None, + thumb: Optional[FileInput] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_set_thumb( name=name, @@ -3310,19 +3314,19 @@ async def set_sticker_set_thumb( async def set_webhook( self, url: str, - certificate: FileInput = None, - max_connections: int = None, - allowed_updates: Sequence[str] = None, - ip_address: str = None, - drop_pending_updates: bool = None, - secret_token: str = None, + certificate: Optional[FileInput] = None, + max_connections: Optional[int] = None, + allowed_updates: Optional[Sequence[str]] = None, + ip_address: Optional[str] = None, + drop_pending_updates: Optional[bool] = None, + secret_token: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_webhook( url=url, @@ -3341,17 +3345,17 @@ async def set_webhook( async def stop_message_live_location( self, - chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: str = None, - reply_markup: InlineKeyboardMarkup = None, + chat_id: Optional[Union[str, int]] = None, + message_id: Optional[int] = None, + inline_message_id: Optional[str] = None, + reply_markup: Optional[InlineKeyboardMarkup] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> Union[Message, bool]: return await super().stop_message_live_location( chat_id=chat_id, @@ -3369,14 +3373,14 @@ async def unban_chat_member( self, chat_id: Union[str, int], user_id: Union[str, int], - only_if_banned: bool = None, + only_if_banned: Optional[bool] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unban_chat_member( chat_id=chat_id, @@ -3398,8 +3402,8 @@ async def unban_chat_sender_chat( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unban_chat_sender_chat( chat_id=chat_id, @@ -3419,8 +3423,8 @@ async def unpin_all_chat_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unpin_all_chat_messages( chat_id=chat_id, @@ -3434,14 +3438,14 @@ async def unpin_all_chat_messages( async def unpin_chat_message( self, chat_id: Union[str, int], - message_id: int = None, + message_id: Optional[int] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unpin_chat_message( chat_id=chat_id, @@ -3462,8 +3466,8 @@ async def unpin_all_forum_topic_messages( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().unpin_all_forum_topic_messages( chat_id=chat_id, @@ -3478,16 +3482,18 @@ async def unpin_all_forum_topic_messages( async def upload_sticker_file( self, user_id: Union[str, int], - png_sticker: FileInput = None, # Deprecated since bot api 6.6. Optional for compatiblity. - sticker: FileInput = None, # Actually required, but optional for compatibility. - sticker_format: str = None, # Actually required, but optional for compatibility. + png_sticker: Optional[ + FileInput + ] = None, # Deprecated since bot api 6.6. Optional for compatiblity. + sticker: Optional[FileInput] = None, # Actually required, but optional for compatibility. + sticker_format: Optional[str] = None, # Actually required, but optional for compatibility. *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> File: return await super().upload_sticker_file( user_id=user_id, @@ -3503,15 +3509,15 @@ async def upload_sticker_file( async def set_my_description( self, - description: str = None, - language_code: str = None, + description: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_my_description( description=description, @@ -3525,15 +3531,15 @@ async def set_my_description( async def set_my_short_description( self, - short_description: str = None, - language_code: str = None, + short_description: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_my_short_description( short_description=short_description, @@ -3547,14 +3553,14 @@ async def set_my_short_description( async def get_my_description( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> BotDescription: return await super().get_my_description( language_code=language_code, @@ -3567,14 +3573,14 @@ async def get_my_description( async def get_my_short_description( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> BotShortDescription: return await super().get_my_short_description( language_code=language_code, @@ -3587,15 +3593,15 @@ async def get_my_short_description( async def set_my_name( self, - name: str = None, - language_code: str = None, + name: Optional[str] = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_my_name( name=name, @@ -3609,14 +3615,14 @@ async def set_my_name( async def get_my_name( self, - language_code: str = None, + language_code: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> BotName: return await super().get_my_name( language_code=language_code, @@ -3630,14 +3636,14 @@ async def get_my_name( async def set_custom_emoji_sticker_set_thumbnail( self, name: str, - custom_emoji_id: str = None, + custom_emoji_id: Optional[str] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_custom_emoji_sticker_set_thumbnail( name=name, @@ -3658,8 +3664,8 @@ async def set_sticker_set_title( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_set_title( name=name, @@ -3679,8 +3685,8 @@ async def delete_sticker_set( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().delete_sticker_set( name=name, @@ -3700,8 +3706,8 @@ async def set_sticker_emoji_list( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_emoji_list( sticker=sticker, @@ -3716,14 +3722,14 @@ async def set_sticker_emoji_list( async def set_sticker_keywords( self, sticker: str, - keywords: Sequence[str] = None, + keywords: Optional[Sequence[str]] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_keywords( sticker=sticker, @@ -3738,14 +3744,14 @@ async def set_sticker_keywords( async def set_sticker_mask_position( self, sticker: str, - mask_position: MaskPosition = None, + mask_position: Optional[MaskPosition] = None, *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - api_kwargs: JSONDict = None, - rate_limit_args: RLARGS = None, + api_kwargs: Optional[JSONDict] = None, + rate_limit_args: Optional[RLARGS] = None, ) -> bool: return await super().set_sticker_mask_position( sticker=sticker, diff --git a/telegram/ext/_inlinequeryhandler.py b/telegram/ext/_inlinequeryhandler.py index 20a8cb4fb41..743cbd555dd 100644 --- a/telegram/ext/_inlinequeryhandler.py +++ b/telegram/ext/_inlinequeryhandler.py @@ -89,9 +89,9 @@ async def callback(update: Update, context: CallbackContext) def __init__( self, callback: HandlerCallback[Update, CCT, RT], - pattern: Union[str, Pattern[str]] = None, + pattern: Optional[Union[str, Pattern[str]]] = None, block: DVType[bool] = DEFAULT_TRUE, - chat_types: List[str] = None, + chat_types: Optional[List[str]] = None, ): super().__init__(callback, block=block) diff --git a/telegram/ext/_jobqueue.py b/telegram/ext/_jobqueue.py index 74ea0196c66..2b4b3d2a7ba 100644 --- a/telegram/ext/_jobqueue.py +++ b/telegram/ext/_jobqueue.py @@ -162,11 +162,11 @@ def run_once( self, callback: JobCallback[CCT], when: Union[float, datetime.timedelta, datetime.datetime, datetime.time], - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, - job_kwargs: JSONDict = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, + job_kwargs: Optional[JSONDict] = None, ) -> "Job[CCT]": """Creates a new :class:`Job` instance that runs once and adds it to the queue. @@ -246,13 +246,13 @@ def run_repeating( self, callback: JobCallback[CCT], interval: Union[float, datetime.timedelta], - first: Union[float, datetime.timedelta, datetime.datetime, datetime.time] = None, - last: Union[float, datetime.timedelta, datetime.datetime, datetime.time] = None, - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, - job_kwargs: JSONDict = None, + first: Optional[Union[float, datetime.timedelta, datetime.datetime, datetime.time]] = None, + last: Optional[Union[float, datetime.timedelta, datetime.datetime, datetime.time]] = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, + job_kwargs: Optional[JSONDict] = None, ) -> "Job[CCT]": """Creates a new :class:`Job` instance that runs at specified intervals and adds it to the queue. @@ -374,11 +374,11 @@ def run_monthly( callback: JobCallback[CCT], when: datetime.time, day: int, - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, - job_kwargs: JSONDict = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, + job_kwargs: Optional[JSONDict] = None, ) -> "Job[CCT]": """Creates a new :class:`Job` that runs on a monthly basis and adds it to the queue. @@ -452,11 +452,11 @@ def run_daily( callback: JobCallback[CCT], time: datetime.time, days: Tuple[int, ...] = _ALL_DAYS, - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, - job_kwargs: JSONDict = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, + job_kwargs: Optional[JSONDict] = None, ) -> "Job[CCT]": """Creates a new :class:`Job` that runs on a daily basis and adds it to the queue. @@ -542,10 +542,10 @@ def run_custom( self, callback: JobCallback[CCT], job_kwargs: JSONDict, - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, ) -> "Job[CCT]": """Creates a new custom defined :class:`Job`. @@ -721,10 +721,10 @@ async def callback(context: CallbackContext) def __init__( self, callback: JobCallback[CCT], - data: object = None, - name: str = None, - chat_id: int = None, - user_id: int = None, + data: Optional[object] = None, + name: Optional[str] = None, + chat_id: Optional[int] = None, + user_id: Optional[int] = None, ): if not APS_AVAILABLE: raise RuntimeError( diff --git a/telegram/ext/_picklepersistence.py b/telegram/ext/_picklepersistence.py index ee058ec5c17..34fdc36dca7 100644 --- a/telegram/ext/_picklepersistence.py +++ b/telegram/ext/_picklepersistence.py @@ -206,7 +206,7 @@ class PicklePersistence(BasePersistence[UD, CD, BD]): def __init__( self: "PicklePersistence[Dict[Any, Any], Dict[Any, Any], Dict[Any, Any]]", filepath: FilePathInput, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, single_file: bool = True, on_flush: bool = False, update_interval: float = 60, @@ -217,22 +217,22 @@ def __init__( def __init__( self: "PicklePersistence[UD, CD, BD]", filepath: FilePathInput, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, single_file: bool = True, on_flush: bool = False, update_interval: float = 60, - context_types: ContextTypes[Any, UD, CD, BD] = None, + context_types: Optional[ContextTypes[Any, UD, CD, BD]] = None, ): ... def __init__( self, filepath: FilePathInput, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, single_file: bool = True, on_flush: bool = False, update_interval: float = 60, - context_types: ContextTypes[Any, UD, CD, BD] = None, + context_types: Optional[ContextTypes[Any, UD, CD, BD]] = None, ): super().__init__(store_data=store_data, update_interval=update_interval) self.filepath: Path = Path(filepath) diff --git a/telegram/ext/_prefixhandler.py b/telegram/ext/_prefixhandler.py index 35e0cbffe8c..d2abc702f0d 100644 --- a/telegram/ext/_prefixhandler.py +++ b/telegram/ext/_prefixhandler.py @@ -127,7 +127,7 @@ def __init__( prefix: SCT[str], command: SCT[str], callback: HandlerCallback[Update, CCT, RT], - filters: filters_module.BaseFilter = None, + filters: Optional[filters_module.BaseFilter] = None, block: DVType[bool] = DEFAULT_TRUE, ): super().__init__(callback=callback, block=block) diff --git a/telegram/ext/_updater.py b/telegram/ext/_updater.py index 1318e6c7b0a..993091543c9 100644 --- a/telegram/ext/_updater.py +++ b/telegram/ext/_updater.py @@ -190,9 +190,9 @@ async def start_polling( write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - allowed_updates: List[str] = None, - drop_pending_updates: bool = None, - error_callback: Callable[[TelegramError], None] = None, + allowed_updates: Optional[List[str]] = None, + drop_pending_updates: Optional[bool] = None, + error_callback: Optional[Callable[[TelegramError], None]] = None, ) -> "asyncio.Queue[object]": """Starts polling updates from Telegram. @@ -378,15 +378,15 @@ async def start_webhook( listen: str = "127.0.0.1", port: int = 80, url_path: str = "", - cert: Union[str, Path] = None, - key: Union[str, Path] = None, + cert: Optional[Union[str, Path]] = None, + key: Optional[Union[str, Path]] = None, bootstrap_retries: int = 0, - webhook_url: str = None, - allowed_updates: List[str] = None, - drop_pending_updates: bool = None, - ip_address: str = None, + webhook_url: Optional[str] = None, + allowed_updates: Optional[List[str]] = None, + drop_pending_updates: Optional[bool] = None, + ip_address: Optional[str] = None, max_connections: int = 40, - secret_token: str = None, + secret_token: Optional[str] = None, ) -> "asyncio.Queue[object]": """ Starts a small http server to listen for updates via webhook. If :paramref:`cert` @@ -512,14 +512,14 @@ async def _start_webhook( url_path: str, bootstrap_retries: int, allowed_updates: Optional[List[str]], - cert: Union[str, Path] = None, - key: Union[str, Path] = None, - drop_pending_updates: bool = None, - webhook_url: str = None, - ready: asyncio.Event = None, - ip_address: str = None, + cert: Optional[Union[str, Path]] = None, + key: Optional[Union[str, Path]] = None, + drop_pending_updates: Optional[bool] = None, + webhook_url: Optional[str] = None, + ready: Optional[asyncio.Event] = None, + ip_address: Optional[str] = None, max_connections: int = 40, - secret_token: str = None, + secret_token: Optional[str] = None, ) -> None: _LOGGER.debug("Updater thread started (webhook)") @@ -637,12 +637,12 @@ async def _bootstrap( max_retries: int, webhook_url: Optional[str], allowed_updates: Optional[List[str]], - drop_pending_updates: bool = None, + drop_pending_updates: Optional[bool] = None, cert: Optional[bytes] = None, bootstrap_interval: float = 1, - ip_address: str = None, + ip_address: Optional[str] = None, max_connections: int = 40, - secret_token: str = None, + secret_token: Optional[str] = None, ) -> None: """Prepares the setup for fetching updates: delete or set the webhook and drop pending updates if appropriate. If there are unsuccessful attempts, this will retry as specified by diff --git a/telegram/ext/_utils/trackingdict.py b/telegram/ext/_utils/trackingdict.py index 7e64ff99780..aeb0496b385 100644 --- a/telegram/ext/_utils/trackingdict.py +++ b/telegram/ext/_utils/trackingdict.py @@ -26,7 +26,7 @@ the changelog. """ from collections import UserDict -from typing import ClassVar, Generic, List, Mapping, Set, Tuple, TypeVar, Union +from typing import ClassVar, Generic, List, Mapping, Optional, Set, Tuple, TypeVar, Union from telegram._utils.defaultvalue import DEFAULT_NONE, DefaultValue @@ -113,7 +113,7 @@ def clear(self) -> None: # Mypy seems a bit inconsistent about what it wants as types for `default` and return value # so we just ignore a bit - def setdefault(self: "TrackingDict[_KT, _T]", key: _KT, default: _T = None) -> _T: + def setdefault(self: "TrackingDict[_KT, _T]", key: _KT, default: Optional[_T] = None) -> _T: if key in self: return self[key] diff --git a/telegram/ext/_utils/webhookhandler.py b/telegram/ext/_utils/webhookhandler.py index 9097ffb2de4..05ad223df20 100644 --- a/telegram/ext/_utils/webhookhandler.py +++ b/telegram/ext/_utils/webhookhandler.py @@ -62,7 +62,7 @@ def __init__( self._server_lock = asyncio.Lock() self._shutdown_lock = asyncio.Lock() - async def serve_forever(self, ready: asyncio.Event = None) -> None: + async def serve_forever(self, ready: Optional[asyncio.Event] = None) -> None: async with self._server_lock: self._http_server.listen(self.port, address=self.listen) @@ -87,7 +87,11 @@ class WebhookAppClass(tornado.web.Application): """Application used in the Webserver""" def __init__( - self, webhook_path: str, bot: "Bot", update_queue: asyncio.Queue, secret_token: str = None + self, + webhook_path: str, + bot: "Bot", + update_queue: asyncio.Queue, + secret_token: Optional[str] = None, ): self.shared_objects = { "bot": bot, diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index 5a49c84c83e..b0772736ddb 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -177,7 +177,7 @@ class variable. __slots__ = ("_name", "_data_filter") - def __init__(self, name: str = None, data_filter: bool = False): + def __init__(self, name: Optional[str] = None, data_filter: bool = False): self._name = self.__class__.__name__ if name is None else name self._data_filter = data_filter @@ -358,7 +358,10 @@ class _MergedFilter(UpdateFilter): __slots__ = ("base_filter", "and_filter", "or_filter") def __init__( - self, base_filter: BaseFilter, and_filter: BaseFilter = None, or_filter: BaseFilter = None + self, + base_filter: BaseFilter, + and_filter: Optional[BaseFilter] = None, + or_filter: Optional[BaseFilter] = None, ): super().__init__() self.base_filter = base_filter @@ -526,7 +529,7 @@ class Caption(MessageFilter): __slots__ = ("strings",) - def __init__(self, strings: Union[List[str], Tuple[str, ...]] = None): + def __init__(self, strings: Optional[Union[List[str], Tuple[str, ...]]] = None): self.strings: Optional[Sequence[str]] = strings super().__init__(name=f"filters.Caption({strings})" if strings else "filters.CAPTION") @@ -614,8 +617,8 @@ class _ChatUserBaseFilter(MessageFilter, ABC): def __init__( self, - chat_id: SCT[int] = None, - username: SCT[str] = None, + chat_id: Optional[SCT[int]] = None, + username: Optional[SCT[str]] = None, allow_empty: bool = False, ): super().__init__() @@ -956,7 +959,7 @@ def filter(self, message: Message) -> bool: class _Dice(MessageFilter): __slots__ = ("emoji", "values") - def __init__(self, values: SCT[int] = None, emoji: DiceEmojiEnum = None): + def __init__(self, values: Optional[SCT[int]] = None, emoji: Optional[DiceEmojiEnum] = None): super().__init__() self.emoji: Optional[DiceEmojiEnum] = emoji self.values: Optional[Collection[int]] = [values] if isinstance(values, int) else values @@ -2186,7 +2189,7 @@ class Text(MessageFilter): __slots__ = ("strings",) - def __init__(self, strings: Union[List[str], Tuple[str, ...]] = None): + def __init__(self, strings: Optional[Union[List[str], Tuple[str, ...]]] = None): self.strings: Optional[Sequence[str]] = strings super().__init__(name=f"filters.Text({strings})" if strings else "filters.TEXT") @@ -2316,8 +2319,8 @@ class User(_ChatUserBaseFilter): def __init__( self, - user_id: SCT[int] = None, - username: SCT[str] = None, + user_id: Optional[SCT[int]] = None, + username: Optional[SCT[str]] = None, allow_empty: bool = False, ): super().__init__(chat_id=user_id, username=username, allow_empty=allow_empty) @@ -2452,8 +2455,8 @@ class ViaBot(_ChatUserBaseFilter): def __init__( self, - bot_id: SCT[int] = None, - username: SCT[str] = None, + bot_id: Optional[SCT[int]] = None, + username: Optional[SCT[str]] = None, allow_empty: bool = False, ): super().__init__(chat_id=bot_id, username=username, allow_empty=allow_empty) diff --git a/telegram/helpers.py b/telegram/helpers.py index bf4a5276125..7ce0a76c07b 100644 --- a/telegram/helpers.py +++ b/telegram/helpers.py @@ -41,7 +41,7 @@ from telegram import Message, Update -def escape_markdown(text: str, version: int = 1, entity_type: str = None) -> str: +def escape_markdown(text: str, version: int = 1, entity_type: Optional[str] = None) -> str: """Helper function to escape telegram markup symbols. .. versionchanged:: 20.3 @@ -140,7 +140,9 @@ def effective_message_type(entity: Union["Message", "Update"]) -> Optional[str]: return None -def create_deep_linked_url(bot_username: str, payload: str = None, group: bool = False) -> str: +def create_deep_linked_url( + bot_username: str, payload: Optional[str] = None, group: bool = False +) -> str: """ Creates a deep-linked URL for this :paramref:`~create_deep_linked_url.bot_username` with the specified :paramref:`~create_deep_linked_url.payload`. See diff --git a/telegram/request/_baserequest.py b/telegram/request/_baserequest.py index 7e24c39ada8..85a10bc7e82 100644 --- a/telegram/request/_baserequest.py +++ b/telegram/request/_baserequest.py @@ -128,7 +128,7 @@ async def shutdown(self) -> None: async def post( self, url: str, - request_data: RequestData = None, + request_data: Optional[RequestData] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -229,7 +229,7 @@ async def _request_wrapper( self, url: str, method: str, - request_data: RequestData = None, + request_data: Optional[RequestData] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -362,7 +362,7 @@ async def do_request( self, url: str, method: str, - request_data: RequestData = None, + request_data: Optional[RequestData] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/request/_httpxrequest.py b/telegram/request/_httpxrequest.py index 6854e085f1d..a2eb25a77d9 100644 --- a/telegram/request/_httpxrequest.py +++ b/telegram/request/_httpxrequest.py @@ -96,7 +96,7 @@ class HTTPXRequest(BaseRequest): def __init__( self, connection_pool_size: int = 1, - proxy_url: str = None, + proxy_url: Optional[str] = None, read_timeout: Optional[float] = 5.0, write_timeout: Optional[float] = 5.0, connect_timeout: Optional[float] = 5.0, @@ -175,7 +175,7 @@ async def do_request( self, url: str, method: str, - request_data: RequestData = None, + request_data: Optional[RequestData] = None, read_timeout: ODVInput[float] = BaseRequest.DEFAULT_NONE, write_timeout: ODVInput[float] = BaseRequest.DEFAULT_NONE, connect_timeout: ODVInput[float] = BaseRequest.DEFAULT_NONE, diff --git a/telegram/request/_requestdata.py b/telegram/request/_requestdata.py index a957b1e8faa..550bcd7983a 100644 --- a/telegram/request/_requestdata.py +++ b/telegram/request/_requestdata.py @@ -18,7 +18,7 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains a class that holds the parameters of a request to the Bot API.""" import json -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from urllib.parse import urlencode from telegram._utils.types import UploadFileDict @@ -43,7 +43,7 @@ class RequestData: __slots__ = ("_parameters", "contains_files") - def __init__(self, parameters: List[RequestParameter] = None): + def __init__(self, parameters: Optional[List[RequestParameter]] = None): self._parameters: List[RequestParameter] = parameters or [] self.contains_files: bool = any(param.input_files for param in self._parameters) @@ -76,7 +76,7 @@ def json_parameters(self) -> Dict[str, str]: if param.json_value is not None } - def url_encoded_parameters(self, encode_kwargs: Dict[str, Any] = None) -> str: + def url_encoded_parameters(self, encode_kwargs: Optional[Dict[str, Any]] = None) -> str: """Encodes the parameters with :func:`urllib.parse.urlencode`. Args: @@ -87,7 +87,7 @@ def url_encoded_parameters(self, encode_kwargs: Dict[str, Any] = None) -> str: return urlencode(self.json_parameters, **encode_kwargs) return urlencode(self.json_parameters) - def parametrized_url(self, url: str, encode_kwargs: Dict[str, Any] = None) -> str: + def parametrized_url(self, url: str, encode_kwargs: Optional[Dict[str, Any]] = None) -> str: """Shortcut for attaching the return value of :meth:`url_encoded_parameters` to the :paramref:`url`. diff --git a/tests/_files/test_inputmedia.py b/tests/_files/test_inputmedia.py index ef99b2d14ce..bade46cf292 100644 --- a/tests/_files/test_inputmedia.py +++ b/tests/_files/test_inputmedia.py @@ -19,6 +19,7 @@ import asyncio import copy from collections.abc import Sequence +from typing import Optional import pytest @@ -630,7 +631,7 @@ async def test_edit_message_media_with_thumb( self, bot, chat_id, video_file, photo_file, monkeypatch # noqa: F811 ): async def make_assertion( - method: str, url: str, request_data: RequestData = None, *args, **kwargs + method: str, url: str, request_data: Optional[RequestData] = None, *args, **kwargs ): files = request_data.multipart_data video_check = files[input_video.media.attach_name] == input_video.media.field_tuple diff --git a/tests/auxil/bot_method_checks.py b/tests/auxil/bot_method_checks.py index c6d1480146c..3a1c8b25e80 100644 --- a/tests/auxil/bot_method_checks.py +++ b/tests/auxil/bot_method_checks.py @@ -16,13 +16,16 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. +"""Provides functions to test both methods.""" import datetime import functools import inspect -from typing import Any, Callable, Dict, Iterable, List +import re +from typing import Any, Callable, Dict, Iterable, List, Optional import pytest +import telegram # for ForwardRef resolution from telegram import ( Bot, ChatPermissions, @@ -43,6 +46,12 @@ import pytz +FORWARD_REF_PATTERN = re.compile(r"ForwardRef\('(?P\w+)'\)") +""" A pattern to find a class name in a ForwardRef typing annotation. +Class name (in a named group) is surrounded by parentheses and single quotes. +""" + + def check_shortcut_signature( shortcut: Callable, bot_method: Callable, @@ -62,6 +71,20 @@ def check_shortcut_signature( Returns: :obj:`bool`: Whether or not the signature matches. """ + + def resolve_class(class_name: str) -> Optional[type]: + """Attempts to resolve a PTB class (telegram module only) from a ForwardRef. + + E.g. resolves from "StickerSet". + + Returns a class on success, :obj:`None` if nothing could be resolved. + """ + for module in telegram, telegram.request: + cls = getattr(module, class_name, None) + if cls is not None: + return cls + return None # for ruff + shortcut_sig = inspect.signature(shortcut) effective_shortcut_args = set(shortcut_sig.parameters.keys()).difference(additional_kwargs) effective_shortcut_args.discard("self") @@ -84,7 +107,27 @@ def check_shortcut_signature( raise Exception(f"Argument {kwarg} must be of kind {expected_kind}.") if bot_sig.parameters[kwarg].annotation != shortcut_sig.parameters[kwarg].annotation: - if isinstance(bot_sig.parameters[kwarg].annotation, type): + if FORWARD_REF_PATTERN.search(str(shortcut_sig.parameters[kwarg])): + # If a shortcut signature contains a ForwardRef, the simple comparison of + # annotations can fail. Try and resolve the .__args__, then compare them. + + for shortcut_arg, bot_arg in zip( + shortcut_sig.parameters[kwarg].annotation.__args__, + bot_sig.parameters[kwarg].annotation.__args__, + ): + shortcut_arg_to_check = shortcut_arg # for ruff + match = FORWARD_REF_PATTERN.search(str(shortcut_arg)) + if match: + shortcut_arg_to_check = resolve_class(match.group("class_name")) + + if shortcut_arg_to_check != bot_arg: + raise Exception( + f"For argument {kwarg} I expected " + f"{bot_sig.parameters[kwarg].annotation}, but " + f"got {shortcut_sig.parameters[kwarg].annotation}." + f"Comparison of {shortcut_arg} and {bot_arg} failed." + ) + elif isinstance(bot_sig.parameters[kwarg].annotation, type): if bot_sig.parameters[kwarg].annotation.__name__ != str( shortcut_sig.parameters[kwarg].annotation ): @@ -94,8 +137,8 @@ def check_shortcut_signature( ) else: raise Exception( - f"For argument {kwarg} I expected {bot_sig.parameters[kwarg].annotation}, but " - f"got {shortcut_sig.parameters[kwarg].annotation}" + f"For argument {kwarg} I expected {bot_sig.parameters[kwarg].annotation}," + f"but got {shortcut_sig.parameters[kwarg].annotation}" ) bot_method_sig = inspect.signature(bot_method) @@ -117,8 +160,8 @@ async def check_shortcut_call( shortcut_method: Callable, bot: ExtBot, bot_method_name: str, - skip_params: Iterable[str] = None, - shortcut_kwargs: Iterable[str] = None, + skip_params: Optional[Iterable[str]] = None, + shortcut_kwargs: Optional[Iterable[str]] = None, ) -> bool: """ Checks that a shortcut passes all the existing arguments to the underlying bot method. Use as:: diff --git a/tests/auxil/networking.py b/tests/auxil/networking.py index 1cfa86caf4b..dec83df23f3 100644 --- a/tests/auxil/networking.py +++ b/tests/auxil/networking.py @@ -36,7 +36,7 @@ async def _request_wrapper( self, method: str, url: str, - request_data: RequestData = None, + request_data: Optional[RequestData] = None, read_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, @@ -88,8 +88,8 @@ async def send_webhook_message( url_path: str = "", content_len: int = -1, content_type: str = "application/json", - get_method: str = None, - secret_token: str = None, + get_method: Optional[str] = None, + secret_token: Optional[str] = None, ) -> Response: headers = { "content-type": content_type, diff --git a/tests/ext/test_application.py b/tests/ext/test_application.py index 18ffc8578ce..db52aab01a7 100644 --- a/tests/ext/test_application.py +++ b/tests/ext/test_application.py @@ -31,6 +31,7 @@ from queue import Queue from random import randrange from threading import Thread +from typing import Optional import pytest @@ -91,7 +92,7 @@ async def error_handler_raise_error(self, update, context): async def callback_increase_count(self, update, context): self.count += 1 - def callback_set_count(self, count, sleep: float = None): + def callback_set_count(self, count, sleep: Optional[float] = None): async def callback(update, context): if sleep: await asyncio.sleep(sleep) diff --git a/tests/ext/test_basepersistence.py b/tests/ext/test_basepersistence.py index e61888dd1a6..8c70903ef86 100644 --- a/tests/ext/test_basepersistence.py +++ b/tests/ext/test_basepersistence.py @@ -24,7 +24,7 @@ import logging import time from pathlib import Path -from typing import NamedTuple +from typing import NamedTuple, Optional import pytest @@ -70,7 +70,7 @@ class TrackingPersistence(BasePersistence): def __init__( self, - store_data: PersistenceInput = None, + store_data: Optional[PersistenceInput] = None, update_interval: float = 60, fill_data: bool = False, ): @@ -219,20 +219,20 @@ def build_handler(cls, state: HandlerStates, callback=None): class PappInput(NamedTuple): - bot_data: bool = None - chat_data: bool = None - user_data: bool = None - callback_data: bool = None + bot_data: Optional[bool] = None + chat_data: Optional[bool] = None + user_data: Optional[bool] = None + callback_data: Optional[bool] = None conversations: bool = True update_interval: float = None fill_data: bool = False def build_papp( - bot_info: dict = None, - token: str = None, - store_data: dict = None, - update_interval: float = None, + bot_info: Optional[dict] = None, + token: Optional[str] = None, + store_data: Optional[dict] = None, + update_interval: Optional[float] = None, fill_data: bool = False, ) -> Application: store_data = PersistenceInput(**(store_data or {})) @@ -311,7 +311,7 @@ class TestBasePersistence: """Tests basic behavior of BasePersistence and (most importantly) the integration of persistence into the Application.""" - def job_callback(self, chat_id: int = None): + def job_callback(self, chat_id: Optional[int] = None): async def callback(context): if context.user_data: context.user_data["key"] = "value" @@ -330,7 +330,7 @@ async def callback(context): return callback - def handler_callback(self, chat_id: int = None, sleep: float = None): + def handler_callback(self, chat_id: Optional[int] = None, sleep: Optional[float] = None): async def callback(update, context): if sleep: await asyncio.sleep(sleep)