From 3c99b171f642a8ba4d983cc8d649ae808915e731 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Sun, 11 Feb 2018 12:50:28 +0300 Subject: [PATCH] Minor typos fixes --- aiogram/bot/api.py | 5 ++--- aiogram/bot/bot.py | 8 ++++---- aiogram/types/audio.py | 10 +++++----- aiogram/types/chat.py | 4 ++-- aiogram/types/fields.py | 6 +++--- aiogram/types/message_entity.py | 4 ++-- examples/media_group.py | 4 ++-- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 1b4728c1..6b952f39 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -1,13 +1,12 @@ -import asyncio -import logging import os +import logging from http import HTTPStatus import aiohttp from .. import types -from ..utils import exceptions from ..utils import json +from ..utils import exceptions from ..utils.helper import Helper, HelperMode, Item # Main aiogram logger diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 392ef179..61c215d9 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -60,7 +60,7 @@ class Bot(BaseBot): typing.Union[typing.List[base.String], None] = None) -> typing.List[types.Update]: """ Use this method to receive incoming updates using long polling (wiki). - + Notes 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response. @@ -132,7 +132,7 @@ class Bot(BaseBot): async def get_webhook_info(self) -> types.WebhookInfo: """ Use this method to get current webhook status. Requires no parameters. - + If the bot is using getUpdates, will return an object with the url field empty. Source: https://core.telegram.org/bots/api#getwebhookinfo @@ -180,7 +180,7 @@ class Bot(BaseBot): :type chat_id: :obj:`typing.Union[base.Integer, base.String]` :param text: Text of the message to be sent :type text: :obj:`base.String` - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, + :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. :type parse_mode: :obj:`typing.Union[base.String, None]` :param disable_web_page_preview: Disables link previews for links in this message @@ -190,7 +190,7 @@ class Bot(BaseBot): :param reply_to_message_id: If the message is a reply, ID of the original message :type reply_to_message_id: :obj:`typing.Union[base.Integer, None]` :param reply_markup: Additional interface options. - :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, + :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` :return: On success, the sent Message is returned. :rtype: :obj:`types.Message` diff --git a/aiogram/types/audio.py b/aiogram/types/audio.py index 8615cfdd..7946c28a 100644 --- a/aiogram/types/audio.py +++ b/aiogram/types/audio.py @@ -18,8 +18,8 @@ class Audio(base.TelegramObject, mixins.Downloadable): def __hash__(self): return hash(self.file_id) + \ - self.duration + \ - hash(self.performer) + \ - hash(self.title) + \ - hash(self.mime_type) + \ - self.file_size + self.duration + \ + hash(self.performer) + \ + hash(self.title) + \ + hash(self.mime_type) + \ + self.file_size diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index dcb38876..a696e90e 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -40,7 +40,7 @@ class Chat(base.TelegramObject): @property def mention(self): """ - Get mention if dialog have username or full name if this is Private dialog otherwise None + Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned """ if self.username: return '@' + self.username @@ -51,7 +51,7 @@ class Chat(base.TelegramObject): @property def user_url(self): if self.type != ChatType.PRIVATE: - raise TypeError('This property available only in private chats.') + raise TypeError('`user_url` property is only available in private chats!') return f"tg://user?id={self.id}" diff --git a/aiogram/types/fields.py b/aiogram/types/fields.py index 401d562c..fc12dd2e 100644 --- a/aiogram/types/fields.py +++ b/aiogram/types/fields.py @@ -15,8 +15,8 @@ class BaseField(metaclass=abc.ABCMeta): :param base: class for child element :param default: default value - :param alias: alias name (for e.g. field named 'from' must be has name 'from_user' - ('from' is builtin Python keyword) + :param alias: alias name (for e.g. field 'from' has to be named 'from_user' + as 'from' is a builtin Python keyword """ self.base_object = base self.default = default @@ -34,7 +34,7 @@ class BaseField(metaclass=abc.ABCMeta): def get_value(self, instance): """ - Get value for current object instance + Get value for the current object instance :param instance: :return: diff --git a/aiogram/types/message_entity.py b/aiogram/types/message_entity.py index 24e6da5f..46733f3a 100644 --- a/aiogram/types/message_entity.py +++ b/aiogram/types/message_entity.py @@ -18,8 +18,8 @@ class MessageEntity(base.TelegramObject): def _apply(self, text, func): return text[:self.offset] + \ - func(text[self.offset:self.offset + self.length]) + \ - text[self.offset + self.length:] + func(text[self.offset:self.offset + self.length]) + \ + text[self.offset + self.length:] def apply_md(self, text): """ diff --git a/examples/media_group.py b/examples/media_group.py index 0f4efc1b..0545cec9 100644 --- a/examples/media_group.py +++ b/examples/media_group.py @@ -14,13 +14,13 @@ dp = Dispatcher(bot) @dp.message_handler(commands=['start']) async def send_welcome(message: types.Message): - # So... By first i want to send something like that: + # So... At first I want to send something like this: await message.reply("Do you want to see many pussies? Are you ready?") # And wait few seconds... await asyncio.sleep(1) - # Good bots always must be send chat actions. Or not. + # Good bots should send chat actions. Or not. await ChatActions.upload_photo() # Create media group