From 4e68dd746d2c929c0d4e2577742244139ff30693 Mon Sep 17 00:00:00 2001 From: pgjones Date: Sun, 19 May 2024 15:03:08 +0100 Subject: [PATCH] Fix mypy issues With the latest versions of mypy and Blinker. --- src/quart_trio/app.py | 8 +++++--- src/quart_trio/asgi.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/quart_trio/app.py b/src/quart_trio/app.py index 81200b3..0f619a8 100644 --- a/src/quart_trio/app.py +++ b/src/quart_trio/app.py @@ -165,7 +165,7 @@ async def full_dispatch_request( omits this argument. """ try: - await request_started.send_async(self, _sync_wrapper=self.ensure_async) + await request_started.send_async(self, _sync_wrapper=self.ensure_async) # type: ignore result: ResponseReturnValue | HTTPException | None result = await self.preprocess_request(request_context) @@ -219,7 +219,9 @@ async def full_dispatch_websocket( the Flask convention. """ try: - await websocket_started.send_async(self, _sync_wrapper=self.ensure_async) + await websocket_started.send_async( + self, _sync_wrapper=self.ensure_async # type: ignore + ) result: ResponseReturnValue | HTTPException | None result = await self.preprocess_websocket(websocket_context) @@ -291,7 +293,7 @@ async def shutdown(self) -> None: raise RuntimeError("While serving generator didn't terminate") except Exception as error: await got_serving_exception.send_async( - self, _sync_wrapper=self.ensure_async, exception=error + self, _sync_wrapper=self.ensure_async, exception=error # type: ignore ) self.log_exception(sys.exc_info()) raise diff --git a/src/quart_trio/asgi.py b/src/quart_trio/asgi.py index bb3346e..702447f 100644 --- a/src/quart_trio/asgi.py +++ b/src/quart_trio/asgi.py @@ -1,5 +1,5 @@ -from functools import partial import sys +from functools import partial from typing import cast, Optional, TYPE_CHECKING, Union from urllib.parse import urlparse @@ -77,7 +77,9 @@ async def handle_messages( # type: ignore event = await receive() if event["type"] == "websocket.receive": message = event.get("bytes") or event["text"] - await websocket_received.send_async(message, _sync_wrapper=self.app.ensure_async) + await websocket_received.send_async( + message, _sync_wrapper=self.app.ensure_async # type: ignore + ) await self.send_channel.send(message) elif event["type"] == "websocket.disconnect": break