Update type hints across the codebase (#1749)

* Update type hints across the codebase

* Added changelog record
This commit is contained in:
Alex Root Junior 2026-01-02 02:50:46 +02:00 committed by GitHub
parent dcff0f99c7
commit 0306695b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
307 changed files with 6190 additions and 6385 deletions

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from ..types.message_entity import MessageEntity
@ -19,17 +19,17 @@ class SendGift(TelegramMethod[bool]):
gift_id: str
"""Identifier of the gift; limited gifts can't be sent to channel chats"""
user_id: Optional[int] = None
user_id: int | None = None
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
chat_id: Optional[ChatIdUnion] = None
chat_id: ChatIdUnion | None = None
"""Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift."""
pay_for_upgrade: Optional[bool] = None
pay_for_upgrade: bool | None = None
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
text: Optional[str] = None
text: str | None = None
"""Text that will be shown along with the gift; 0-128 characters"""
text_parse_mode: Optional[str] = None
text_parse_mode: str | None = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None
text_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
if TYPE_CHECKING:
@ -40,12 +40,12 @@ class SendGift(TelegramMethod[bool]):
__pydantic__self__,
*,
gift_id: str,
user_id: Optional[int] = None,
chat_id: Optional[ChatIdUnion] = None,
pay_for_upgrade: Optional[bool] = None,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,
text_entities: Optional[list[MessageEntity]] = None,
user_id: int | None = None,
chat_id: ChatIdUnion | None = None,
pay_for_upgrade: bool | None = None,
text: str | None = None,
text_parse_mode: str | None = None,
text_entities: list[MessageEntity] | None = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!