Update pydantic to V2 (#1202)

* Update pydantic, fix errors and warnings (all?)

* Fixed typehints

* Reformat code, removed unused imports

* Fixed typing extensions version compatibility

* Fixed coverage

* Describe changes

* Regen code
This commit is contained in:
Alex Root Junior 2023-07-02 15:07:19 +03:00 committed by GitHub
parent 066d16b522
commit 461e59bbdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
182 changed files with 385 additions and 485 deletions

View file

@ -2928,9 +2928,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\nNote: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.", "description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.",
"html_description": "<td><em>Optional</em>. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.<br/>\n<br/>\n<strong>Note:</strong> This offers an easy way for users to start using your bot in <a href=\"/bots/inline\">inline mode</a> when they are currently in a private chat with it. Especially useful when combined with <a href=\"#answerinlinequery\"><em>switch_pm&#8230;</em></a> actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.</td>", "html_description": "<td><em>Optional</em>. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.</td>",
"rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\n\n\n**Note:** This offers an easy way for users to start using your bot in `inline mode <https://core.telegram.org/bots/inline>`_ when they are currently in a private chat with it. Especially useful when combined with `https://core.telegram.org/bots/api#answerinlinequery <https://core.telegram.org/bots/api#answerinlinequery>`_ *switch_pm…* actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.\n", "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n",
"name": "switch_inline_query", "name": "switch_inline_query",
"required": false "required": false
}, },
@ -9629,9 +9629,9 @@
}, },
{ {
"type": "WebAppInfo", "type": "WebAppInfo",
"description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.",
"html_description": "<td><em>Optional</em>. Description of the <a href=\"/bots/webapps\">Web App</a> that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method <em>web_app_switch_inline_query</em> inside the Web App.</td>", "html_description": "<td><em>Optional</em>. Description of the <a href=\"/bots/webapps\">Web App</a> that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method <a href=\"/bots/webapps#initializing-web-apps\">switchInlineQuery</a> inside the Web App.</td>",
"rst_description": "*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n", "rst_description": "*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method `switchInlineQuery <https://core.telegram.org/bots/webapps#initializing-web-apps>`_ inside the Web App.\n",
"name": "web_app", "name": "web_app",
"required": false "required": false
}, },

View file

@ -53,9 +53,9 @@
}, },
{ {
"type": "String", "type": "String",
"description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\nNote: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.", "description": "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.",
"html_description": "<td><em>Optional</em>. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.<br/>\n<br/>\n<strong>Note:</strong> This offers an easy way for users to start using your bot in <a href=\"/bots/inline\">inline mode</a> when they are currently in a private chat with it. Especially useful when combined with <a href=\"#answerinlinequery\"><em>switch_pm&#8230;</em></a> actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.</td>", "html_description": "<td><em>Optional</em>. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.</td>",
"rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n\n\n\n**Note:** This offers an easy way for users to start using your bot in `inline mode <https://core.telegram.org/bots/inline>`_ when they are currently in a private chat with it. Especially useful when combined with `https://core.telegram.org/bots/api#answerinlinequery <https://core.telegram.org/bots/api#answerinlinequery>`_ *switch_pm…* actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.\n", "rst_description": "*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.\n",
"name": "switch_inline_query", "name": "switch_inline_query",
"required": false "required": false
}, },

View file

@ -21,9 +21,9 @@
}, },
{ {
"type": "WebAppInfo", "type": "WebAppInfo",
"description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App.", "description": "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.",
"html_description": "<td><em>Optional</em>. Description of the <a href=\"/bots/webapps\">Web App</a> that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method <em>web_app_switch_inline_query</em> inside the Web App.</td>", "html_description": "<td><em>Optional</em>. Description of the <a href=\"/bots/webapps\">Web App</a> that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method <a href=\"/bots/webapps#initializing-web-apps\">switchInlineQuery</a> inside the Web App.</td>",
"rst_description": "*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method *web_app_switch_inline_query* inside the Web App.\n", "rst_description": "*Optional*. Description of the `Web App <https://core.telegram.org/bots/webapps>`_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method `switchInlineQuery <https://core.telegram.org/bots/webapps#initializing-web-apps>`_ inside the Web App.\n",
"name": "web_app", "name": "web_app",
"required": false "required": false
}, },

