|
8 | 8 | from typing import ( |
9 | 9 | Dict, |
10 | 10 | NoReturn, |
11 | | - Sequence, |
| 11 | + Sequence as Sequence, |
12 | 12 | Tuple, |
13 | 13 | Union, |
14 | 14 | Any, |
| 15 | + Optional, |
| 16 | + Callable, |
15 | 17 | TYPE_CHECKING, |
16 | 18 | TypeVar, |
17 | 19 | ) # noqa: F401 |
18 | 20 |
|
19 | | -if sys.version_info[:2] >= (3, 8): |
| 21 | +if sys.version_info >= (3, 8): |
20 | 22 | from typing import ( |
21 | 23 | Literal, |
22 | | - SupportsIndex, |
23 | 24 | TypedDict, |
24 | 25 | Protocol, |
| 26 | + SupportsIndex as SupportsIndex, |
25 | 27 | runtime_checkable, |
26 | 28 | ) # noqa: F401 |
27 | 29 | else: |
28 | 30 | from typing_extensions import ( |
29 | 31 | Literal, |
30 | | - SupportsIndex, # noqa: F401 |
| 32 | + SupportsIndex as SupportsIndex, |
31 | 33 | TypedDict, |
32 | 34 | Protocol, |
33 | 35 | runtime_checkable, |
34 | 36 | ) # noqa: F401 |
35 | 37 |
|
36 | | -# if sys.version_info[:2] >= (3, 10): |
| 38 | +# if sys.version_info >= (3, 10): |
37 | 39 | # from typing import TypeGuard # noqa: F401 |
38 | 40 | # else: |
39 | 41 | # from typing_extensions import TypeGuard # noqa: F401 |
40 | 42 |
|
41 | | - |
42 | | -if sys.version_info[:2] < (3, 9): |
43 | | - PathLike = Union[str, os.PathLike] |
44 | | -else: |
45 | | - # os.PathLike only becomes subscriptable from Python 3.9 onwards |
46 | | - PathLike = Union[str, os.PathLike[str]] |
| 43 | +PathLike = Union[str, "os.PathLike[str]"] |
47 | 44 |
|
48 | 45 | if TYPE_CHECKING: |
49 | 46 | from git.repo import Repo |
|
62 | 59 |
|
63 | 60 | Lit_config_levels = Literal["system", "global", "user", "repository"] |
64 | 61 |
|
| 62 | +# Progress parameter type alias ----------------------------------------- |
| 63 | + |
| 64 | +CallableProgress = Optional[Callable[[int, Union[str, float], Union[str, float, None], str], None]] |
65 | 65 |
|
66 | 66 | # def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]: |
67 | 67 | # # return inp in get_args(Lit_config_level) # only py >= 3.8 |
|
0 commit comments