From c70789eadbade5c43fe7179c7d3c6233ca515ebc Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 12:48:09 +0300 Subject: [PATCH 1/9] Typos fix in quick_start.rst --- docs/source/quick_start.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/quick_start.rst b/docs/source/quick_start.rst index c5ff7e9c..9f35c45a 100644 --- a/docs/source/quick_start.rst +++ b/docs/source/quick_start.rst @@ -4,15 +4,15 @@ Quick start Simple template --------------- -By first step you need import all modules +At first you have to import all necessary modules .. code-block:: python3 - from aiogram import Bot + from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.utils import executor -In next step you you can initialize bot and dispatcher instances. +Then you have to initialize bot and dispatcher instances. Bot token you can get from `@BotFather `_ @@ -21,7 +21,7 @@ Bot token you can get from `@BotFather `_ bot = Bot(token='BOT TOKEN HERE') dp = Dispatcher(bot) -And next: all bots is needed command for starting interaction with bot. Register first command handler: +Next step: interaction with bots starts with one command. Register your first command handler: .. code-block:: python3 @@ -29,7 +29,7 @@ And next: all bots is needed command for starting interaction with bot. Registe async def send_welcome(message: types.Message): await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.") -And last step - run long polling. +Last step: run long polling. .. code-block:: python3 @@ -41,7 +41,7 @@ Summary .. code-block:: python3 - from aiogram import Bot + from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.utils import executor From f708f0c930a28866a5378a32d69f50774ecb89bf Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 13:12:41 +0300 Subject: [PATCH 2/9] Typos fix in docs/source/bot/* --- docs/source/bot/base.rst | 2 +- docs/source/bot/extended.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/bot/base.rst b/docs/source/bot/base.rst index 5fe71588..2c5943fd 100644 --- a/docs/source/bot/base.rst +++ b/docs/source/bot/base.rst @@ -1,7 +1,7 @@ BaseBot ======= -This class is base of bot. In BaseBot implemented only methods for interactions with Telegram Bot API. +This class is the base class for bot. BaseBot implements only methods for interaction with Telegram Bot API. .. autoclass:: aiogram.bot.base.BaseBot :members: diff --git a/docs/source/bot/extended.rst b/docs/source/bot/extended.rst index 71ed12ea..b689f24f 100644 --- a/docs/source/bot/extended.rst +++ b/docs/source/bot/extended.rst @@ -1,8 +1,8 @@ Bot object ========== -That is extended (and recommended for usage) bot class based on BaseBot class. -You can use instance of that bot in :obj:`aiogram.dispatcher.Dispatcher` +This is extended (and recommended for use) bot class based on BaseBot class. +You can use an instance of this bot in :obj:`aiogram.dispatcher.Dispatcher` .. autoclass:: aiogram.bot.bot.Bot :members: From ad651a8425a56453e00e5ca02a11af0796b70c73 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 13:20:36 +0300 Subject: [PATCH 3/9] Added info about RethinkDB storage (not sure if it has to be done manually) --- docs/source/contrib/storages.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/source/contrib/storages.rst b/docs/source/contrib/storages.rst index 6d6c8508..a4f17085 100644 --- a/docs/source/contrib/storages.rst +++ b/docs/source/contrib/storages.rst @@ -16,3 +16,10 @@ Redis storage .. automodule:: aiogram.contrib.fsm_storage.redis :members: :show-inheritance: + +RethinkDB storage +----------------- + +.. automodule:: aiogram.contrib.fsm_storage.rethinkdb + :members: + :show-inheritance: From 5c6008ac6b39ee13761935868e5be6e68f764069 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 13:25:10 +0300 Subject: [PATCH 4/9] Typos fix in docs/source/dispatcher/* --- docs/source/dispatcher/filters.rst | 2 +- docs/source/dispatcher/storage.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/dispatcher/filters.rst b/docs/source/dispatcher/filters.rst index 54b45d15..f01965b3 100644 --- a/docs/source/dispatcher/filters.rst +++ b/docs/source/dispatcher/filters.rst @@ -1,7 +1,7 @@ Filters ------- -In this module stored builtin filters for dispatcher. +This module stores builtin filters for dispatcher. .. automodule:: aiogram.dispatcher.filters :members: diff --git a/docs/source/dispatcher/storage.rst b/docs/source/dispatcher/storage.rst index 6551978f..7ab4b5c1 100644 --- a/docs/source/dispatcher/storage.rst +++ b/docs/source/dispatcher/storage.rst @@ -1,7 +1,7 @@ Storages -------- -In this module stored base of storage's for finite-state machine. +This module stores storage base for finite-state machine. .. automodule:: aiogram.dispatcher.storage :members: From 7f169ad7b975f1afa88dcc2c2cd772aec476963b Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 13:37:17 +0300 Subject: [PATCH 5/9] Typos fix in docs/source --- docs/source/index.rst | 14 +++++++------- docs/source/install.rst | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 527a4409..18152c49 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -27,7 +27,7 @@ Welcome to aiogram's documentation! :alt: MIT License -**aiogram** is are pretty simple and fully asynchronously library for `Telegram Bot API `_ written in Python 3.6 with `asyncio `_ and `aiohttp `_. It helps to make your bots more faster and simpler. +**aiogram** is a pretty simple and fully asynchronous library for `Telegram Bot API `_ written in Python 3.6 with `asyncio `_ and `aiohttp `_. It helps you to make your bots faster and simpler. Official aiogram resources @@ -45,17 +45,17 @@ Features -------- - Asynchronous -- Be awesome -- Make things faster -- Have `FSM `_ -- Can reply into webhook +- Awesome +- Makes things faster +- Has `FSM `_ +- Supports webhook Contribute ---------- -- `Issue Tracker `_ -- `Source Code `_ +- `Issue Tracker `_ +- `Source Code `_ Contents diff --git a/docs/source/install.rst b/docs/source/install.rst index 9d11a6ea..016cba94 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -1,8 +1,8 @@ Installation Guide ================== -From PIP --------- +Using PIP +--------- .. code-block:: bash $ pip install -U aiogram @@ -11,5 +11,6 @@ From sources ------------ .. code-block:: bash - $ git clone https://bitbucket.org/illemius/aiogram.git + $ git clone https://github.com/aiogram/aiogram.git + $ cd aiogram $ python setup.py install From f68629f68bb326f09849916aaed648aaf298f5c6 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 13:50:37 +0300 Subject: [PATCH 6/9] Typo fix, PEP8 formatting fix --- aiogram/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 8f9a0594..8ea10ddb 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -4,7 +4,8 @@ try: from .bot import Bot except ImportError as e: if e.name == 'aiohttp': - warnings.warn('Dependencies is not installed!', category=ImportWarning) + warnings.warn('Dependencies are not installed!', + category=ImportWarning) else: raise From 72db167fa32eb12f23503caa4d53fff3f8f465aa Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 15:48:21 +0300 Subject: [PATCH 7/9] Minor aiogram/utils/* typos fixes + PEP8 formatting fixes + super minor code change --- aiogram/utils/context.py | 2 +- aiogram/utils/executor.py | 9 +++++---- aiogram/utils/helper.py | 7 ++++--- aiogram/utils/markdown.py | 13 ++++++++----- aiogram/utils/versions.py | 6 ++++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/aiogram/utils/context.py b/aiogram/utils/context.py index dfef6882..b31c71c0 100644 --- a/aiogram/utils/context.py +++ b/aiogram/utils/context.py @@ -1,5 +1,5 @@ """ -Need setup task factory: +You need to setup task factory: >>> from aiogram.utils import context >>> loop = asyncio.get_event_loop() >>> loop.set_task_factory(context.task_factory) diff --git a/aiogram/utils/executor.py b/aiogram/utils/executor.py index b1fec35e..ed8947eb 100644 --- a/aiogram/utils/executor.py +++ b/aiogram/utils/executor.py @@ -51,7 +51,8 @@ def start_pooling(*args, **kwargs): return start_polling(*args, **kwargs) -def start_polling(dispatcher, *, loop=None, skip_updates=False, on_startup=None, on_shutdown=None): +def start_polling(dispatcher, *, loop=None, skip_updates=False, + on_startup=None, on_shutdown=None): log.warning('Start bot with long-polling.') if loop is None: loop = dispatcher.loop @@ -59,7 +60,7 @@ def start_polling(dispatcher, *, loop=None, skip_updates=False, on_startup=None, loop.set_task_factory(context.task_factory) try: - loop.run_until_complete(_startup(dispatcher, skip_updates=skip_updates, callback=on_startup)) + loop.run_until_complete(_startup(dispatcher, skip_updates, on_startup)) loop.create_task(dispatcher.start_polling(reset_webhook=True)) loop.run_forever() except (KeyboardInterrupt, SystemExit): @@ -69,8 +70,8 @@ def start_polling(dispatcher, *, loop=None, skip_updates=False, on_startup=None, log.warning("Goodbye!") -def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None, on_startup=None, on_shutdown=None, - check_ip=False, **kwargs): +def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None, + on_startup=None, on_shutdown=None, check_ip=False, **kwargs): log.warning('Start bot with webhook.') if loop is None: loop = dispatcher.loop diff --git a/aiogram/utils/helper.py b/aiogram/utils/helper.py index 5b708f18..eeabca7c 100644 --- a/aiogram/utils/helper.py +++ b/aiogram/utils/helper.py @@ -137,7 +137,8 @@ class Item: """ Helper item - If value is not configured it will be generated automatically based on variable name + If a value is not provided, + it will be automatically generated based on a variable's name """ def __init__(self, value=None): @@ -156,7 +157,7 @@ class Item: class ListItem(Item): """ - This item always is list + This item is always a list You can use &, | and + operators for that. """ @@ -179,7 +180,7 @@ class ItemsList(list): """ Patch for default list - This class provide +, &, |, +=, &=, |= operators for extending the list + This class provides +, &, |, +=, &=, |= operators for extending the list """ def __init__(self, *seq): diff --git a/aiogram/utils/markdown.py b/aiogram/utils/markdown.py index da08a400..1e64c106 100644 --- a/aiogram/utils/markdown.py +++ b/aiogram/utils/markdown.py @@ -18,6 +18,8 @@ HTML_QUOTES_MAP = { '"': '"' } +_HQS = HTML_QUOTES_MAP.keys() # HQS for HTML QUOTES SYMBOLS + def _join(*content, sep=' '): return sep.join(map(str, content)) @@ -38,21 +40,22 @@ def quote_html(content): """ Quote HTML symbols - All <, > and & symbols that are not a part of a tag or an HTML entity - must be replaced with the corresponding HTML entities (< with <, > with > and & with &). + All <, >, & and " symbols that are not a part of a tag or + an HTML entity must be replaced with the corresponding HTML entities + (< with < > with > & with & and " with "). :param content: str :return: str """ new_content = '' for symbol in content: - new_content += HTML_QUOTES_MAP[symbol] if symbol in '<>&"' else symbol + new_content += HTML_QUOTES_MAP[symbol] if symbol in _HQS else symbol return new_content def text(*content, sep=' '): """ - Join all elements with separator + Join all elements with a separator :param content: :param sep: @@ -168,7 +171,7 @@ def hlink(title, url): :param url: :return: """ - return "{1}".format(url, quote_html(title)) + return '{1}'.format(url, quote_html(title)) def escape_md(*content, sep=' '): diff --git a/aiogram/utils/versions.py b/aiogram/utils/versions.py index f1eb00c3..b621bc62 100644 --- a/aiogram/utils/versions.py +++ b/aiogram/utils/versions.py @@ -9,7 +9,8 @@ from .helper import Helper, HelperMode, Item class Version: - def __init__(self, major=0, minor=0, maintenance=0, stage='final', build=0): + def __init__(self, major=0, minor=0, + maintenance=0, stage='final', build=0): self.__raw_version = None self.__version = None @@ -86,7 +87,8 @@ class Version: if git_changeset: sub = '.dev{0}'.format(git_changeset) elif version[3] != Stage.FINAL: - mapping = {Stage.ALPHA: 'a', Stage.BETA: 'b', Stage.RC: 'rc', Stage.DEV: 'dev'} + mapping = {Stage.ALPHA: 'a', Stage.BETA: 'b', + Stage.RC: 'rc', Stage.DEV: 'dev'} sub = mapping[version[3]] + str(version[4]) return str(main + sub) From 3a7cb02acdbd44d3d2aa8993723dea546b009c2e Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 17:02:52 +0300 Subject: [PATCH 8/9] Is a pretty simple... --- README.md | 2 +- README.rst | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 47fce350..1bc5260f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Github issues](https://img.shields.io/github/issues/aiogram/aiogram.svg?style=flat-square)](https://github.com/aiogram/aiogram/issues) [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) -**aiogram** is are pretty simple and fully asynchronously library for [Telegram Bot API](https://core.telegram.org/bots/api) written in Python 3.6 with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://github.com/aio-libs/aiohttp). It helps to make your bots more faster and simpler. +**aiogram** is a pretty simple and fully asynchronous library for [Telegram Bot API](https://core.telegram.org/bots/api) written in Python 3.6 with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://github.com/aio-libs/aiohttp). It helps you to make your bots faster and simpler. You can [read the docs here](http://aiogram.readthedocs.io/en/latest/). diff --git a/README.rst b/README.rst index 4500460b..57a18bc7 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ AIOGramBot :alt: MIT License -**aiogram** is are pretty simple and fully asynchronously library for `Telegram Bot API `_ written in Python 3.6 with `asyncio `_ and `aiohttp `_. It helps to make your bots more faster and simpler. +**aiogram** is a pretty simple and fully asynchronous library for `Telegram Bot API `_ written in Python 3.6 with `asyncio `_ and `aiohttp `_. It helps you to make your bots faster and simpler. You can `read the docs here `_. diff --git a/setup.py b/setup.py index 9200f803..04da67d2 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ setup( license='MIT', author='Alex Root Junior', author_email='jroot.junior@gmail.com', - description='Is are pretty simple and fully asynchronously library for Telegram Bot API', + description='Is a pretty simple and fully asynchronous library for Telegram Bot API', long_description=get_description(), classifiers=[ VERSION.pypi_development_status, # Automated change classifier by build stage From 57327679e21e37689cd9a309de4222c25a655cea Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Tue, 23 Jan 2018 17:51:59 +0300 Subject: [PATCH 9/9] Very bad mistake fix --- docs/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 18152c49..e3f1c8b5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -48,7 +48,7 @@ Features - Awesome - Makes things faster - Has `FSM `_ -- Supports webhook +- Can reply into webhook. (In other words `make requests in response to updates `_) Contribute