6
CHANGES/1202.misc.rst Normal file
View file

@ -0,0 +1,6 @@
Updated `Pydantic to V2 <https://docs.pydantic.dev/2.0/migration/>`_
.. warning::
Be careful, not all libraries is already updated to using V2
(for example at the time, when this warning was added FastAPI still not support V2)

View file

@ -141,7 +141,7 @@ class AiohttpSession(BaseSession):
def build_form_data(self, bot: Bot, method: TelegramMethod[TelegramType]) -> FormData: def build_form_data(self, bot: Bot, method: TelegramMethod[TelegramType]) -> FormData:
form = FormData(quote_fields=False) form = FormData(quote_fields=False)
files: Dict[str, InputFile] = {} files: Dict[str, InputFile] = {}
for key, value in method.dict().items(): for key, value in method.model_dump(warnings=False).items():
value = self.prepare_value(value, bot=bot, files=files) value = self.prepare_value(value, bot=bot, files=files)
if not value: if not value:
continue continue

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Awaitable, Callable, Union from typing import TYPE_CHECKING, Protocol
from aiogram.methods import Response, TelegramMethod from aiogram.methods import Response, TelegramMethod
from aiogram.methods.base import TelegramType from aiogram.methods.base import TelegramType
@ -9,16 +9,24 @@ from aiogram.methods.base import TelegramType
if TYPE_CHECKING: if TYPE_CHECKING:
from ...bot import Bot from ...bot import Bot
NextRequestMiddlewareType = Callable[
["Bot", TelegramMethod[TelegramType]], Awaitable[Response[TelegramType]] class NextRequestMiddlewareType(Protocol[TelegramType]): # pragma: no cover
] async def __call__(
RequestMiddlewareType = Union[ self,
"BaseRequestMiddleware", bot: "Bot",
Callable[ method: TelegramMethod[TelegramType],
[NextRequestMiddlewareType[TelegramType], "Bot", TelegramMethod[TelegramType]], ) -> Response[TelegramType]:
Awaitable[Response[TelegramType]], pass
],
]
class RequestMiddlewareType(Protocol): # pragma: no cover
async def __call__(
self,
make_request: NextRequestMiddlewareType[TelegramType],
bot: "Bot",
method: TelegramMethod[TelegramType],
) -> Response[TelegramType]:
pass
class BaseRequestMiddleware(ABC): class BaseRequestMiddleware(ABC):

View file

