Skip to content

Commit 1c0f307

Browse files
authored
Merge pull request #1474 from Predeactor/master
Fix incomplete typehinting for PathLike
2 parents f23994e + 2303971 commit 1c0f307

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ Contributors are:
4646
-Robert Westman <robert _at_ byteflux.io>
4747
-Hugo van Kemenade
4848
-Hiroki Tokunaga <tokusan441 _at_ gmail.com>
49+
-Julien Mauroy <pro.julien.mauroy _at_ gmail.com>
4950
Portions derived from other open source works and are clearly marked.

git/types.py

Lines changed: 2 additions & 9 deletions
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,
@@ -46,9 +41,9 @@
4641

4742
if sys.version_info[:2] < (3, 9):
4843
PathLike = Union[str, os.PathLike]
49-
elif sys.version_info[:2] >= (3, 9):
44+
else:
5045
# os.PathLike only becomes subscriptable from Python 3.9 onwards
51-
PathLike = Union[str, os.PathLike]
46+
PathLike = Union[str, os.PathLike[str]]
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy