33import logging
44import os
55import stat
6- from typing import List
76from unittest import SkipTest
87import uuid
98
2726from git .objects .base import IndexObject , Object
2827from git .objects .util import Traversable
2928from git .util import (
30- Iterable ,
29+ IterableObj ,
3130 join_path_native ,
3231 to_native_path_linux ,
3332 RemoteProgress ,
3433 rmtree ,
35- unbare_repo
34+ unbare_repo ,
35+ IterableList
3636)
3737from git .util import HIDE_WINDOWS_KNOWN_ERRORS
3838
4747)
4848
4949
50+ # typing ----------------------------------------------------------------------
51+
52+
53+ # -----------------------------------------------------------------------------
54+
5055__all__ = ["Submodule" , "UpdateProgress" ]
5156
5257
@@ -74,7 +79,7 @@ class UpdateProgress(RemoteProgress):
7479# IndexObject comes via util module, its a 'hacky' fix thanks to pythons import
7580# mechanism which cause plenty of trouble of the only reason for packages and
7681# modules is refactoring - subpackages shouldn't depend on parent packages
77- class Submodule (IndexObject , Iterable , Traversable ):
82+ class Submodule (IndexObject , IterableObj , Traversable ):
7883
7984 """Implements access to a git submodule. They are special in that their sha
8085 represents a commit in the submodule's repository which is to be checked out
@@ -136,12 +141,12 @@ def _set_cache_(self, attr):
136141 # END handle attribute name
137142
138143 @classmethod
139- def _get_intermediate_items (cls , item : 'Submodule' ) -> List ['Submodule' ]: # type: ignore
144+ def _get_intermediate_items (cls , item : 'Submodule' ) -> IterableList ['Submodule' ]:
140145 """:return: all the submodules of our module repository"""
141146 try :
142147 return cls .list_items (item .module ())
143148 except InvalidGitRepositoryError :
144- return []
149+ return IterableList ( '' )
145150 # END handle intermediate items
146151
147152 @classmethod
@@ -1153,7 +1158,7 @@ def name(self):
11531158 """
11541159 return self ._name
11551160
1156- def config_reader (self ):
1161+ def config_reader (self ) -> SectionConstraint :
11571162 """
11581163 :return: ConfigReader instance which allows you to qurey the configuration values
11591164 of this submodule, as provided by the .gitmodules file
@@ -1163,7 +1168,7 @@ def config_reader(self):
11631168 :raise IOError: If the .gitmodules file/blob could not be read"""
11641169 return self ._config_parser_constrained (read_only = True )
11651170
1166- def children (self ):
1171+ def children (self ) -> IterableList [ 'Submodule' ] :
11671172 """
11681173 :return: IterableList(Submodule, ...) an iterable list of submodules instances
11691174 which are children of this submodule or 0 if the submodule is not checked out"""
0 commit comments