Skip to content

Commit 0fd0efa

Browse files
refactor: seperate out Progress type
1 parent a6dcd1e commit 0fd0efa

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

git/remote.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ def _from_line(cls, repo: "Repo", line: str, fetch_line: str) -> "FetchInfo":
516516
def iter_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> NoReturn: # -> Iterator['FetchInfo']:
517517
raise NotImplementedError
518518

519+
type Progress = Union[RemoteProgress, "UpdateProgress", Callable[..., RemoteProgress], None]
519520

520521
class Remote(LazyMixin, IterableObj):
521522
"""Provides easy read and write access to a git remote.
@@ -872,7 +873,7 @@ def update(self, **kwargs: Any) -> "Remote":
872873
def _get_fetch_info_from_stderr(
873874
self,
874875
proc: "Git.AutoInterrupt",
875-
progress: Union[Callable[..., Any], RemoteProgress, None],
876+
progress: Progress,
876877
kill_after_timeout: Union[None, float] = None,
877878
) -> IterableList["FetchInfo"]:
878879
progress = to_progress_instance(progress)
@@ -997,10 +998,11 @@ def _assert_refspec(self) -> None:
997998
finally:
998999
config.release()
9991000

1001+
10001002
def fetch(
10011003
self,
10021004
refspec: Union[str, List[str], None] = None,
1003-
progress: Union[RemoteProgress, None, "UpdateProgress"] = None,
1005+
progress: Progress = None,
10041006
verbose: bool = True,
10051007
kill_after_timeout: Union[None, float] = None,
10061008
allow_unsafe_protocols: bool = False,
@@ -1078,10 +1080,11 @@ def fetch(
10781080
self.repo.odb.update_cache()
10791081
return res
10801082

1083+
10811084
def pull(
10821085
self,
10831086
refspec: Union[str, List[str], None] = None,
1084-
progress: Union[RemoteProgress, "UpdateProgress", None] = None,
1087+
progress: Progress = None,
10851088
kill_after_timeout: Union[None, float] = None,
10861089
allow_unsafe_protocols: bool = False,
10871090
allow_unsafe_options: bool = False,
@@ -1135,7 +1138,7 @@ def pull(
11351138
def push(
11361139
self,
11371140
refspec: Union[str, List[str], None] = None,
1138-
progress: Union[RemoteProgress, "UpdateProgress", Callable[..., RemoteProgress], None] = None,
1141+
progress: Progress = None,
11391142
kill_after_timeout: Union[None, float] = None,
11401143
allow_unsafe_protocols: bool = False,
11411144
allow_unsafe_options: bool = False,

0 commit comments

Comments
 (0)