diff --git a/aiogram/dispatcher/webhook.py b/aiogram/dispatcher/webhook.py index 10a4b3c1..c739a789 100644 --- a/aiogram/dispatcher/webhook.py +++ b/aiogram/dispatcher/webhook.py @@ -9,7 +9,6 @@ from typing import Dict, List, Optional, Union from aiohttp import web from aiohttp.web_exceptions import HTTPGone - from .. import types from ..bot import api from ..types import ParseMode diff --git a/aiogram/types/encrypted_passport_element.py b/aiogram/types/encrypted_passport_element.py index bc7b212b..76e02ec1 100644 --- a/aiogram/types/encrypted_passport_element.py +++ b/aiogram/types/encrypted_passport_element.py @@ -1,6 +1,7 @@ +import typing + from . import base from . import fields -import typing from .passport_file import PassportFile diff --git a/aiogram/types/passport_data.py b/aiogram/types/passport_data.py index 06cbad1c..2fed9fae 100644 --- a/aiogram/types/passport_data.py +++ b/aiogram/types/passport_data.py @@ -1,8 +1,9 @@ +import typing + from . import base from . import fields -import typing -from .encrypted_passport_element import EncryptedPassportElement from .encrypted_credentials import EncryptedCredentials +from .encrypted_passport_element import EncryptedPassportElement class PassportData(base.TelegramObject): diff --git a/aiogram/types/venue.py b/aiogram/types/venue.py index 1b420d57..f7b2a277 100644 --- a/aiogram/types/venue.py +++ b/aiogram/types/venue.py @@ -14,4 +14,3 @@ class Venue(base.TelegramObject): address: base.String = fields.Field() foursquare_id: base.String = fields.Field() foursquare_type: base.String = fields.Field() - diff --git a/aiogram/utils/auth_widget.py b/aiogram/utils/auth_widget.py index 8b2eacf7..b9084eb1 100644 --- a/aiogram/utils/auth_widget.py +++ b/aiogram/utils/auth_widget.py @@ -4,11 +4,10 @@ for more information https://core.telegram.org/widgets/login#checking-authorizat Source: https://gist.github.com/JrooTJunior/887791de7273c9df5277d2b1ecadc839 """ +import collections import hashlib import hmac -import collections - def generate_hash(data: dict, token: str) -> str: """ diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index 9e3bb6d2..24afe356 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -174,7 +174,7 @@ class MessageTextIsEmpty(MessageError): class MessageCantBeEdited(MessageError): match = 'message can\'t be edited' - + class MessageCantBeDeleted(MessageError): match = 'message can\'t be deleted' @@ -429,5 +429,5 @@ class Throttled(TelegramAPIError): def __str__(self): return f"Rate limit exceeded! (Limit: {self.rate} s, " \ - f"exceeded: {self.exceeded_count}, " \ - f"time delta: {round(self.delta, 3)} s)" + f"exceeded: {self.exceeded_count}, " \ + f"time delta: {round(self.delta, 3)} s)" diff --git a/aiogram/utils/mixins.py b/aiogram/utils/mixins.py index aa248cd9..776479bd 100644 --- a/aiogram/utils/mixins.py +++ b/aiogram/utils/mixins.py @@ -45,4 +45,3 @@ class ContextInstanceMixin: if not isinstance(value, cls): raise TypeError(f"Value should be instance of '{cls.__name__}' not '{type(value).__name__}'") cls.__context_instance.set(value) - diff --git a/examples/callback_data_factory.py b/examples/callback_data_factory.py index d87ae1a3..3dd7d35e 100644 --- a/examples/callback_data_factory.py +++ b/examples/callback_data_factory.py @@ -49,9 +49,9 @@ def get_keyboard() -> types.InlineKeyboardMarkup: def format_post(post_id: str, post: dict) -> (str, types.InlineKeyboardMarkup): text = f"{md.hbold(post['title'])}\n" \ - f"{md.quote_html(post['body'])}\n" \ - f"\n" \ - f"Votes: {post['votes']}" + f"{md.quote_html(post['body'])}\n" \ + f"\n" \ + f"Votes: {post['votes']}" markup = types.InlineKeyboardMarkup() markup.row( diff --git a/examples/payments.py b/examples/payments.py index d85e94ab..e8e37011 100644 --- a/examples/payments.py +++ b/examples/payments.py @@ -2,10 +2,9 @@ import asyncio from aiogram import Bot from aiogram import types -from aiogram.utils import executor from aiogram.dispatcher import Dispatcher from aiogram.types.message import ContentTypes - +from aiogram.utils import executor BOT_TOKEN = 'BOT TOKEN HERE' PAYMENTS_PROVIDER_TOKEN = '123456789:TEST:1234567890abcdef1234567890abcdef' diff --git a/examples/webhook_example.py b/examples/webhook_example.py index fb0046ef..86520988 100644 --- a/examples/webhook_example.py +++ b/examples/webhook_example.py @@ -76,7 +76,8 @@ async def unknown(message: types.Message): """ Handler for unknown messages. """ - return SendMessage(message.chat.id, f"I don\'t know what to do with content type `{message.content_type()}`. Sorry :c") + return SendMessage(message.chat.id, + f"I don\'t know what to do with content type `{message.content_type()}`. Sorry :c") async def cmd_id(message: types.Message): diff --git a/tests/__init__.py b/tests/__init__.py index cb0c6b9d..262c9395 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,5 @@ import aresponses + from aiogram import Bot TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890' diff --git a/tests/test_dispatcher.py b/tests/test_dispatcher.py index 3dec03e7..6ebaf472 100644 --- a/tests/test_dispatcher.py +++ b/tests/test_dispatcher.py @@ -1,7 +1,7 @@ -from aiogram import Dispatcher, Bot - import pytest +from aiogram import Dispatcher, Bot + pytestmark = pytest.mark.asyncio