Skip to content

Commit c68c169

Browse files
committed
Fix imports of typing stuff for python3.10, 3.9, etc
Change-Id: I453fc4c08294f103840d8c0a557c71fbfd340bb1
1 parent 40508ed commit c68c169

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

awaitlet/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
from typing import Callable
88
from typing import Coroutine
99
from typing import TYPE_CHECKING
10-
from typing import TypeGuard
1110
from typing import TypeVar
1211

1312
from greenlet import greenlet
1413

14+
from .util.typing import TypeGuard
15+
1516
_T = TypeVar("_T")
1617

1718

awaitlet/util/testing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from typing import Any
77
from typing import Coroutine
88
from typing import Literal
9-
from typing import Self
109
from typing import TypeVar
1110
from typing import Union
1211

1312
from .langhelpers import _pytest_fn_decorator
13+
from .typing import Self
1414

1515
_T = TypeVar("_T", bound=Any)
1616

awaitlet/util/typing.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from __future__ import annotations
2+
3+
if True: # zimports removes the tailing comments
4+
from typing_extensions import (
5+
Literal as Literal,
6+
) # 3.8 but has bugs before 3.10
7+
from typing_extensions import Self as Self # 3.11
8+
from typing_extensions import TypeGuard as TypeGuard # 3.10

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ classifiers = [
2121
]
2222

2323
dependencies = [
24-
"greenlet"
24+
"greenlet",
25+
"typing-extensions >= 4.6.0",
2526
]
2627

2728
[tool.setuptools.packages]

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ enable-extensions = G
44
# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
55
per-file-ignores =
66
**/__init__.py:F401
7+
awaitlet/util/typing.py:F401
78
ignore =
89
A003,A005
910
D,

0 commit comments

Comments
 (0)