@ -1,68 +1,48 @@
from __future__ import annotations from __future__ import annotations
from functools import partial from functools import partial
from typing import ( from typing import Any, Callable, List, Optional, Sequence, Union, cast, overload
TYPE_CHECKING,
Any,
Awaitable,
Callable,
List,
Optional,
Sequence,
Union,
overload,
)
from aiogram.client.session.middlewares.base import ( from aiogram.client.session.middlewares.base import (
NextRequestMiddlewareType, NextRequestMiddlewareType,
RequestMiddlewareType, RequestMiddlewareType,
) )
from aiogram.methods import Response from aiogram.methods.base import TelegramType
from aiogram.methods.base import TelegramMethod, TelegramType
from aiogram.types import TelegramObject
if TYPE_CHECKING:
from aiogram import Bot
class RequestMiddlewareManager(Sequence[RequestMiddlewareType[TelegramObject]]): class RequestMiddlewareManager(Sequence[RequestMiddlewareType]):
def __init__(self) -> None: def __init__(self) -> None:
self._middlewares: List[RequestMiddlewareType[TelegramObject]] = [] self._middlewares: List[RequestMiddlewareType] = []
def register( def register(
self, self,
middleware: RequestMiddlewareType[TelegramObject], middleware: RequestMiddlewareType,
) -> RequestMiddlewareType[TelegramObject]: ) -> RequestMiddlewareType:
self._middlewares.append(middleware) self._middlewares.append(middleware)
return middleware return middleware
def unregister(self, middleware: RequestMiddlewareType[TelegramObject]) -> None: def unregister(self, middleware: RequestMiddlewareType) -> None:
self._middlewares.remove(middleware) self._middlewares.remove(middleware)
def __call__( def __call__(
self, self,
middleware: Optional[RequestMiddlewareType[TelegramObject]] = None, middleware: Optional[RequestMiddlewareType] = None,
) -> Union[ ) -> Union[Callable[[RequestMiddlewareType], RequestMiddlewareType], RequestMiddlewareType,]:
Callable[[RequestMiddlewareType[TelegramObject]], RequestMiddlewareType[TelegramObject]],
RequestMiddlewareType[TelegramObject],
]:
if middleware is None: if middleware is None:
return self.register return self.register
return self.register(middleware) return self.register(middleware)
@overload @overload
def __getitem__(self, item: int) -> RequestMiddlewareType[TelegramObject]: def __getitem__(self, item: int) -> RequestMiddlewareType:
pass pass
@overload @overload
def __getitem__(self, item: slice) -> Sequence[RequestMiddlewareType[TelegramObject]]: def __getitem__(self, item: slice) -> Sequence[RequestMiddlewareType]:
pass pass
def __getitem__( def __getitem__(
self, item: Union[int, slice] self, item: Union[int, slice]
) -> Union[ ) -> Union[RequestMiddlewareType, Sequence[RequestMiddlewareType]]:
RequestMiddlewareType[TelegramObject], Sequence[RequestMiddlewareType[TelegramObject]]
]:
return self._middlewares[item] return self._middlewares[item]
def __len__(self) -> int: def __len__(self) -> int:
@ -70,10 +50,10 @@ class RequestMiddlewareManager(Sequence[RequestMiddlewareType[TelegramObject]]):
def wrap_middlewares( def wrap_middlewares(
self, self,
callback: Callable[[Bot, TelegramMethod[TelegramType]], Awaitable[Response[TelegramType]]], callback: NextRequestMiddlewareType[TelegramType],
**kwargs: Any, **kwargs: Any,
) -> NextRequestMiddlewareType[TelegramType]: ) -> NextRequestMiddlewareType[TelegramType]:
middleware = partial(callback, **kwargs) middleware = partial(callback, **kwargs)
for m in reversed(self._middlewares): for m in reversed(self._middlewares):
middleware = partial(m, middleware) # type: ignore middleware = partial(m, middleware)
return middleware return cast(NextRequestMiddlewareType[TelegramType], middleware)

View file

@ -1,5 +1,4 @@
from contextlib import contextmanager from typing import Any, Awaitable, Callable, Dict, Optional, Tuple
from typing import Any, Awaitable, Callable, Dict, Iterator, Optional, Tuple
from aiogram.dispatcher.middlewares.base import BaseMiddleware from aiogram.dispatcher.middlewares.base import BaseMiddleware
from aiogram.types import Chat, TelegramObject, Update, User from aiogram.types import Chat, TelegramObject, Update, User

View file

