summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2022-08-08 10:32:33 +0800
committerGitHub <noreply@github.com>2022-08-08 10:32:33 +0800
commit1c0f307322594012db4564585ee33caa09c1944c (patch)
treead62ac4085fe9ebf77c037b3e1e951e89751faad
parentf23994e3bdd20164a1365296153044d5c7718fef (diff)
parent2303971c73f4ceda1d2d50e55a7c9d99864b883e (diff)
downloadgitpython-1c0f307322594012db4564585ee33caa09c1944c.tar.gz
Merge pull request #1474 from Predeactor/master
Fix incomplete typehinting for PathLike
-rw-r--r--AUTHORS1
-rw-r--r--git/types.py11
2 files changed, 3 insertions, 9 deletions
diff --git a/AUTHORS b/AUTHORS
index 546818f5..2ac02e5f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -46,4 +46,5 @@ Contributors are:
-Robert Westman <robert _at_ byteflux.io>
-Hugo van Kemenade
-Hiroki Tokunaga <tokusan441 _at_ gmail.com>
+-Julien Mauroy <pro.julien.mauroy _at_ gmail.com>
Portions derived from other open source works and are clearly marked.
diff --git a/git/types.py b/git/types.py
index a4e839ba..9064ecbf 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,
@@ -46,9 +41,9 @@ else:
if sys.version_info[:2] < (3, 9):
PathLike = Union[str, os.PathLike]
-elif sys.version_info[:2] >= (3, 9):
+else:
# os.PathLike only becomes subscriptable from Python 3.9 onwards
- PathLike = Union[str, os.PathLike]
+ PathLike = Union[str, os.PathLike[str]]
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):