Skip to content

Fix incomplete typehinting for PathLike #1474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 2 additions & 9 deletions git/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -30,7 +26,6 @@
) # noqa: F401
else:
from typing_extensions import (
Final,
Literal,
SupportsIndex, # noqa: F401
TypedDict,
Expand All @@ -46,9 +41,9 @@

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
Expand Down Expand Up @@ -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):
Expand Down