|
2 | 2 | from typing import Any, Callable, Dict, List, TypeVar, Union
|
3 | 3 |
|
4 | 4 | if sys.version_info >= (3, 8):
|
5 |
| - from typing import Literal, Protocol, TypedDict, get_args |
| 5 | + from typing import Literal, Protocol, TypedDict |
6 | 6 | else:
|
7 |
| - from typing_extensions import Literal, Protocol, TypedDict, get_args |
| 7 | + from typing_extensions import Literal, Protocol, TypedDict |
8 | 8 |
|
9 | 9 | if sys.version_info >= (3, 9):
|
10 | 10 | from typing import Annotated
|
|
17 | 17 | from typing_extensions import NotRequired
|
18 | 18 |
|
19 | 19 |
|
20 |
| -# Even though `get_origin` was added in Python 3.8, it only handles Annotated correctly on 3.10. |
| 20 | +# Even though `get_args` and `get_origin` were added in Python 3.8, they only handle Annotated correctly on 3.10. |
21 | 21 | # So for python < 3.10 we use the backport from typing_extensions.
|
22 | 22 | if sys.version_info >= (3, 10):
|
23 |
| - from typing import TypeAlias, get_origin |
| 23 | + from typing import TypeAlias, get_args, get_origin |
24 | 24 | else:
|
25 |
| - from typing_extensions import TypeAlias, get_origin |
| 25 | + from typing_extensions import TypeAlias, get_args, get_origin |
26 | 26 |
|
27 | 27 | AnyCallableT = TypeVar("AnyCallableT", bound=Callable[..., Any]) # noqa: VNE001
|
28 | 28 | # JSON primitives only, mypy doesn't support recursive tho
|
|
0 commit comments