From d925ebf411b389c5b403712cbcc831f78d24d806 Mon Sep 17 00:00:00 2001 From: Andrew <11490628+andrew000@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:49:43 +0300 Subject: [PATCH] Refactor annotation style in handler.py | [Rework handler once (rejected)] (#996) * Changed type annotation style to `typing.*` in dispatcher\handler.py * Added a new argument `once` to the error handler registration that decides whether the following callback notifications should be made after a successful callback notification before in loop * Revert "Added a new argument `once` to the error handler registration that decides whether the following callback notifications should be made after a successful callback notification before in loop" This reverts commit 09448f1b7189fb1f332aded69bcfb15607058b18. --- aiogram/dispatcher/handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aiogram/dispatcher/handler.py b/aiogram/dispatcher/handler.py index 85d7731d..e6b89380 100644 --- a/aiogram/dispatcher/handler.py +++ b/aiogram/dispatcher/handler.py @@ -1,7 +1,7 @@ import inspect +import typing from contextvars import ContextVar from dataclasses import dataclass -from typing import Optional, Iterable, List ctx_data = ContextVar('ctx_handler_data') current_handler = ContextVar('current_handler') @@ -40,7 +40,7 @@ class Handler: self.dispatcher = dispatcher self.once = once - self.handlers: List[Handler.HandlerObj] = [] + self.handlers: typing.List[Handler.HandlerObj] = [] self.middleware_key = middleware_key def register(self, handler, filters=None, index=None): @@ -135,4 +135,4 @@ class Handler: class HandlerObj: handler: callable spec: inspect.FullArgSpec - filters: Optional[Iterable[FilterObj]] = None + filters: typing.Optional[typing.Iterable[FilterObj]] = None