From 70327d335888fa6b3a9e258f94228801f52380ca Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Tue, 21 Jun 2022 20:33:29 +0200 Subject: [PATCH] Add missing string annotations --- uvicorn/middleware/proxy_headers.py | 2 +- uvicorn/middleware/wsgi.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/uvicorn/middleware/proxy_headers.py b/uvicorn/middleware/proxy_headers.py index ff090cf2ff..4b62cf209e 100644 --- a/uvicorn/middleware/proxy_headers.py +++ b/uvicorn/middleware/proxy_headers.py @@ -50,7 +50,7 @@ async def __call__( self, scope: "Scope", receive: "ASGIReceiveCallable", send: "ASGISendCallable" ) -> None: if scope["type"] in ("http", "websocket"): - scope = cast(Union[HTTPScope, WebSocketScope], scope) + scope = cast(Union["HTTPScope", "WebSocketScope"], scope) client_addr: Optional[Tuple[str, int]] = scope.get("client") client_host = client_addr[0] if client_addr else None diff --git a/uvicorn/middleware/wsgi.py b/uvicorn/middleware/wsgi.py index e9f7fa1884..9a79a3baf6 100644 --- a/uvicorn/middleware/wsgi.py +++ b/uvicorn/middleware/wsgi.py @@ -79,7 +79,10 @@ def __init__(self, app: WSGIApp, workers: int = 10): self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=workers) async def __call__( - self, scope: HTTPScope, receive: ASGIReceiveCallable, send: ASGISendCallable + self, + scope: "HTTPScope", + receive: "ASGIReceiveCallable", + send: "ASGISendCallable", ) -> None: assert scope["type"] == "http" instance = WSGIResponder(self.app, self.executor, scope)