From 92d3d86a1814ab494631fd9dfe84a16f889ef0c1 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 14 Aug 2017 22:34:13 +0300 Subject: [PATCH] Reformat code. --- aiogram/__init__.py | 3 +-- aiogram/contrib/fsm_storage/memory.py | 2 +- aiogram/contrib/fsm_storage/redis.py | 2 +- aiogram/dispatcher/__init__.py | 2 +- aiogram/dispatcher/webhook.py | 1 + aiogram/types/__init__.py | 3 +-- aiogram/types/animation.py | 1 + aiogram/types/audio.py | 1 + aiogram/types/callback_query.py | 1 + aiogram/types/chosen_inline_result.py | 1 + aiogram/types/contact.py | 1 + aiogram/types/document.py | 1 + aiogram/types/file.py | 1 + aiogram/types/force_reply.py | 1 + aiogram/types/game.py | 1 + aiogram/types/game_high_score.py | 1 + aiogram/types/inline_keyboard.py | 2 ++ aiogram/types/inline_query.py | 1 + aiogram/types/inline_query_result.py | 25 +++++++++++++++++++++++++ aiogram/types/invoice.py | 1 + aiogram/types/labeled_price.py | 1 + aiogram/types/location.py | 1 + aiogram/types/order_info.py | 1 + aiogram/types/photo_size.py | 1 + aiogram/types/pre_checkout_query.py | 1 + aiogram/types/reply_keyboard.py | 3 +++ aiogram/types/response_parameters.py | 1 + aiogram/types/shipping_address.py | 1 + aiogram/types/shipping_option.py | 1 + aiogram/types/shipping_query.py | 1 + aiogram/types/sticker.py | 2 +- aiogram/types/successful_payment.py | 1 + aiogram/types/user.py | 1 + aiogram/types/user_profile_photos.py | 1 + aiogram/types/venue.py | 1 + aiogram/types/video.py | 1 + aiogram/types/video_note.py | 1 + aiogram/types/voice.py | 1 + aiogram/types/webhook_info.py | 3 +-- aiogram/utils/emoji.py | 4 ++++ aiogram/utils/json.py | 2 ++ aiogram/utils/versions.py | 1 + 42 files changed, 73 insertions(+), 10 deletions(-) diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 622fba47..620e5606 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -1,6 +1,5 @@ -from .utils.versions import Version, Stage from .bot import Bot - +from .utils.versions import Version, Stage VERSION = Version(0, 3, 5, stage=Stage.DEV, build=0) diff --git a/aiogram/contrib/fsm_storage/memory.py b/aiogram/contrib/fsm_storage/memory.py index c0c81c57..52a6264c 100644 --- a/aiogram/contrib/fsm_storage/memory.py +++ b/aiogram/contrib/fsm_storage/memory.py @@ -1,6 +1,6 @@ import typing -from aiogram.dispatcher import BaseStorage +from ...dispatcher import BaseStorage class MemoryStorage(BaseStorage): diff --git a/aiogram/contrib/fsm_storage/redis.py b/aiogram/contrib/fsm_storage/redis.py index 30c61128..a6bf2b30 100644 --- a/aiogram/contrib/fsm_storage/redis.py +++ b/aiogram/contrib/fsm_storage/redis.py @@ -7,8 +7,8 @@ import typing import aioredis -from aiogram.utils import json from ...dispatcher.storage import BaseStorage +from ...utils import json class RedisStorage(BaseStorage): diff --git a/aiogram/dispatcher/__init__.py b/aiogram/dispatcher/__init__.py index 28e53014..d2603500 100644 --- a/aiogram/dispatcher/__init__.py +++ b/aiogram/dispatcher/__init__.py @@ -27,7 +27,7 @@ class Dispatcher: if storage is None: storage = DisabledStorage() - self.bot: 'Bot' = bot + self.bot: Bot = bot self.loop = loop self.storage = storage diff --git a/aiogram/dispatcher/webhook.py b/aiogram/dispatcher/webhook.py index 06e9197d..53d2e42c 100644 --- a/aiogram/dispatcher/webhook.py +++ b/aiogram/dispatcher/webhook.py @@ -104,6 +104,7 @@ class BaseResponse: """ Base class for webhook responses. """ + @property def method(self) -> str: """ diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index b8fff0e8..4a8fd58e 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -1,3 +1,4 @@ +from . import base from .animation import Animation from .audio import Audio from .callback_query import CallbackQuery @@ -48,8 +49,6 @@ from .video_note import VideoNote from .voice import Voice from .webhook_info import WebhookInfo -from . import base - __all__ = [ 'base', 'Animation', diff --git a/aiogram/types/animation.py b/aiogram/types/animation.py index 4a6c0939..fab71560 100644 --- a/aiogram/types/animation.py +++ b/aiogram/types/animation.py @@ -9,6 +9,7 @@ class Animation(Deserializable): https://core.telegram.org/bots/api#animation """ + def __init__(self, file_id, thumb, file_name, mime_type, file_size): self.file_id: str = file_id self.thumb: PhotoSize = thumb diff --git a/aiogram/types/audio.py b/aiogram/types/audio.py index b677de56..536eff92 100644 --- a/aiogram/types/audio.py +++ b/aiogram/types/audio.py @@ -7,6 +7,7 @@ class Audio(Deserializable): https://core.telegram.org/bots/api#audio """ + def __init__(self, file_id, duration, performer, title, mime_type, file_size): self.file_id: str = file_id self.duration: int = duration diff --git a/aiogram/types/callback_query.py b/aiogram/types/callback_query.py index 466e4d95..99e98833 100644 --- a/aiogram/types/callback_query.py +++ b/aiogram/types/callback_query.py @@ -17,6 +17,7 @@ class CallbackQuery(Deserializable): https://core.telegram.org/bots/api#callbackquery """ + def __init__(self, id, from_user, message, inline_message_id, chat_instance, data, game_short_name): self.id: int = id self.from_user: User = from_user diff --git a/aiogram/types/chosen_inline_result.py b/aiogram/types/chosen_inline_result.py index 6d20f916..60ba3d0f 100644 --- a/aiogram/types/chosen_inline_result.py +++ b/aiogram/types/chosen_inline_result.py @@ -9,6 +9,7 @@ class ChosenInlineResult(Deserializable): https://core.telegram.org/bots/api#choseninlineresult """ + def __init__(self, result_id, from_user, location, inline_message_id, query): self.result_id: str = result_id self.from_user: User = from_user diff --git a/aiogram/types/contact.py b/aiogram/types/contact.py index 5d7eca7b..4ffb6ab0 100644 --- a/aiogram/types/contact.py +++ b/aiogram/types/contact.py @@ -7,6 +7,7 @@ class Contact(Deserializable): https://core.telegram.org/bots/api#contact """ + def __init__(self, phone_number, first_name, last_name, user_id): self.phone_number: str = phone_number self.first_name: str = first_name diff --git a/aiogram/types/document.py b/aiogram/types/document.py index 8b390df1..0f0f62e3 100644 --- a/aiogram/types/document.py +++ b/aiogram/types/document.py @@ -8,6 +8,7 @@ class Document(Deserializable): https://core.telegram.org/bots/api#document """ + def __init__(self, file_id, thumb, file_name, mime_type, file_size): self.file_id: str = file_id self.thumb: PhotoSize = thumb diff --git a/aiogram/types/file.py b/aiogram/types/file.py index 44b918ce..7fa55fcc 100644 --- a/aiogram/types/file.py +++ b/aiogram/types/file.py @@ -12,6 +12,7 @@ class File(Deserializable): https://core.telegram.org/bots/api#file """ + def __init__(self, file_id, file_size, file_path): self.file_id: str = file_id self.file_size: int = file_size diff --git a/aiogram/types/force_reply.py b/aiogram/types/force_reply.py index 048ebf2f..91a4278b 100644 --- a/aiogram/types/force_reply.py +++ b/aiogram/types/force_reply.py @@ -12,6 +12,7 @@ class ForceReply(Serializable): https://core.telegram.org/bots/api#forcereply """ + def __init__(self, selective=None): self.selective = selective diff --git a/aiogram/types/game.py b/aiogram/types/game.py index beda58e3..22fed354 100644 --- a/aiogram/types/game.py +++ b/aiogram/types/game.py @@ -12,6 +12,7 @@ class Game(Deserializable): https://core.telegram.org/bots/api#game """ + def __init__(self, title, description, photo, text, text_entities, animation): self.title = title self.description = description diff --git a/aiogram/types/game_high_score.py b/aiogram/types/game_high_score.py index 9f515640..46fe5307 100644 --- a/aiogram/types/game_high_score.py +++ b/aiogram/types/game_high_score.py @@ -8,6 +8,7 @@ class GameHighScore(Deserializable): https://core.telegram.org/bots/api#gamehighscore """ + def __init__(self, position, user, score): self.position: int = position self.user: User = user diff --git a/aiogram/types/inline_keyboard.py b/aiogram/types/inline_keyboard.py index 9e3a2ee7..c45105e1 100644 --- a/aiogram/types/inline_keyboard.py +++ b/aiogram/types/inline_keyboard.py @@ -7,6 +7,7 @@ class InlineKeyboardMarkup(Serializable): https://core.telegram.org/bots/api#inlinekeyboardmarkup """ + def __init__(self, row_width=3): self.row_width = row_width @@ -41,6 +42,7 @@ class InlineKeyboardButton(Serializable): https://core.telegram.org/bots/api#inlinekeyboardbutton """ + def __init__(self, text, url=None, callback_data=None, switch_inline_query=None, switch_inline_query_current_chat=None, callback_game=None, pay=None): self.text = text diff --git a/aiogram/types/inline_query.py b/aiogram/types/inline_query.py index b304f4e0..dc768102 100644 --- a/aiogram/types/inline_query.py +++ b/aiogram/types/inline_query.py @@ -11,6 +11,7 @@ class InlineQuery(Deserializable): https://core.telegram.org/bots/api#inlinequery """ + def __init__(self, id, from_user, location, query, offset): self.id: int = id self.from_user: User = from_user diff --git a/aiogram/types/inline_query_result.py b/aiogram/types/inline_query_result.py index efb14748..84f23ddf 100644 --- a/aiogram/types/inline_query_result.py +++ b/aiogram/types/inline_query_result.py @@ -13,6 +13,7 @@ class InputMessageContent(Serializable): :class:`aiogram.types.InputVenueMessageContent` :class:`aiogram.types.InputContactMessageContent` """ + def to_json(self): return {k: v.to_json() if hasattr(v, 'to_json') else v for k, v in self.__dict__.items() if v is not None and not k.startswith('_')} @@ -74,6 +75,7 @@ class InlineQueryResultArticle(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultarticle """ + def __init__(self, id: str, title: str, input_message_content: InputMessageContent, reply_markup: InlineKeyboardMarkup = None, url: str = None, hide_url: bool = None, description: str = None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): @@ -99,6 +101,7 @@ class InlineQueryResultPhoto(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultphoto """ + def __init__(self, id: str, photo_url: str, thumb_url: str, photo_width: int = None, photo_height: int = None, title: str = None, description: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -126,6 +129,7 @@ class InlineQueryResultGif(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultgif """ + def __init__(self, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None, gif_duration: int = None, title: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -153,6 +157,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif """ + def __init__(self, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None, mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -178,6 +183,7 @@ class InlineQueryResultVideo(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultvideo """ + def __init__(self, id: str, video_url: str, mime_type: str, thumb_url: str, title: str, caption: str = None, video_width: int = None, video_height: int = None, video_duration: int = None, description: str = None, reply_markup: InlineKeyboardMarkup = None, @@ -204,6 +210,7 @@ class InlineQueryResultAudio(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultaudio """ + def __init__(self, id: str, audio_url: str, title: str, caption: str = None, performer: str = None, audio_duration: int = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -229,6 +236,7 @@ class InlineQueryResultVoice(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultvoice """ + def __init__(self, id: str, voice_url: str, title: str, caption: str = None, voice_duration: int = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'voice' @@ -250,6 +258,7 @@ class InlineQueryResultDocument(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultdocument """ + def __init__(self, id: str, title: str, document_url: str, mime_type: str, caption: str = None, description: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None, @@ -276,6 +285,7 @@ class InlineQueryResultLocation(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultlocation """ + def __init__(self, id: str, latitude: float, longitude: float, title: str, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): @@ -299,6 +309,7 @@ class InlineQueryResultVenue(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultvenue """ + def __init__(self, id: str, latitude: float, longitude: float, title: str, address: str, foursquare_id: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None, @@ -328,6 +339,7 @@ class InlineQueryResultContact(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcontact """ + def __init__(self, id: str, phone_number: str, first_name: str, last_name: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): @@ -349,6 +361,7 @@ class InlineQueryResultGame(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultgame """ + def __init__(self, id: str, game_short_name: str, reply_markup: InlineKeyboardMarkup = None): self.type = 'game' self.id: str = id @@ -367,6 +380,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedphoto """ + def __init__(self, id: str, photo_file_id: str, title: str = None, description: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -391,6 +405,7 @@ class InlineQueryResultCachedGif(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedgif """ + def __init__(self, id: str, gif_file_id: str, title: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'gif' @@ -413,6 +428,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif """ + def __init__(self, id: str, mpeg4_file_id: str, title: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'mpeg4_gif' @@ -435,6 +451,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedsticker """ + def __init__(self, id: str, sticker_file_id: str, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'sticker' @@ -455,6 +472,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcacheddocument """ + def __init__(self, id: str, title: str, document_file_id: str, description: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): @@ -477,6 +495,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedvideo """ + def __init__(self, id: str, video_file_id: str, title: str, description: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'video' @@ -500,6 +519,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedvoice """ + def __init__(self, id: str, voice_file_id: str, title: str, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'voice' @@ -521,6 +541,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult): https://core.telegram.org/bots/api#inlinequeryresultcachedaudio """ + def __init__(self, id: str, audio_file_id: str, caption: str = None, reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None): self.type = 'audio' @@ -537,6 +558,7 @@ class InputTextMessageContent(InputMessageContent): https://core.telegram.org/bots/api#inputtextmessagecontent """ + def __init__(self, message_text: str, parse_mode: str = None, disable_web_page_preview: bool = None): self.message_text: str = message_text self.parse_mode: str = parse_mode @@ -549,6 +571,7 @@ class InputLocationMessageContent(InputMessageContent): https://core.telegram.org/bots/api#inputlocationmessagecontent """ + def __init__(self, latitude: float, longitude: float): self.latitude: float = latitude self.longitude: float = longitude @@ -560,6 +583,7 @@ class InputVenueMessageContent(InputMessageContent): https://core.telegram.org/bots/api#inputvenuemessagecontent """ + def __init__(self, latitude: float, longitude: float, title: str, address: str, foursquare_id: str = None): self.latitude: float = latitude self.longitude: float = longitude @@ -574,6 +598,7 @@ class InputContactMessageContent(InputMessageContent): https://core.telegram.org/bots/api#inputcontactmessagecontent """ + def __init__(self, phone_number: str, first_name: str, last_name: str = None): self.phone_number: str = phone_number self.first_name: str = first_name diff --git a/aiogram/types/invoice.py b/aiogram/types/invoice.py index ab668cf4..234bc3f9 100644 --- a/aiogram/types/invoice.py +++ b/aiogram/types/invoice.py @@ -7,6 +7,7 @@ class Invoice(Deserializable): https://core.telegram.org/bots/api#invoice """ + def __init__(self, title, description, start_parameter, currency, total_amount): self.title: str = title self.description: str = description diff --git a/aiogram/types/labeled_price.py b/aiogram/types/labeled_price.py index 001d3af2..11830756 100644 --- a/aiogram/types/labeled_price.py +++ b/aiogram/types/labeled_price.py @@ -7,6 +7,7 @@ class LabeledPrice(Serializable): https://core.telegram.org/bots/api#labeledprice """ + def __init__(self, label, amount): self.label = label self.amount = amount diff --git a/aiogram/types/location.py b/aiogram/types/location.py index 316c24c3..a6225672 100644 --- a/aiogram/types/location.py +++ b/aiogram/types/location.py @@ -7,6 +7,7 @@ class Location(Deserializable): https://core.telegram.org/bots/api#location """ + def __init__(self, longitude, latitude): self.longitude = longitude self.latitude = latitude diff --git a/aiogram/types/order_info.py b/aiogram/types/order_info.py index 7c469455..9328e7ab 100644 --- a/aiogram/types/order_info.py +++ b/aiogram/types/order_info.py @@ -8,6 +8,7 @@ class OrderInfo(Deserializable): https://core.telegram.org/bots/api#orderinfo """ + def __init__(self, name, phone_number, email, shipping_address): self.name: str = name self.phone_number: str = phone_number diff --git a/aiogram/types/photo_size.py b/aiogram/types/photo_size.py index 031d964f..686164d7 100644 --- a/aiogram/types/photo_size.py +++ b/aiogram/types/photo_size.py @@ -7,6 +7,7 @@ class PhotoSize(Deserializable): https://core.telegram.org/bots/api#photosize """ + def __init__(self, file_id, width, height, file_size): self.file_id: str = file_id self.width: int = width diff --git a/aiogram/types/pre_checkout_query.py b/aiogram/types/pre_checkout_query.py index 37557681..bbe96d67 100644 --- a/aiogram/types/pre_checkout_query.py +++ b/aiogram/types/pre_checkout_query.py @@ -9,6 +9,7 @@ class PreCheckoutQuery(Deserializable): https://core.telegram.org/bots/api#precheckoutquery """ + def __init__(self, id, from_user, currency, total_amount, invoice_payload, shipping_option_id, order_info): self.id: str = id self.from_user: User = from_user diff --git a/aiogram/types/reply_keyboard.py b/aiogram/types/reply_keyboard.py index adefd008..bd251f7e 100644 --- a/aiogram/types/reply_keyboard.py +++ b/aiogram/types/reply_keyboard.py @@ -7,6 +7,7 @@ class ReplyKeyboardMarkup(Serializable): https://core.telegram.org/bots/api#replykeyboardmarkup """ + def __init__(self, resize_keyboard=None, one_time_keyboard=None, selective=None, row_width=3): self.resize_keyboard = resize_keyboard self.one_time_keyboard = one_time_keyboard @@ -56,6 +57,7 @@ class KeyboardButton(Serializable): https://core.telegram.org/bots/api#keyboardbutton """ + def __init__(self, text, request_contact=None, request_location=None): self.text = text self.request_contact = request_contact @@ -77,6 +79,7 @@ class ReplyKeyboardRemove(Serializable): https://core.telegram.org/bots/api#replykeyboardremove """ + def __init__(self, selective=None): self.selective = selective diff --git a/aiogram/types/response_parameters.py b/aiogram/types/response_parameters.py index e2aa1fb4..28283b54 100644 --- a/aiogram/types/response_parameters.py +++ b/aiogram/types/response_parameters.py @@ -7,6 +7,7 @@ class ResponseParameters(Deserializable): https://core.telegram.org/bots/api#responseparameters """ + def __init__(self, migrate_to_chat_id, retry_after): self.migrate_to_chat_id = migrate_to_chat_id self.retry_after = retry_after diff --git a/aiogram/types/shipping_address.py b/aiogram/types/shipping_address.py index 3d3f2429..4c467a67 100644 --- a/aiogram/types/shipping_address.py +++ b/aiogram/types/shipping_address.py @@ -7,6 +7,7 @@ class ShippingAddress(Deserializable): https://core.telegram.org/bots/api#shippingaddress """ + def __init__(self, country_code, state, city, street_line1, street_line2, post_code): self.country_code: str = country_code self.state: str = state diff --git a/aiogram/types/shipping_option.py b/aiogram/types/shipping_option.py index 509dcebe..2ff38fab 100644 --- a/aiogram/types/shipping_option.py +++ b/aiogram/types/shipping_option.py @@ -7,6 +7,7 @@ class ShippingOption(Serializable): https://core.telegram.org/bots/api#shippingoption """ + def __init__(self, id, title, prices): self.id = id self.title = title diff --git a/aiogram/types/shipping_query.py b/aiogram/types/shipping_query.py index a51137ed..c9485c86 100644 --- a/aiogram/types/shipping_query.py +++ b/aiogram/types/shipping_query.py @@ -9,6 +9,7 @@ class ShippingQuery(Deserializable): https://core.telegram.org/bots/api#shippingquery """ + def __init__(self, id, from_user, invoice_payload, shipping_address): self.id: str = id self.from_user: User = from_user diff --git a/aiogram/types/sticker.py b/aiogram/types/sticker.py index db3646ad..d57e87da 100644 --- a/aiogram/types/sticker.py +++ b/aiogram/types/sticker.py @@ -1,6 +1,6 @@ from .base import Deserializable -from .photo_size import PhotoSize from .mask_position import MaskPosition +from .photo_size import PhotoSize class Sticker(Deserializable): diff --git a/aiogram/types/successful_payment.py b/aiogram/types/successful_payment.py index 19fc74bd..d5946637 100644 --- a/aiogram/types/successful_payment.py +++ b/aiogram/types/successful_payment.py @@ -8,6 +8,7 @@ class SuccessfulPayment(Deserializable): https://core.telegram.org/bots/api#successfulpayment """ + def __init__(self, currency, total_amount, invoice_payload, shipping_option_id, order_info, telegram_payment_charge_id, provider_payment_charge_id): self.currency: str = currency diff --git a/aiogram/types/user.py b/aiogram/types/user.py index 966a563d..50507d71 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -12,6 +12,7 @@ class User(Deserializable): https://core.telegram.org/bots/api#user """ + def __init__(self, id, first_name, last_name, username, language_code): self.id: int = id self.first_name: str = first_name diff --git a/aiogram/types/user_profile_photos.py b/aiogram/types/user_profile_photos.py index 6f06201f..baf4dcc3 100644 --- a/aiogram/types/user_profile_photos.py +++ b/aiogram/types/user_profile_photos.py @@ -8,6 +8,7 @@ class UserProfilePhotos(Deserializable): https://core.telegram.org/bots/api#userprofilephotos """ + def __init__(self, total_count, photos): self.total_count: int = total_count self.photos: [PhotoSize] = photos diff --git a/aiogram/types/venue.py b/aiogram/types/venue.py index 25b76faf..ca3d2043 100644 --- a/aiogram/types/venue.py +++ b/aiogram/types/venue.py @@ -8,6 +8,7 @@ class Venue(Deserializable): https://core.telegram.org/bots/api#venue """ + def __init__(self, location, title, address, foursquare_id): self.location: Location = location self.title: str = title diff --git a/aiogram/types/video.py b/aiogram/types/video.py index e18f929a..decf9f26 100644 --- a/aiogram/types/video.py +++ b/aiogram/types/video.py @@ -8,6 +8,7 @@ class Video(Deserializable): https://core.telegram.org/bots/api#video """ + def __init__(self, file_id, width, height, duration, thumb, mime_type, file_size): self.file_id: str = file_id self.width: int = width diff --git a/aiogram/types/video_note.py b/aiogram/types/video_note.py index 7e6ca1f9..6c70819d 100644 --- a/aiogram/types/video_note.py +++ b/aiogram/types/video_note.py @@ -8,6 +8,7 @@ class VideoNote(Deserializable): https://core.telegram.org/bots/api#videonote """ + def __init__(self, file_id, length, duration, thumb, file_size): self.file_id: str = file_id self.length: int = length diff --git a/aiogram/types/voice.py b/aiogram/types/voice.py index 692abd8c..8cd4f730 100644 --- a/aiogram/types/voice.py +++ b/aiogram/types/voice.py @@ -7,6 +7,7 @@ class Voice(Deserializable): https://core.telegram.org/bots/api#voice """ + def __init__(self, file_id, duration, mime_type, file_size): self.file_id: str = file_id self.duration: int = duration diff --git a/aiogram/types/webhook_info.py b/aiogram/types/webhook_info.py index de0f6f4c..51eb9229 100644 --- a/aiogram/types/webhook_info.py +++ b/aiogram/types/webhook_info.py @@ -1,5 +1,3 @@ -import datetime - from .base import Deserializable @@ -9,6 +7,7 @@ class WebhookInfo(Deserializable): https://core.telegram.org/bots/api#webhookinfo """ + def __init__(self, url, has_custom_certificate, pending_update_count, last_error_date, last_error_message, max_connections, allowed_updates): self.url: str = url diff --git a/aiogram/utils/emoji.py b/aiogram/utils/emoji.py index 07faff56..e47624ba 100644 --- a/aiogram/utils/emoji.py +++ b/aiogram/utils/emoji.py @@ -1,5 +1,9 @@ +from .deprecated import warn_deprecated + try: import emoji + + warn_deprecated('Use emoji module instead that util') except ImportError: raise ImportError('Need install "emoji" module.') diff --git a/aiogram/utils/json.py b/aiogram/utils/json.py index 6ae6b6c2..a83f3712 100644 --- a/aiogram/utils/json.py +++ b/aiogram/utils/json.py @@ -1,8 +1,10 @@ try: import ujson as json + IS_UJSON = True except ImportError: import json + IS_UJSON = False diff --git a/aiogram/utils/versions.py b/aiogram/utils/versions.py index 73ffe988..b606998a 100644 --- a/aiogram/utils/versions.py +++ b/aiogram/utils/versions.py @@ -4,6 +4,7 @@ import subprocess from .helper import Helper, HelperMode, Item + # Based on https://github.com/django/django/blob/master/django/utils/version.py