Reformat code

This commit is contained in:
Alex Root Junior 2020-11-18 17:16:41 +02:00
parent 1034926286
commit 47bdad4098
35 changed files with 39 additions and 50 deletions

View file

@ -17,8 +17,8 @@ from typing import (
)
from aiogram.utils.exceptions import TelegramAPIError
from aiogram.utils.helper import Default
from ...methods import Response, TelegramMethod
from ...types import UNSET
from ..telegram import PRODUCTION, TelegramAPIServer

View file

@ -9,7 +9,7 @@ from typing import Any, AsyncGenerator, Dict, Optional, Union
from .. import loggers
from ..client.bot import Bot
from ..methods import TelegramMethod
from ..types import Update, User
from ..types import TelegramObject, Update, User
from ..utils.exceptions import TelegramAPIError
from .event.bases import UNHANDLED, SkipHandler
from .event.telegram import TelegramEventObserver

View file

@ -7,8 +7,8 @@ from typing import Any, Dict, Match, Optional, Pattern, Sequence, Union, cast
from pydantic import validator
from aiogram import Bot
from aiogram.types import Message
from aiogram.dispatcher.filters import BaseFilter
from aiogram.types import Message
CommandPatterType = Union[str, re.Pattern]

View file

@ -2,8 +2,9 @@ from typing import Any, Dict, Optional, Sequence, Union
from pydantic import validator
from ...types import Message
from aiogram.types.message import ContentType
from ...types import Message
from .base import BaseFilter

View file

@ -2,8 +2,8 @@ from typing import Any, Dict, Optional, Sequence, Union
from pydantic import root_validator
from aiogram.types import CallbackQuery, InlineQuery, Message, Poll
from aiogram.dispatcher.filters import BaseFilter
from aiogram.types import CallbackQuery, InlineQuery, Message, Poll
TextType = str

View file

@ -1,8 +1,8 @@
from abc import ABC
from typing import Optional
from aiogram.types import CallbackQuery, Message, User
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import CallbackQuery, Message, User
class CallbackQueryHandler(BaseHandler[CallbackQuery], ABC):

View file

@ -1,7 +1,7 @@
from abc import ABC
from aiogram.types import ChosenInlineResult, User
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import ChosenInlineResult, User
class ChosenInlineResultHandler(BaseHandler[ChosenInlineResult], ABC):

View file

@ -1,7 +1,7 @@
from abc import ABC
from aiogram.types import InlineQuery, User
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import InlineQuery, User
class InlineQueryHandler(BaseHandler[InlineQuery], ABC):

View file

@ -1,9 +1,9 @@
from abc import ABC
from typing import Optional, cast
from aiogram.types import Chat, Message, User
from aiogram.dispatcher.filters import CommandObject
from aiogram.dispatcher.handler.base import BaseHandler, BaseHandlerMixin
from aiogram.types import Chat, Message, User
class MessageHandler(BaseHandler[Message], ABC):

View file

@ -1,8 +1,8 @@
from abc import ABC
from typing import List
from aiogram.types import Poll, PollOption
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import Poll, PollOption
class PollHandler(BaseHandler[Poll], ABC):

View file

@ -1,7 +1,7 @@
from abc import ABC
from aiogram.types import PreCheckoutQuery, User
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import PreCheckoutQuery, User
class PreCheckoutQueryHandler(BaseHandler[PreCheckoutQuery], ABC):

View file

@ -1,7 +1,7 @@
from abc import ABC
from aiogram.types import ShippingQuery, User
from aiogram.dispatcher.handler import BaseHandler
from aiogram.types import ShippingQuery, User
class ShippingQueryHandler(BaseHandler[ShippingQuery], ABC):

View file

@ -1,8 +1,8 @@
from contextlib import contextmanager
from typing import Any, Awaitable, Callable, Dict, Iterator, Optional, Tuple
from aiogram.types import Chat, Update, User
from aiogram.dispatcher.middlewares.base import BaseMiddleware
from aiogram.types import Chat, Update, User
class UserContextMiddleware(BaseMiddleware[Update]):

View file

@ -3,10 +3,8 @@ from __future__ import annotations
import warnings
from typing import Any, Dict, Generator, List, Optional, Union
from ..types import TelegramObject, Update
from ..utils.imports import import_module
from ..utils.warnings import CodeHasNoEffect
from .event.bases import UNHANDLED, SkipHandler
from .event.event import EventObserver
from .event.telegram import TelegramEventObserver
from .filters import BUILTIN_FILTERS
@ -186,17 +184,6 @@ class Router:
for router in self.sub_routers:
await router.emit_shutdown(*args, **kwargs)
@property
def update_handler(self) -> TelegramEventObserver:
warnings.warn(
"`Router.update_handler(...)` is deprecated and will be removed in version 3.2 "
"use `Router.update(...)`",
DeprecationWarning,
stacklevel=2,
)
return self.update
@property
def message_handler(self) -> TelegramEventObserver:
warnings.warn(

View file

@ -4,6 +4,7 @@ import datetime
from typing import TYPE_CHECKING, Optional, Union
from aiogram.utils import helper
from .base import TelegramObject
if TYPE_CHECKING: # pragma: no cover

View file

@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
from pydantic import Field
from aiogram.utils import helper
from .base import UNSET, TelegramObject
if TYPE_CHECKING: # pragma: no cover

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from .base import MutableTelegramObject, TelegramObject
from .base import MutableTelegramObject
if TYPE_CHECKING: # pragma: no cover
from .user import User