Skip to content

Commit

Permalink
Fixed type annotations when run with mypy on Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jan 23, 2021
1 parent cf99cb7 commit 33be2df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions asgiref/typing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import sys
from typing import Awaitable, Callable, Dict, Iterable, Optional, Tuple, Type, Union

try:
if sys.version_info >= (3, 8):
from typing import Literal, Protocol, TypedDict
except ImportError:
from typing_extensions import Literal, Protocol, TypedDict # type: ignore
else:
from typing_extensions import Literal, Protocol, TypedDict


class ASGIVersions(TypedDict):
Expand All @@ -24,7 +25,7 @@ class HTTPScope(TypedDict):
headers: Iterable[Tuple[bytes, bytes]]
client: Optional[Tuple[str, int]]
server: Optional[Tuple[str, Optional[int]]]
extensions: Dict[str, dict]
extensions: Dict[str, Dict[object, object]]


class WebsocketScope(TypedDict):
Expand All @@ -40,7 +41,7 @@ class WebsocketScope(TypedDict):
client: Optional[Tuple[str, int]]
server: Optional[Tuple[str, Optional[int]]]
subprotocols: Iterable[str]
extensions: Dict[str, dict]
extensions: Dict[str, Dict[object, object]]


class LifespanScope(TypedDict):
Expand Down

0 comments on commit 33be2df

Please sign in to comment.