From 5b3a4d08a96526d9032f21acb7f7a42d1e37c64d Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Wed, 9 Dec 2020 20:18:05 +0200 Subject: [PATCH] Remove loop arguments from deprecated functions, ready for newer Python versions. --- aiologstash/base_handler.py | 4 ++-- aiologstash/tcp_handler.py | 4 ++-- tests/test_emit.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aiologstash/base_handler.py b/aiologstash/base_handler.py index d11af78..2bb7bca 100644 --- a/aiologstash/base_handler.py +++ b/aiologstash/base_handler.py @@ -33,7 +33,7 @@ def __init__( self._thread_id = threading.get_ident() self._queue: asyncio.Queue[Union[logging.LogRecord, None]] = asyncio.Queue( - maxsize=qsize, loop=self._loop + maxsize=qsize ) super().__init__(level=level) @@ -113,7 +113,7 @@ async def _reconnect(self) -> None: delay = self._random.gauss( self._reconnect_delay, self._reconnect_jitter ) - await asyncio.sleep(delay, loop=self._loop) + await asyncio.sleep(delay) def _serialize(self, record: logging.LogRecord) -> bytes: for key, value in self._extra.items(): diff --git a/aiologstash/tcp_handler.py b/aiologstash/tcp_handler.py index b1d5938..a1ce8a2 100644 --- a/aiologstash/tcp_handler.py +++ b/aiologstash/tcp_handler.py @@ -36,7 +36,7 @@ def __init__( async def _connect(self) -> None: self._reader, self._writer = await asyncio.open_connection( - self._host, self._port, loop=self._loop, **self._kwargs + self._host, self._port, **self._kwargs ) async def _send(self, data: bytes) -> None: @@ -47,6 +47,6 @@ async def _send(self, data: bytes) -> None: async def _disconnect(self) -> None: if self._writer is not None: self._writer.close() - await asyncio.sleep(0, loop=self._loop) # wait for writer closing + await asyncio.sleep(0) # wait for writer closing self._reader = None self._writer = None diff --git a/tests/test_emit.py b/tests/test_emit.py index 4d2fdd8..2bae896 100644 --- a/tests/test_emit.py +++ b/tests/test_emit.py @@ -60,7 +60,7 @@ async def coro(record): m.side_effect = [OSError(), None] log.info("Msg 1") - await asyncio.sleep(0.1, loop=loop) + await asyncio.sleep(0.1) m_log.info.assert_has_calls( [mock.call("Transport disconnected"), mock.call("Transport reconnected")] )