From f45286b3b2d54f8b79087b060858042b2488688b Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 12 Jul 2024 09:37:09 +0200 Subject: [PATCH] Pick changes suggested by `pyupgrade --py38-plus`. Other changes were ignored, on purpose. --- src/websockets/sync/messages.py | 3 +-- tests/legacy/test_client_server.py | 2 +- tests/legacy/utils.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/websockets/sync/messages.py b/src/websockets/sync/messages.py index a6e78e7f..6cbff259 100644 --- a/src/websockets/sync/messages.py +++ b/src/websockets/sync/messages.py @@ -53,8 +53,7 @@ def __init__(self) -> None: # value marking the end of the message, superseding message_complete. # Stream data from frames belonging to the same message. - # Remove quotes around type when dropping Python < 3.9. - self.chunks_queue: "queue.SimpleQueue[Data | None] | None" = None + self.chunks_queue: queue.SimpleQueue[Data | None] | None = None # This flag marks the end of the connection. self.closed = False diff --git a/tests/legacy/test_client_server.py b/tests/legacy/test_client_server.py index 51a74734..c3808657 100644 --- a/tests/legacy/test_client_server.py +++ b/tests/legacy/test_client_server.py @@ -65,7 +65,7 @@ async def default_handler(ws): await ws.wait_closed() await asyncio.sleep(2 * MS) else: - await ws.send((await ws.recv())) + await ws.send(await ws.recv()) async def redirect_request(path, headers, test, status): diff --git a/tests/legacy/utils.py b/tests/legacy/utils.py index 4a21dcae..28bc90df 100644 --- a/tests/legacy/utils.py +++ b/tests/legacy/utils.py @@ -79,6 +79,6 @@ def assertDeprecationWarnings(self, recorded_warnings, expected_warnings): for recorded in recorded_warnings: self.assertEqual(type(recorded.message), DeprecationWarning) self.assertEqual( - set(str(recorded.message) for recorded in recorded_warnings), + {str(recorded.message) for recorded in recorded_warnings}, set(expected_warnings), )