Change EventListener to subclass NamedTuple
This commit is contained in:
parent
ace6f26a29
commit
8f2b367e0b
@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, TypedDict, Any, Optional, List, TypeVar, Type, Dict, Callable, Coroutine
|
from typing import TYPE_CHECKING, TypedDict, Any, Optional, List, TypeVar, Type, Dict, Callable, Coroutine, NamedTuple
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections import namedtuple, deque
|
from collections import deque
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
@ -81,7 +81,11 @@ class WebSocketClosure(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
EventListener = namedtuple('EventListener', 'predicate event result future')
|
class EventListener(NamedTuple):
|
||||||
|
predicate: Callable[[Dict[str, Any]], bool]
|
||||||
|
event: str
|
||||||
|
result: Optional[Callable[[Dict[str, Any]], Any]]
|
||||||
|
future: asyncio.Future
|
||||||
|
|
||||||
|
|
||||||
class GatewayRatelimiter:
|
class GatewayRatelimiter:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user