summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPredeactor <predeactor0@gmail.com>2022-07-31 21:58:46 +0200
committerPredeactor <predeactor0@gmail.com>2022-07-31 21:58:46 +0200
commit475a7e1d5a311310f70f155d0e57decd7290aba5 (patch)
treebb41fad15e6ad408f6c2a185b8351c8420b27bb3
parentf23994e3bdd20164a1365296153044d5c7718fef (diff)
downloadgitpython-475a7e1d5a311310f70f155d0e57decd7290aba5.tar.gz
Fix typehinting for PathLike
-rw-r--r--git/types.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/git/types.py b/git/types.py
index a4e839ba..adda514d 100644
--- a/git/types.py
+++ b/git/types.py
@@ -6,22 +6,18 @@
import os
import sys
from typing import (
- Callable,
Dict,
NoReturn,
Sequence,
Tuple,
Union,
Any,
- Iterator, # noqa: F401
- NamedTuple,
TYPE_CHECKING,
TypeVar,
) # noqa: F401
if sys.version_info[:2] >= (3, 8):
from typing import (
- Final,
Literal,
SupportsIndex,
TypedDict,
@@ -30,7 +26,6 @@ if sys.version_info[:2] >= (3, 8):
) # noqa: F401
else:
from typing_extensions import (
- Final,
Literal,
SupportsIndex, # noqa: F401
TypedDict,
@@ -45,10 +40,10 @@ else:
if sys.version_info[:2] < (3, 9):
- PathLike = Union[str, os.PathLike]
-elif sys.version_info[:2] >= (3, 9):
+ PathLike = Union[str, bytes, os.PathLike]
+else:
# os.PathLike only becomes subscriptable from Python 3.9 onwards
- PathLike = Union[str, os.PathLike]
+ PathLike = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]
if TYPE_CHECKING:
from git.repo import Repo
@@ -92,8 +87,6 @@ def assert_never(inp: NoReturn, raise_error: bool = True, exc: Union[Exception,
raise ValueError(f"An unhandled Literal ({inp}) in an if/else chain was found")
else:
raise exc
- else:
- pass
class Files_TD(TypedDict):