|
1 | 1 | from os import PathLike |
2 | 2 | import sys |
3 | | -from typing import TYPE_CHECKING, Any, BinaryIO, Mapping, Optional, Sequence, Union |
| 3 | +from typing import TYPE_CHECKING, Any, BinaryIO, Optional, Union |
4 | 4 |
|
5 | 5 | if sys.version_info >= (3, 9): # pragma: no cover |
| 6 | + from collections.abc import Mapping, Sequence |
| 7 | + |
6 | 8 | _LZMAFilenameType = Union[str, bytes, PathLike[str], PathLike[bytes], BinaryIO] |
7 | | - from typing import Literal |
8 | 9 | else: # pragma: no cover |
9 | | - _LZMAFilenameType = Union[str, bytes, PathLike, BinaryIO] |
| 10 | + from typing import Mapping, Sequence |
10 | 11 |
|
11 | | - class Literal: |
12 | | - def __class_getitem__(cls, items: Any) -> str: |
13 | | - return f"Literal{list(items)}" |
| 12 | + _LZMAFilenameType = Union[str, bytes, PathLike, BinaryIO] |
14 | 13 |
|
15 | 14 |
|
16 | 15 | if sys.version_info >= (3, 8): # pragma: no cover |
17 | | - from typing import Protocol |
| 16 | + from typing import Literal, Protocol |
18 | 17 | else: # pragma: no cover |
19 | | - # ducktype Protocol |
20 | | - # we could require typing-extensions package instead |
21 | | - Protocol = object |
| 18 | + from typing_extensions import Literal, Protocol |
| 19 | + |
22 | 20 |
|
23 | 21 | if TYPE_CHECKING: # pragma: no cover |
24 | 22 | # avoid circular dependency |
|
0 commit comments