From 3f6596fbebff3c4bc98dda3137dc9a484ecfedf7 Mon Sep 17 00:00:00 2001 From: Dan Trickey Date: Sun, 19 Jul 2020 14:18:15 +0100 Subject: [PATCH 1/2] Add type annotation to WebSocketEndpoint.encoding --- starlette/endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starlette/endpoints.py b/starlette/endpoints.py index 2ba68c04b..b0e08fab0 100644 --- a/starlette/endpoints.py +++ b/starlette/endpoints.py @@ -43,7 +43,7 @@ async def method_not_allowed(self, request: Request) -> Response: class WebSocketEndpoint: - encoding = None # May be "text", "bytes", or "json". + encoding: Optional[str] = None # May be "text", "bytes", or "json". def __init__(self, scope: Scope, receive: Receive, send: Send) -> None: assert scope["type"] == "websocket" From 144c942c0c371bfca126ffb9d6bc1745c294e831 Mon Sep 17 00:00:00 2001 From: Dan Trickey Date: Mon, 20 Jul 2020 14:08:21 +0100 Subject: [PATCH 2/2] Update endpoints.py --- starlette/endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starlette/endpoints.py b/starlette/endpoints.py index b0e08fab0..1071fc354 100644 --- a/starlette/endpoints.py +++ b/starlette/endpoints.py @@ -43,7 +43,7 @@ async def method_not_allowed(self, request: Request) -> Response: class WebSocketEndpoint: - encoding: Optional[str] = None # May be "text", "bytes", or "json". + encoding: typing.Optional[str] = None # May be "text", "bytes", or "json". def __init__(self, scope: Scope, receive: Receive, send: Send) -> None: assert scope["type"] == "websocket"