mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Reformat code
This commit is contained in:
parent
d41d38d49f
commit
088116e1c7
12 changed files with 18 additions and 19 deletions
|
|
@ -9,7 +9,6 @@ from typing import Dict, List, Optional, Union
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from aiohttp.web_exceptions import HTTPGone
|
from aiohttp.web_exceptions import HTTPGone
|
||||||
|
|
||||||
|
|
||||||
from .. import types
|
from .. import types
|
||||||
from ..bot import api
|
from ..bot import api
|
||||||
from ..types import ParseMode
|
from ..types import ParseMode
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
import typing
|
|
||||||
from .passport_file import PassportFile
|
from .passport_file import PassportFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
import typing
|
|
||||||
from .encrypted_passport_element import EncryptedPassportElement
|
|
||||||
from .encrypted_credentials import EncryptedCredentials
|
from .encrypted_credentials import EncryptedCredentials
|
||||||
|
from .encrypted_passport_element import EncryptedPassportElement
|
||||||
|
|
||||||
|
|
||||||
class PassportData(base.TelegramObject):
|
class PassportData(base.TelegramObject):
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,3 @@ class Venue(base.TelegramObject):
|
||||||
address: base.String = fields.Field()
|
address: base.String = fields.Field()
|
||||||
foursquare_id: base.String = fields.Field()
|
foursquare_id: base.String = fields.Field()
|
||||||
foursquare_type: base.String = fields.Field()
|
foursquare_type: base.String = fields.Field()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,10 @@ for more information https://core.telegram.org/widgets/login#checking-authorizat
|
||||||
|
|
||||||
Source: https://gist.github.com/JrooTJunior/887791de7273c9df5277d2b1ecadc839
|
Source: https://gist.github.com/JrooTJunior/887791de7273c9df5277d2b1ecadc839
|
||||||
"""
|
"""
|
||||||
|
import collections
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
|
|
||||||
import collections
|
|
||||||
|
|
||||||
|
|
||||||
def generate_hash(data: dict, token: str) -> str:
|
def generate_hash(data: dict, token: str) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class MessageTextIsEmpty(MessageError):
|
||||||
|
|
||||||
class MessageCantBeEdited(MessageError):
|
class MessageCantBeEdited(MessageError):
|
||||||
match = 'message can\'t be edited'
|
match = 'message can\'t be edited'
|
||||||
|
|
||||||
|
|
||||||
class MessageCantBeDeleted(MessageError):
|
class MessageCantBeDeleted(MessageError):
|
||||||
match = 'message can\'t be deleted'
|
match = 'message can\'t be deleted'
|
||||||
|
|
@ -429,5 +429,5 @@ class Throttled(TelegramAPIError):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Rate limit exceeded! (Limit: {self.rate} s, " \
|
return f"Rate limit exceeded! (Limit: {self.rate} s, " \
|
||||||
f"exceeded: {self.exceeded_count}, " \
|
f"exceeded: {self.exceeded_count}, " \
|
||||||
f"time delta: {round(self.delta, 3)} s)"
|
f"time delta: {round(self.delta, 3)} s)"
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,3 @@ class ContextInstanceMixin:
|
||||||
if not isinstance(value, cls):
|
if not isinstance(value, cls):
|
||||||
raise TypeError(f"Value should be instance of '{cls.__name__}' not '{type(value).__name__}'")
|
raise TypeError(f"Value should be instance of '{cls.__name__}' not '{type(value).__name__}'")
|
||||||
cls.__context_instance.set(value)
|
cls.__context_instance.set(value)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ def get_keyboard() -> types.InlineKeyboardMarkup:
|
||||||
|
|
||||||
def format_post(post_id: str, post: dict) -> (str, types.InlineKeyboardMarkup):
|
def format_post(post_id: str, post: dict) -> (str, types.InlineKeyboardMarkup):
|
||||||
text = f"{md.hbold(post['title'])}\n" \
|
text = f"{md.hbold(post['title'])}\n" \
|
||||||
f"{md.quote_html(post['body'])}\n" \
|
f"{md.quote_html(post['body'])}\n" \
|
||||||
f"\n" \
|
f"\n" \
|
||||||
f"Votes: {post['votes']}"
|
f"Votes: {post['votes']}"
|
||||||
|
|
||||||
markup = types.InlineKeyboardMarkup()
|
markup = types.InlineKeyboardMarkup()
|
||||||
markup.row(
|
markup.row(
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@ import asyncio
|
||||||
|
|
||||||
from aiogram import Bot
|
from aiogram import Bot
|
||||||
from aiogram import types
|
from aiogram import types
|
||||||
from aiogram.utils import executor
|
|
||||||
from aiogram.dispatcher import Dispatcher
|
from aiogram.dispatcher import Dispatcher
|
||||||
from aiogram.types.message import ContentTypes
|
from aiogram.types.message import ContentTypes
|
||||||
|
from aiogram.utils import executor
|
||||||
|
|
||||||
BOT_TOKEN = 'BOT TOKEN HERE'
|
BOT_TOKEN = 'BOT TOKEN HERE'
|
||||||
PAYMENTS_PROVIDER_TOKEN = '123456789:TEST:1234567890abcdef1234567890abcdef'
|
PAYMENTS_PROVIDER_TOKEN = '123456789:TEST:1234567890abcdef1234567890abcdef'
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,8 @@ async def unknown(message: types.Message):
|
||||||
"""
|
"""
|
||||||
Handler for unknown messages.
|
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):
|
async def cmd_id(message: types.Message):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import aresponses
|
import aresponses
|
||||||
|
|
||||||
from aiogram import Bot
|
from aiogram import Bot
|
||||||
|
|
||||||
TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from aiogram import Dispatcher, Bot
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from aiogram import Dispatcher, Bot
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
pytestmark = pytest.mark.asyncio
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue