mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
style: module level dunders should be placed before any import statements (all aiogram)
This commit is contained in:
parent
3c57343975
commit
38f823bf8e
9 changed files with 160 additions and 135 deletions
|
|
@ -1,9 +1,9 @@
|
|||
__all__ = [
|
||||
'api',
|
||||
'BaseBot',
|
||||
'Bot',
|
||||
]
|
||||
|
||||
from . import api
|
||||
from .base import BaseBot
|
||||
from .bot import Bot
|
||||
|
||||
__all__ = (
|
||||
'BaseBot',
|
||||
'Bot',
|
||||
'api',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
__all__ = ['RethinkDBStorage']
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import typing
|
||||
|
|
@ -7,8 +9,6 @@ from rethinkdb.asyncio_net.net_asyncio import Connection
|
|||
|
||||
from ...dispatcher.storage import BaseStorage
|
||||
|
||||
__all__ = ('RethinkDBStorage',)
|
||||
|
||||
r = rethinkdb.RethinkDB()
|
||||
r.set_loop_type('asyncio')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
from . import filters
|
||||
from . import handler
|
||||
from . import middlewares
|
||||
from . import storage
|
||||
from . import webhook
|
||||
from .dispatcher import Dispatcher, FSMContext, DEFAULT_RATE_LIMIT
|
||||
|
||||
__all__ = (
|
||||
'DEFAULT_RATE_LIMIT',
|
||||
'Dispatcher',
|
||||
'FSMContext',
|
||||
__all__ = [
|
||||
'filters',
|
||||
'handler',
|
||||
'middlewares',
|
||||
'storage',
|
||||
'webhook'
|
||||
)
|
||||
'webhook',
|
||||
'DEFAULT_RATE_LIMIT',
|
||||
'Dispatcher',
|
||||
'FSMContext',
|
||||
]
|
||||
|
||||
from . import filters, handler, middlewares, storage, webhook
|
||||
from .dispatcher import DEFAULT_RATE_LIMIT, Dispatcher, FSMContext
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
from .builtin import Command, CommandHelp, CommandPrivacy, CommandSettings, CommandStart, ContentTypeFilter, \
|
||||
ExceptionsFilter, HashTag, Regexp, RegexpCommandsFilter, StateFilter, \
|
||||
Text, IDFilter, AdminFilter, IsReplyFilter, IsSenderContact, ForwardedMessageFilter, \
|
||||
ChatTypeFilter, MediaGroupFilter
|
||||
from .factory import FiltersFactory
|
||||
from .filters import AbstractFilter, BoundFilter, Filter, FilterNotPassed, FilterRecord, execute_filter, \
|
||||
check_filters, get_filter_spec, get_filters_spec
|
||||
|
||||
__all__ = (
|
||||
__all__ = [
|
||||
'AdminFilter',
|
||||
'ChatTypeFilter',
|
||||
'Command',
|
||||
'CommandHelp',
|
||||
'CommandPrivacy',
|
||||
|
|
@ -14,26 +8,35 @@ __all__ = (
|
|||
'CommandStart',
|
||||
'ContentTypeFilter',
|
||||
'ExceptionsFilter',
|
||||
'ForwardedMessageFilter',
|
||||
'HashTag',
|
||||
'IDFilter',
|
||||
'IsReplyFilter',
|
||||
'IsSenderContact',
|
||||
'MediaGroupFilter',
|
||||
'Regexp',
|
||||
'RegexpCommandsFilter',
|
||||
'StateFilter',
|
||||
'Text',
|
||||
'IDFilter',
|
||||
'AdminFilter',
|
||||
'IsReplyFilter',
|
||||
'IsSenderContact',
|
||||
'ForwardedMessageFilter',
|
||||
'ChatTypeFilter',
|
||||
'MediaGroupFilter',
|
||||
'FiltersFactory',
|
||||
'AbstractFilter',
|
||||
'BoundFilter',
|
||||
'Filter',
|
||||
'FilterNotPassed',
|
||||
'FilterRecord',
|
||||
'execute_filter',
|
||||
'check_filters',
|
||||
'execute_filter',
|
||||
'get_filter_spec',
|
||||
'get_filters_spec',
|
||||
)
|
||||
]
|
||||
|
||||
from .builtin import (AdminFilter, ChatTypeFilter, Command, CommandHelp,
|
||||
CommandPrivacy, CommandSettings, CommandStart,
|
||||
ContentTypeFilter, ExceptionsFilter,
|
||||
ForwardedMessageFilter, HashTag, IDFilter, IsReplyFilter,
|
||||
IsSenderContact, MediaGroupFilter, Regexp,
|
||||
RegexpCommandsFilter, StateFilter, Text, )
|
||||
from .factory import FiltersFactory
|
||||
from .filters import (AbstractFilter, BoundFilter, Filter, FilterNotPassed,
|
||||
FilterRecord, check_filters, execute_filter,
|
||||
get_filter_spec, get_filters_spec, )
|
||||
|
|
|
|||
|
|
@ -1,81 +1,4 @@
|
|||
from . import base
|
||||
from . import fields
|
||||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
from .auth_widget_data import AuthWidgetData
|
||||
from .bot_command import BotCommand
|
||||
from .callback_game import CallbackGame
|
||||
from .callback_query import CallbackQuery
|
||||
from .chat import Chat, ChatActions, ChatType
|
||||
from .chat_invite_link import ChatInviteLink
|
||||
from .chat_location import ChatLocation
|
||||
from .chat_member import ChatMember, ChatMemberStatus
|
||||
from .chat_member_updated import ChatMemberUpdated
|
||||
from .chat_permissions import ChatPermissions
|
||||
from .chat_photo import ChatPhoto
|
||||
from .chosen_inline_result import ChosenInlineResult
|
||||
from .contact import Contact
|
||||
from .dice import Dice, DiceEmoji
|
||||
from .document import Document
|
||||
from .encrypted_credentials import EncryptedCredentials
|
||||
from .encrypted_passport_element import EncryptedPassportElement
|
||||
from .file import File
|
||||
from .force_reply import ForceReply
|
||||
from .game import Game
|
||||
from .game_high_score import GameHighScore
|
||||
from .inline_keyboard import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from .inline_query import InlineQuery
|
||||
from .inline_query_result import InlineQueryResult, InlineQueryResultArticle, InlineQueryResultAudio, \
|
||||
InlineQueryResultCachedAudio, InlineQueryResultCachedDocument, InlineQueryResultCachedGif, \
|
||||
InlineQueryResultCachedMpeg4Gif, InlineQueryResultCachedPhoto, InlineQueryResultCachedSticker, \
|
||||
InlineQueryResultCachedVideo, InlineQueryResultCachedVoice, InlineQueryResultContact, InlineQueryResultDocument, \
|
||||
InlineQueryResultGame, InlineQueryResultGif, InlineQueryResultLocation, InlineQueryResultMpeg4Gif, \
|
||||
InlineQueryResultPhoto, InlineQueryResultVenue, InlineQueryResultVideo, InlineQueryResultVoice
|
||||
from .input_file import InputFile
|
||||
from .input_media import InputMedia, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaPhoto, \
|
||||
InputMediaVideo, MediaGroup
|
||||
from .input_message_content import InputContactMessageContent, InputLocationMessageContent, InputMessageContent, \
|
||||
InputTextMessageContent, InputVenueMessageContent
|
||||
from .invoice import Invoice
|
||||
from .labeled_price import LabeledPrice
|
||||
from .location import Location
|
||||
from .login_url import LoginUrl
|
||||
from .mask_position import MaskPosition
|
||||
from .message import ContentType, ContentTypes, Message, ParseMode
|
||||
from .message_auto_delete_timer_changed import MessageAutoDeleteTimerChanged
|
||||
from .message_entity import MessageEntity, MessageEntityType
|
||||
from .message_id import MessageId
|
||||
from .order_info import OrderInfo
|
||||
from .passport_data import PassportData
|
||||
from .passport_element_error import PassportElementError, PassportElementErrorDataField, PassportElementErrorFile, \
|
||||
PassportElementErrorFiles, PassportElementErrorFrontSide, PassportElementErrorReverseSide, \
|
||||
PassportElementErrorSelfie
|
||||
from .passport_file import PassportFile
|
||||
from .photo_size import PhotoSize
|
||||
from .poll import PollOption, Poll, PollAnswer, PollType
|
||||
from .pre_checkout_query import PreCheckoutQuery
|
||||
from .proximity_alert_triggered import ProximityAlertTriggered
|
||||
from .reply_keyboard import KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, KeyboardButtonPollType
|
||||
from .response_parameters import ResponseParameters
|
||||
from .shipping_address import ShippingAddress
|
||||
from .shipping_option import ShippingOption
|
||||
from .shipping_query import ShippingQuery
|
||||
from .sticker import Sticker
|
||||
from .sticker_set import StickerSet
|
||||
from .successful_payment import SuccessfulPayment
|
||||
from .update import AllowedUpdates, Update
|
||||
from .user import User
|
||||
from .user_profile_photos import UserProfilePhotos
|
||||
from .venue import Venue
|
||||
from .video import Video
|
||||
from .video_note import VideoNote
|
||||
from .voice import Voice
|
||||
from .voice_chat_ended import VoiceChatEnded
|
||||
from .voice_chat_participants_invited import VoiceChatParticipantsInvited
|
||||
from .voice_chat_started import VoiceChatStarted
|
||||
from .webhook_info import WebhookInfo
|
||||
|
||||
__all__ = (
|
||||
__all__ = [
|
||||
'AllowedUpdates',
|
||||
'Animation',
|
||||
'Audio',
|
||||
|
|
@ -195,4 +118,104 @@ __all__ = (
|
|||
'WebhookInfo',
|
||||
'base',
|
||||
'fields',
|
||||
)
|
||||
]
|
||||
|
||||
from . import base, fields
|
||||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
from .auth_widget_data import AuthWidgetData
|
||||
from .bot_command import BotCommand
|
||||
from .callback_game import CallbackGame
|
||||
from .callback_query import CallbackQuery
|
||||
from .chat import Chat, ChatActions, ChatType
|
||||
from .chat_invite_link import ChatInviteLink
|
||||
from .chat_location import ChatLocation
|
||||
from .chat_member import ChatMember, ChatMemberStatus
|
||||
from .chat_member_updated import ChatMemberUpdated
|
||||
from .chat_permissions import ChatPermissions
|
||||
from .chat_photo import ChatPhoto
|
||||
from .chosen_inline_result import ChosenInlineResult
|
||||
from .contact import Contact
|
||||
from .dice import Dice, DiceEmoji
|
||||
from .document import Document
|
||||
from .encrypted_credentials import EncryptedCredentials
|
||||
from .encrypted_passport_element import EncryptedPassportElement
|
||||
from .file import File
|
||||
from .force_reply import ForceReply
|
||||
from .game import Game
|
||||
from .game_high_score import GameHighScore
|
||||
from .inline_keyboard import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from .inline_query import InlineQuery
|
||||
from .inline_query_result import (InlineQueryResult,
|
||||
InlineQueryResultArticle,
|
||||
InlineQueryResultAudio,
|
||||
InlineQueryResultCachedAudio,
|
||||
InlineQueryResultCachedDocument,
|
||||
InlineQueryResultCachedGif,
|
||||
InlineQueryResultCachedMpeg4Gif,
|
||||
InlineQueryResultCachedPhoto,
|
||||
InlineQueryResultCachedSticker,
|
||||
InlineQueryResultCachedVideo,
|
||||
InlineQueryResultCachedVoice,
|
||||
InlineQueryResultContact,
|
||||
InlineQueryResultDocument,
|
||||
InlineQueryResultGame,
|
||||
InlineQueryResultGif,
|
||||
InlineQueryResultLocation,
|
||||
InlineQueryResultMpeg4Gif,
|
||||
InlineQueryResultPhoto,
|
||||
InlineQueryResultVenue,
|
||||
InlineQueryResultVideo,
|
||||
InlineQueryResultVoice, )
|
||||
from .input_file import InputFile
|
||||
from .input_media import (InputMedia, InputMediaAnimation, InputMediaAudio,
|
||||
InputMediaDocument, InputMediaPhoto,
|
||||
InputMediaVideo, MediaGroup, )
|
||||
from .input_message_content import (InputContactMessageContent,
|
||||
InputLocationMessageContent,
|
||||
InputMessageContent,
|
||||
InputTextMessageContent,
|
||||
InputVenueMessageContent, )
|
||||
from .invoice import Invoice
|
||||
from .labeled_price import LabeledPrice
|
||||
from .location import Location
|
||||
from .login_url import LoginUrl
|
||||
from .mask_position import MaskPosition
|
||||
from .message import ContentType, ContentTypes, Message, ParseMode
|
||||
from .message_auto_delete_timer_changed import MessageAutoDeleteTimerChanged
|
||||
from .message_entity import MessageEntity, MessageEntityType
|
||||
from .message_id import MessageId
|
||||
from .order_info import OrderInfo
|
||||
from .passport_data import PassportData
|
||||
from .passport_element_error import (PassportElementError,
|
||||
PassportElementErrorDataField,
|
||||
PassportElementErrorFile,
|
||||
PassportElementErrorFiles,
|
||||
PassportElementErrorFrontSide,
|
||||
PassportElementErrorReverseSide,
|
||||
PassportElementErrorSelfie, )
|
||||
from .passport_file import PassportFile
|
||||
from .photo_size import PhotoSize
|
||||
from .poll import Poll, PollAnswer, PollOption, PollType
|
||||
from .pre_checkout_query import PreCheckoutQuery
|
||||
from .proximity_alert_triggered import ProximityAlertTriggered
|
||||
from .reply_keyboard import (KeyboardButton, KeyboardButtonPollType,
|
||||
ReplyKeyboardMarkup, ReplyKeyboardRemove, )
|
||||
from .response_parameters import ResponseParameters
|
||||
from .shipping_address import ShippingAddress
|
||||
from .shipping_option import ShippingOption
|
||||
from .shipping_query import ShippingQuery
|
||||
from .sticker import Sticker
|
||||
from .sticker_set import StickerSet
|
||||
from .successful_payment import SuccessfulPayment
|
||||
from .update import AllowedUpdates, Update
|
||||
from .user import User
|
||||
from .user_profile_photos import UserProfilePhotos
|
||||
from .venue import Venue
|
||||
from .video import Video
|
||||
from .video_note import VideoNote
|
||||
from .voice import Voice
|
||||
from .voice_chat_ended import VoiceChatEnded
|
||||
from .voice_chat_participants_invited import VoiceChatParticipantsInvited
|
||||
from .voice_chat_started import VoiceChatStarted
|
||||
from .webhook_info import WebhookInfo
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
__all__ = ['MetaTelegramObject', 'TelegramObject', 'InputFile', 'String',
|
||||
'Integer', 'Float', 'Boolean']
|
||||
|
||||
import io
|
||||
import logging
|
||||
import typing
|
||||
|
|
@ -10,11 +13,10 @@ from babel.support import LazyProxy
|
|||
from .fields import BaseField
|
||||
from ..utils import json
|
||||
from ..utils.mixins import ContextInstanceMixin
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from ..bot.bot import Bot
|
||||
|
||||
__all__ = ('MetaTelegramObject', 'TelegramObject', 'InputFile', 'String', 'Integer', 'Float', 'Boolean')
|
||||
|
||||
PROPS_ATTR_NAME = '_props'
|
||||
VALUES_ATTR_NAME = '_values'
|
||||
ALIASES_ATTR_NAME = '_aliases'
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
__all__ = ['BaseField', 'Field', 'ListField', 'DateTimeField', 'TextField',
|
||||
'ListOfLists']
|
||||
|
||||
import abc
|
||||
import datetime
|
||||
import weakref
|
||||
|
||||
__all__ = ('BaseField', 'Field', 'ListField', 'DateTimeField', 'TextField', 'ListOfLists')
|
||||
|
||||
|
||||
class BaseField(metaclass=abc.ABCMeta):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import contextvars
|
||||
from typing import TypeVar, Type
|
||||
__all__ = ['DataMixin', 'ContextInstanceMixin']
|
||||
|
||||
__all__ = ('DataMixin', 'ContextInstanceMixin')
|
||||
import contextvars
|
||||
from typing import Type, TypeVar
|
||||
|
||||
|
||||
class DataMixin:
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import html
|
||||
import re
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TYPE_CHECKING, Generator, List, Optional, Pattern, cast
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from aiogram.types import MessageEntity
|
||||
|
||||
__all__ = (
|
||||
__all__ = [
|
||||
'HtmlDecoration',
|
||||
'MarkdownDecoration',
|
||||
'TextDecoration',
|
||||
'html_decoration',
|
||||
'markdown_decoration',
|
||||
)
|
||||
]
|
||||
|
||||
import html
|
||||
import re
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Generator, List, Optional, Pattern, TYPE_CHECKING, cast
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from aiogram.types import MessageEntity
|
||||
|
||||
|
||||
class TextDecoration(ABC):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue