Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit475a7e1

Browse files
author
Predeactor
committed
Fix typehinting for PathLike
1 parentf23994e commit475a7e1

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

‎git/types.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,18 @@
66
importos
77
importsys
88
fromtypingimport (
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
ifsys.version_info[:2]>= (3,8):
2320
fromtypingimport (
24-
Final,
2521
Literal,
2622
SupportsIndex,
2723
TypedDict,
@@ -30,7 +26,6 @@
3026
)# noqa: F401
3127
else:
3228
fromtyping_extensionsimport (
33-
Final,
3429
Literal,
3530
SupportsIndex,# noqa: F401
3631
TypedDict,
@@ -45,10 +40,10 @@
4540

4641

4742
ifsys.version_info[:2]< (3,9):
48-
PathLike=Union[str,os.PathLike]
49-
elifsys.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
ifTYPE_CHECKING:
5449
fromgit.repoimportRepo
@@ -92,8 +87,6 @@ def assert_never(inp: NoReturn, raise_error: bool = True, exc: Union[Exception,
9287
raiseValueError(f"An unhandled Literal ({inp}) in an if/else chain was found")
9388
else:
9489
raiseexc
95-
else:
96-
pass
9790

9891

9992
classFiles_TD(TypedDict):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp