Skip to content

Commit 19dafe3

Browse files
committed
Add types to Remote. update() _get_fetch_info_from_stderr() _get_push_info()
1 parent 519ddea commit 19dafe3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

git/remote.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
# typing-------------------------------------------------------
3838

39-
from typing import Any, Callable, Dict, Iterator, Optional, TYPE_CHECKING, Union, cast, overload
39+
from typing import Any, Callable, Dict, Iterator, List, Optional, TYPE_CHECKING, Union, cast, overload
4040

41-
from git.types import PathLike, Literal
41+
from git.types import PathLike, Literal, TBD
4242

4343
if TYPE_CHECKING:
4444
from git.repo.base import Repo
@@ -666,7 +666,7 @@ def rename(self, new_name: str) -> 'Remote':
666666

667667
return self
668668

669-
def update(self, **kwargs):
669+
def update(self, **kwargs: Any) -> 'Remote':
670670
"""Fetch all changes for this remote, including new branches which will
671671
be forced in ( in case your local remote branch is not part the new remote branches
672672
ancestry anymore ).
@@ -680,7 +680,8 @@ def update(self, **kwargs):
680680
self.repo.git.remote(scmd, self.name, **kwargs)
681681
return self
682682

683-
def _get_fetch_info_from_stderr(self, proc, progress):
683+
def _get_fetch_info_from_stderr(self, proc: TBD,
684+
progress: Union[Callable[..., Any], RemoteProgress, None]) -> IterableList:
684685
progress = to_progress_instance(progress)
685686

686687
# skip first line as it is some remote info we are not interested in
@@ -739,7 +740,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
739740
log.warning("Git informed while fetching: %s", err_line.strip())
740741
return output
741742

742-
def _get_push_info(self, proc, progress):
743+
def _get_push_info(self, proc: TBD,
744+
progress: Union[Callable[..., Any], RemoteProgress, None]) -> List[PushInfo]:
743745
progress = to_progress_instance(progress)
744746

745747
# read progress information from stderr
@@ -749,7 +751,7 @@ def _get_push_info(self, proc, progress):
749751
progress_handler = progress.new_message_handler()
750752
output = []
751753

752-
def stdout_handler(line):
754+
def stdout_handler(line: str) -> None:
753755
try:
754756
output.append(PushInfo._from_line(self, line))
755757
except ValueError:

0 commit comments

Comments
 (0)