1313from git .exc import GitCommandError
1414from git .util import (
1515 LazyMixin ,
16- Iterable ,
16+ IterableObj ,
1717 IterableList ,
1818 RemoteProgress ,
1919 CallableRemoteProgress ,
@@ -107,7 +107,7 @@ def to_progress_instance(progress: Union[Callable[..., Any], RemoteProgress, Non
107107 return progress
108108
109109
110- class PushInfo (object ):
110+ class PushInfo (IterableObj , object ):
111111 """
112112 Carries information about the result of a push operation of a single head::
113113
@@ -220,7 +220,7 @@ def _from_line(cls, remote: 'Remote', line: str) -> 'PushInfo':
220220 return PushInfo (flags , from_ref , to_ref_string , remote , old_commit , summary )
221221
222222
223- class FetchInfo (object ):
223+ class FetchInfo (IterableObj , object ):
224224
225225 """
226226 Carries information about the results of a fetch operation of a single head::
@@ -421,7 +421,7 @@ def _from_line(cls, repo: 'Repo', line: str, fetch_line: str) -> 'FetchInfo':
421421 return cls (remote_local_ref , flags , note , old_commit , local_remote_ref )
422422
423423
424- class Remote (LazyMixin , Iterable ):
424+ class Remote (LazyMixin , IterableObj ):
425425
426426 """Provides easy read and write access to a git remote.
427427
@@ -580,18 +580,18 @@ def urls(self) -> Iterator[str]:
580580 raise ex
581581
582582 @property
583- def refs (self ) -> IterableList :
583+ def refs (self ) -> IterableList [ RemoteReference ] :
584584 """
585585 :return:
586586 IterableList of RemoteReference objects. It is prefixed, allowing
587587 you to omit the remote path portion, i.e.::
588588 remote.refs.master # yields RemoteReference('/refs/remotes/origin/master')"""
589- out_refs = IterableList (RemoteReference ._id_attribute_ , "%s/" % self .name )
589+ out_refs : IterableList [ RemoteReference ] = IterableList (RemoteReference ._id_attribute_ , "%s/" % self .name )
590590 out_refs .extend (RemoteReference .list_items (self .repo , remote = self .name ))
591591 return out_refs
592592
593593 @property
594- def stale_refs (self ) -> IterableList :
594+ def stale_refs (self ) -> IterableList [ Reference ] :
595595 """
596596 :return:
597597 IterableList RemoteReference objects that do not have a corresponding
@@ -606,7 +606,7 @@ def stale_refs(self) -> IterableList:
606606 as well. This is a fix for the issue described here:
607607 https://github.com/gitpython-developers/GitPython/issues/260
608608 """
609- out_refs = IterableList (RemoteReference ._id_attribute_ , "%s/" % self .name )
609+ out_refs : IterableList [ RemoteReference ] = IterableList (RemoteReference ._id_attribute_ , "%s/" % self .name )
610610 for line in self .repo .git .remote ("prune" , "--dry-run" , self ).splitlines ()[2 :]:
611611 # expecting
612612 # * [would prune] origin/new_branch
@@ -681,11 +681,12 @@ def update(self, **kwargs: Any) -> 'Remote':
681681 return self
682682
683683 def _get_fetch_info_from_stderr (self , proc : TBD ,
684- progress : Union [Callable [..., Any ], RemoteProgress , None ]) -> IterableList :
684+ progress : Union [Callable [..., Any ], RemoteProgress , None ]
685+ ) -> IterableList ['FetchInfo' ]:
685686 progress = to_progress_instance (progress )
686687
687688 # skip first line as it is some remote info we are not interested in
688- output = IterableList ('name' )
689+ output : IterableList [ 'FetchInfo' ] = IterableList ('name' )
689690
690691 # lines which are no progress are fetch info lines
691692 # this also waits for the command to finish
@@ -741,15 +742,15 @@ def _get_fetch_info_from_stderr(self, proc: TBD,
741742 return output
742743
743744 def _get_push_info (self , proc : TBD ,
744- progress : Union [Callable [..., Any ], RemoteProgress , None ]) -> IterableList :
745+ progress : Union [Callable [..., Any ], RemoteProgress , None ]) -> IterableList [ PushInfo ] :
745746 progress = to_progress_instance (progress )
746747
747748 # read progress information from stderr
748749 # we hope stdout can hold all the data, it should ...
749750 # read the lines manually as it will use carriage returns between the messages
750751 # to override the previous one. This is why we read the bytes manually
751752 progress_handler = progress .new_message_handler ()
752- output = IterableList ('push_infos' )
753+ output : IterableList [ PushInfo ] = IterableList ('push_infos' )
753754
754755 def stdout_handler (line : str ) -> None :
755756 try :
@@ -785,7 +786,7 @@ def _assert_refspec(self) -> None:
785786
786787 def fetch (self , refspec : Union [str , List [str ], None ] = None ,
787788 progress : Union [Callable [..., Any ], None ] = None ,
788- verbose : bool = True , ** kwargs : Any ) -> IterableList :
789+ verbose : bool = True , ** kwargs : Any ) -> IterableList [ FetchInfo ] :
789790 """Fetch the latest changes for this remote
790791
791792 :param refspec:
@@ -832,7 +833,7 @@ def fetch(self, refspec: Union[str, List[str], None] = None,
832833
833834 def pull (self , refspec : Union [str , List [str ], None ] = None ,
834835 progress : Union [Callable [..., Any ], None ] = None ,
835- ** kwargs : Any ) -> IterableList :
836+ ** kwargs : Any ) -> IterableList [ FetchInfo ] :
836837 """Pull changes from the given branch, being the same as a fetch followed
837838 by a merge of branch with your local branch.
838839
@@ -853,7 +854,7 @@ def pull(self, refspec: Union[str, List[str], None] = None,
853854
854855 def push (self , refspec : Union [str , List [str ], None ] = None ,
855856 progress : Union [Callable [..., Any ], None ] = None ,
856- ** kwargs : Any ) -> IterableList :
857+ ** kwargs : Any ) -> IterableList [ PushInfo ] :
857858 """Push changes from source branch in refspec to target branch in refspec.
858859
859860 :param refspec: see 'fetch' method
0 commit comments