From 51e1f2ccaeb63a867e7df01d2068d676d5c88847 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Tue, 30 Mar 2021 08:09:53 -0400 Subject: [PATCH] Make type annotations safe for Python 3.7. --- sprockets_statsd/statsd.py | 2 +- tests/helpers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sprockets_statsd/statsd.py b/sprockets_statsd/statsd.py index 43cd329..b35e605 100644 --- a/sprockets_statsd/statsd.py +++ b/sprockets_statsd/statsd.py @@ -333,7 +333,7 @@ class Processor: logger: logging.Logger protocol: typing.Optional[StatsdProtocol] - queue: asyncio.Queue[bytes] + queue: asyncio.Queue _create_transport: typing.Callable[[], typing.Coroutine[ typing.Any, typing.Any, typing.Tuple[asyncio.BaseTransport, StatsdProtocol]]] diff --git a/tests/helpers.py b/tests/helpers.py index b9bb6da..91a21ef 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -20,7 +20,7 @@ class StatsdServer(asyncio.DatagramProtocol, asyncio.Protocol): self.running = asyncio.Event() self.client_connected = asyncio.Semaphore(value=0) self.message_received = asyncio.Semaphore(value=0) - self.transports: list[asyncio.BaseTransport] = [] + self.transports: typing.List[asyncio.BaseTransport] = [] self._buffer = io.BytesIO() @@ -34,7 +34,7 @@ class StatsdServer(asyncio.DatagramProtocol, asyncio.Protocol): self.port, reuse_port=True) self.server = server - listening_sock = typing.cast(list[socket.socket], + listening_sock = typing.cast(typing.List[socket.socket], server.sockets)[0] self.host, self.port = listening_sock.getsockname() self.running.set()