@@ -136,7 +136,9 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> 'TreeMod
136136
137137 sha = to_bin_sha (sha )
138138 index = self ._index_by_name (name )
139- item : T_Tree_cache = (sha , mode , name ) # type: ignore ## use Typeguard from typing-extensions 3.10.0
139+
140+ assert isinstance (sha , bytes ) and isinstance (mode , int ) and isinstance (name , str )
141+ item = cast (T_Tree_cache , (sha , mode , name )) # use Typeguard from typing-extensions 3.10.0
140142 if index == - 1 :
141143 self ._cache .append (item )
142144 else :
@@ -151,14 +153,17 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> 'TreeMod
151153 # END handle name exists
152154 return self
153155
154- def add_unchecked (self , binsha , mode , name ) :
156+ def add_unchecked (self , binsha : bytes , mode : int , name : str ) -> None :
155157 """Add the given item to the tree, its correctness is assumed, which
156158 puts the caller into responsibility to assure the input is correct.
157159 For more information on the parameters, see ``add``
158160 :param binsha: 20 byte binary sha"""
159- self ._cache .append ((binsha , mode , name ))
161+ assert isinstance (binsha , bytes ) and isinstance (mode , int ) and isinstance (name , str )
162+ tree_cache = cast (T_Tree_cache , (binsha , mode , name ))
163+
164+ self ._cache .append (tree_cache )
160165
161- def __delitem__ (self , name ) :
166+ def __delitem__ (self , name : str ) -> None :
162167 """Deletes an item with the given name if it exists"""
163168 index = self ._index_by_name (name )
164169 if index > - 1 :
0 commit comments