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

Commite19abe7

Browse files
authored
Merge pull request#1634 from madebylydia/main
feat: full typing for "progress" parameter in Repo class
2 parents1c8310d +9f74c05 commite19abe7

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

‎git/repo/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
PathLike,
6161
Lit_config_levels,
6262
Commit_ish,
63+
CallableProgress,
6364
Tree_ish,
6465
assert_never,
6566
)
@@ -1258,7 +1259,7 @@ def _clone(
12581259
defclone(
12591260
self,
12601261
path:PathLike,
1261-
progress:Optional[Callable]=None,
1262+
progress:Optional[CallableProgress]=None,
12621263
multi_options:Optional[List[str]]=None,
12631264
allow_unsafe_protocols:bool=False,
12641265
allow_unsafe_options:bool=False,
@@ -1297,7 +1298,7 @@ def clone_from(
12971298
cls,
12981299
url:PathLike,
12991300
to_path:PathLike,
1300-
progress:Optional[Callable]=None,
1301+
progress:CallableProgress=None,
13011302
env:Optional[Mapping[str,str]]=None,
13021303
multi_options:Optional[List[str]]=None,
13031304
allow_unsafe_protocols:bool=False,

‎git/types.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,39 @@
88
fromtypingimport (
99
Dict,
1010
NoReturn,
11-
Sequence,
11+
SequenceasSequence,
1212
Tuple,
1313
Union,
1414
Any,
15+
Optional,
16+
Callable,
1517
TYPE_CHECKING,
1618
TypeVar,
1719
)# noqa: F401
1820

19-
ifsys.version_info[:2]>= (3,8):
21+
ifsys.version_info>= (3,8):
2022
fromtypingimport (
2123
Literal,
22-
SupportsIndex,
2324
TypedDict,
2425
Protocol,
26+
SupportsIndexasSupportsIndex,
2527
runtime_checkable,
2628
)# noqa: F401
2729
else:
2830
fromtyping_extensionsimport (
2931
Literal,
30-
SupportsIndex,# noqa: F401
32+
SupportsIndexasSupportsIndex,
3133
TypedDict,
3234
Protocol,
3335
runtime_checkable,
3436
)# noqa: F401
3537

36-
# if sys.version_info[:2] >= (3, 10):
38+
# if sys.version_info >= (3, 10):
3739
# from typing import TypeGuard # noqa: F401
3840
# else:
3941
# from typing_extensions import TypeGuard # noqa: F401
4042

41-
42-
ifsys.version_info[:2]< (3,9):
43-
PathLike=Union[str,os.PathLike]
44-
else:
45-
# os.PathLike only becomes subscriptable from Python 3.9 onwards
46-
PathLike=Union[str,os.PathLike[str]]
43+
PathLike=Union[str,"os.PathLike[str]"]
4744

4845
ifTYPE_CHECKING:
4946
fromgit.repoimportRepo
@@ -62,6 +59,9 @@
6259

6360
Lit_config_levels=Literal["system","global","user","repository"]
6461

62+
# Progress parameter type alias -----------------------------------------
63+
64+
CallableProgress=Optional[Callable[[int,Union[str,float],Union[str,float,None],str],None]]
6565

6666
# def is_config_level(inp: str) -> TypeGuard[Lit_config_levels]:
6767
# # return inp in get_args(Lit_config_level) # only py >= 3.8

‎requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ pytest-icdiff
1010
# pytest-profiling
1111

1212

13-
tox
13+
tox

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp