mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
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 09448f1b71.
This commit is contained in:
parent
4e78ce155b
commit
d925ebf411
1 changed files with 3 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
|
import typing
|
||||||
from contextvars import ContextVar
|
from contextvars import ContextVar
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional, Iterable, List
|
|
||||||
|
|
||||||
ctx_data = ContextVar('ctx_handler_data')
|
ctx_data = ContextVar('ctx_handler_data')
|
||||||
current_handler = ContextVar('current_handler')
|
current_handler = ContextVar('current_handler')
|
||||||
|
|
@ -40,7 +40,7 @@ class Handler:
|
||||||
self.dispatcher = dispatcher
|
self.dispatcher = dispatcher
|
||||||
self.once = once
|
self.once = once
|
||||||
|
|
||||||
self.handlers: List[Handler.HandlerObj] = []
|
self.handlers: typing.List[Handler.HandlerObj] = []
|
||||||
self.middleware_key = middleware_key
|
self.middleware_key = middleware_key
|
||||||
|
|
||||||
def register(self, handler, filters=None, index=None):
|
def register(self, handler, filters=None, index=None):
|
||||||
|
|
@ -135,4 +135,4 @@ class Handler:
|
||||||
class HandlerObj:
|
class HandlerObj:
|
||||||
handler: callable
|
handler: callable
|
||||||
spec: inspect.FullArgSpec
|
spec: inspect.FullArgSpec
|
||||||
filters: Optional[Iterable[FilterObj]] = None
|
filters: typing.Optional[typing.Iterable[FilterObj]] = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue