Typehint gateway.py #44

Merged
paris-ci merged 8 commits from pr7422 into 2.0 2021-09-02 20:50:19 +00:00
Showing only changes of commit 8f2b367e0b - Show all commits

View File

@@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE.
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
from collections import namedtuple, deque
from collections import deque
import concurrent.futures
import logging
import struct
@@ -81,7 +81,11 @@ class WebSocketClosure(Exception):
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: