Skip to content

Commit

Permalink
Add missing string annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Jun 21, 2022
1 parent 18e9915 commit f929963
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion uvicorn/middleware/proxy_headers.py
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion uvicorn/middleware/wsgi.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/http/h11_impl.py
Expand Up @@ -493,7 +493,7 @@ async def send(self, message: "ASGISendEvent") -> None:
if message_type != "http.response.body":
msg = "Expected ASGI message 'http.response.body', but got '%s'."
raise RuntimeError(msg % message_type)
message = cast(HTTPResponseBodyEvent, message)
message = cast("HTTPResponseBodyEvent", message)

body = message.get("body", b"")
more_body = message.get("more_body", False)
Expand Down

0 comments on commit f929963

Please sign in to comment.