From 60bf8aa0ddad313afed10cb59ec70f9dcb75f440 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Wed, 2 May 2018 18:24:23 +0300 Subject: [PATCH] Cleanup --- aiogram/__init__.py | 1 + aiogram/dispatcher/handler.py | 2 +- aiogram/utils/exceptions.py | 3 +-- aiogram/utils/safe.py | 16 ---------------- 4 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 aiogram/utils/safe.py diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 3fcd215c..3cfa182e 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -1,6 +1,7 @@ import asyncio from .bot import Bot +from .dispatcher import Dispatcher try: import uvloop diff --git a/aiogram/dispatcher/handler.py b/aiogram/dispatcher/handler.py index 139c6011..8d75273f 100644 --- a/aiogram/dispatcher/handler.py +++ b/aiogram/dispatcher/handler.py @@ -1,5 +1,5 @@ -from aiogram.utils import context from .filters import check_filters +from ..utils import context class SkipHandler(BaseException): diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index cbefa859..015720c7 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -85,7 +85,7 @@ class _MatchErrorMixin: @classmethod def throw(cls): """ - Throw a error + Throw error :raise: this """ @@ -124,7 +124,6 @@ class BadRequest(TelegramAPIError, _MatchErrorMixin): class MessageError(BadRequest): __group = True - pass class MessageNotModified(MessageError): diff --git a/aiogram/utils/safe.py b/aiogram/utils/safe.py deleted file mode 100644 index 7ef5b8fc..00000000 --- a/aiogram/utils/safe.py +++ /dev/null @@ -1,16 +0,0 @@ -import typing - - -async def safe(coro: typing.Coroutine) -> (bool, typing.Any): - """ - Safety execute coroutine - - Status - returns True if success otherwise False - - :param coro: - :return: status and result - """ - try: - return True, await coro - except Exception as e: - return False, e