Skip to content

Commit 475a7e1

Browse files
author
Predeactor
committed
Fix typehinting for PathLike
1 parent f23994e commit 475a7e1

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

‎git/types.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,18 @@
66
import os
77
import sys
88
from typing import (
9-
Callable,
109
Dict,
1110
NoReturn,
1211
Sequence,
1312
Tuple,
1413
Union,
1514
Any,
16-
Iterator, # noqa: F401
17-
NamedTuple,
1815
TYPE_CHECKING,
1916
TypeVar,
2017
) # noqa: F401
2118

2219
if sys.version_info[:2] >= (3, 8):
2320
from typing import (
24-
Final,
2521
Literal,
2622
SupportsIndex,
2723
TypedDict,
@@ -30,7 +26,6 @@
3026
) # noqa: F401
3127
else:
3228
from typing_extensions import (
33-
Final,
3429
Literal,
3530
SupportsIndex, # noqa: F401
3631
TypedDict,
@@ -45,10 +40,10 @@
4540

4641

4742
if sys.version_info[:2] < (3, 9):
48-
PathLike = Union[str, os.PathLike]
49-
elif sys.version_info[:2] >= (3, 9):
43+
PathLike = Union[str, bytes, os.PathLike]
44+
else:
5045
# os.PathLike only becomes subscriptable from Python 3.9 onwards
51-
PathLike = Union[str, os.PathLike]
46+
PathLike = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]
5247

5348
if TYPE_CHECKING:
5449
from git.repo import Repo
@@ -92,8 +87,6 @@ def assert_never(inp: NoReturn, raise_error: bool = True, exc: Union[Exception,
9287
raise ValueError(f"An unhandled Literal ({inp}) in an if/else chain was found")
9388
else:
9489
raise exc
95-
else:
96-
pass
9790

9891

9992
class Files_TD(TypedDict):

0 commit comments

Comments
 (0)