@ -110,7 +110,7 @@ class CallbackData(BaseModel):
:return: instance of CallbackData :return: instance of CallbackData
""" """
prefix, *parts = value.split(cls.__separator__) prefix, *parts = value.split(cls.__separator__)
names = cls.__fields__.keys() names = cls.model_fields.keys()
if len(parts) != len(names): if len(parts) != len(names):
raise TypeError( raise TypeError(
f"Callback data {cls.__name__!r} takes {len(names)} arguments " f"Callback data {cls.__name__!r} takes {len(names)} arguments "
@ -120,8 +120,8 @@ class CallbackData(BaseModel):
raise ValueError(f"Bad prefix ({prefix!r} != {cls.__prefix__!r})") raise ValueError(f"Bad prefix ({prefix!r} != {cls.__prefix__!r})")
payload = {} payload = {}
for k, v in zip(names, parts): # type: str, Optional[str] for k, v in zip(names, parts): # type: str, Optional[str]
if field := cls.__fields__.get(k): if field := cls.model_fields.get(k):
if v == "" and not field.required: if v == "" and not field.is_required():
v = None v = None
payload[k] = v payload[k] = v
return cls(**payload) return cls(**payload)

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import InputSticker from ..types import InputSticker
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from pydantic import Field from pydantic import Field
@ -32,12 +32,12 @@ class AnswerInlineQuery(TelegramMethod[bool]):
"""Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.""" """Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."""
button: Optional[InlineQueryResultsButton] = None button: Optional[InlineQueryResultsButton] = None
"""A JSON-serialized object describing a button to be shown above inline query results""" """A JSON-serialized object describing a button to be shown above inline query results"""
switch_pm_parameter: Optional[str] = Field(None, deprecated=True) switch_pm_parameter: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""`Deep-linking <https://core.telegram.org/bots/features#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. """`Deep-linking <https://core.telegram.org/bots/features#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.
.. deprecated:: API:6.7 .. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023""" https://core.telegram.org/bots/api-changelog#april-21-2023"""
switch_pm_text: Optional[str] = Field(None, deprecated=True) switch_pm_text: Optional[str] = Field(None, json_schema_extra={"deprecated": True})
"""If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*
.. deprecated:: API:6.7 .. deprecated:: API:6.7

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import ShippingOption from ..types import ShippingOption
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import InlineQueryResult, SentWebAppMessage from ..types import InlineQueryResult, SentWebAppMessage
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -3,8 +3,8 @@ from __future__ import annotations
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Dict, Generator, Generic, Optional, TypeVar from typing import TYPE_CHECKING, Any, Dict, Generator, Generic, Optional, TypeVar
from pydantic import BaseConfig, BaseModel, Extra, root_validator from pydantic import BaseModel, ConfigDict
from pydantic.generics import GenericModel from pydantic.functional_validators import model_validator
from ..types import InputFile, ResponseParameters from ..types import InputFile, ResponseParameters
from ..types.base import UNSET_TYPE from ..types.base import UNSET_TYPE
@ -16,16 +16,15 @@ TelegramType = TypeVar("TelegramType", bound=Any)
class Request(BaseModel): class Request(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
method: str method: str
data: Dict[str, Optional[Any]] data: Dict[str, Optional[Any]]
files: Optional[Dict[str, InputFile]] files: Optional[Dict[str, InputFile]]
class Config(BaseConfig):
arbitrary_types_allowed = True
class Response(BaseModel, Generic[TelegramType]):
class Response(GenericModel, Generic[TelegramType]):
ok: bool ok: bool
result: Optional[TelegramType] = None result: Optional[TelegramType] = None
description: Optional[str] = None description: Optional[str] = None
@ -33,16 +32,14 @@ class Response(GenericModel, Generic[TelegramType]):
parameters: Optional[ResponseParameters] = None parameters: Optional[ResponseParameters] = None
class TelegramMethod(ABC, BaseModel, Generic[TelegramType]): class TelegramMethod(BaseModel, Generic[TelegramType], ABC):
class Config(BaseConfig): model_config = ConfigDict(
# use_enum_values = True extra="allow",
extra = Extra.allow populate_by_name=True,
allow_population_by_field_name = True arbitrary_types_allowed=True,
arbitrary_types_allowed = True )
orm_mode = True
smart_union = True # https://github.com/aiogram/aiogram/issues/901
@root_validator(pre=True) @model_validator(mode="before")
def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]: def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]:
""" """
Remove UNSET before fields validation. Remove UNSET before fields validation.
@ -64,12 +61,6 @@ class TelegramMethod(ABC, BaseModel, Generic[TelegramType]):
def __api_method__(self) -> str: def __api_method__(self) -> str:
pass pass
def dict(self, **kwargs: Any) -> Any:
# override dict of pydantic.BaseModel to overcome exporting request_timeout field
exclude = kwargs.pop("exclude", set())
return super().dict(exclude=exclude, **kwargs)
def build_response(self, data: Dict[str, Any]) -> Response[TelegramType]: def build_response(self, data: Dict[str, Any]) -> Response[TelegramType]:
# noinspection PyTypeChecker # noinspection PyTypeChecker
return Response[self.__returning__](**data) # type: ignore return Response[self.__returning__](**data) # type: ignore
@ -77,8 +68,6 @@ class TelegramMethod(ABC, BaseModel, Generic[TelegramType]):
async def emit(self, bot: Bot) -> TelegramType: async def emit(self, bot: Bot) -> TelegramType:
return await bot(self) return await bot(self)
as_ = emit
def __await__(self) -> Generator[Any, None, TelegramType]: def __await__(self) -> Generator[Any, None, TelegramType]:
from aiogram.client.bot import Bot from aiogram.client.bot import Bot

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ChatInviteLink from ..types import ChatInviteLink
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ForumTopic from ..types import ForumTopic
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import LabeledPrice from ..types import LabeledPrice
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import InputSticker from ..types import InputSticker
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import BotCommandScope from ..types import BotCommandScope
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ChatInviteLink from ..types import ChatInviteLink
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import InlineKeyboardMarkup, Message from ..types import InlineKeyboardMarkup, Message
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import InlineKeyboardMarkup, InputMedia, Message from ..types import InlineKeyboardMarkup, InputMedia, Message
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import InlineKeyboardMarkup, Message from ..types import InlineKeyboardMarkup, Message
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity from ..types import UNSET_PARSE_MODE, InlineKeyboardMarkup, Message, MessageEntity
from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW from ..types.base import UNSET_DISABLE_WEB_PAGE_PREVIEW

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import Message from ..types import Message
from ..types.base import UNSET_PROTECT_CONTENT from ..types.base import UNSET_PROTECT_CONTENT

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from ..types import Chat from ..types import Chat
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Union from typing import List, Union
from ..types import ( from ..types import (
ChatMemberAdministrator, ChatMemberAdministrator,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from ..types import ( from ..types import (
ChatMemberAdministrator, ChatMemberAdministrator,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List from typing import List
from ..types import Sticker from ..types import Sticker
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import File from ..types import File
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List from typing import List
from ..types import Sticker from ..types import Sticker
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import GameHighScore from ..types import GameHighScore
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import User from ..types import User
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import BotCommand, BotCommandScope from ..types import BotCommand, BotCommandScope
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import ChatAdministratorRights from ..types import ChatAdministratorRights
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import BotDescription from ..types import BotDescription
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import BotShortDescription from ..types import BotShortDescription
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import StickerSet from ..types import StickerSet
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional from typing import List, Optional
from ..types import Update from ..types import Update
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import UserProfilePhotos from ..types import UserProfilePhotos
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from ..types import WebhookInfo from ..types import WebhookInfo
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,5 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ChatPermissions from ..types import ChatPermissions
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from ..types import ChatInviteLink from ..types import ChatInviteLink
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from ..types import InlineKeyboardMarkup, Message from ..types import InlineKeyboardMarkup, Message
from ..types.base import UNSET_PROTECT_CONTENT from ..types.base import UNSET_PROTECT_CONTENT

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import InlineKeyboardMarkup, LabeledPrice, Message from ..types import InlineKeyboardMarkup, LabeledPrice, Message
from ..types.base import UNSET_PROTECT_CONTENT from ..types.base import UNSET_PROTECT_CONTENT

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
InputMediaAudio, InputMediaAudio,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import datetime import datetime
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ( from ..types import (
ForceReply, ForceReply,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional, Union from typing import List, Optional, Union
from ..types import ( from ..types import (
UNSET_PARSE_MODE, UNSET_PARSE_MODE,

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp from ..types import MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import ChatPermissions from ..types import ChatPermissions
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from ..types import InputFile from ..types import InputFile
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Union from typing import Union
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional from typing import Optional
from .base import TelegramMethod from .base import TelegramMethod

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union from typing import Optional, Union
from ..types import Message from ..types import Message
from .base import TelegramMethod from .base import TelegramMethod

Some files were not shown because too many files have changed in this diff Show more