@@ -136,7 +136,9 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> 'TreeMod
136
136
137
137
sha = to_bin_sha (sha )
138
138
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
140
142
if index == - 1 :
141
143
self ._cache .append (item )
142
144
else :
@@ -151,14 +153,17 @@ def add(self, sha: bytes, mode: int, name: str, force: bool = False) -> 'TreeMod
151
153
# END handle name exists
152
154
return self
153
155
154
- def add_unchecked (self , binsha , mode , name ) :
156
+ def add_unchecked (self , binsha : bytes , mode : int , name : str ) -> None :
155
157
"""Add the given item to the tree, its correctness is assumed, which
156
158
puts the caller into responsibility to assure the input is correct.
157
159
For more information on the parameters, see ``add``
158
160
: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 )
160
165
161
- def __delitem__ (self , name ) :
166
+ def __delitem__ (self , name : str ) -> None :
162
167
"""Deletes an item with the given name if it exists"""
163
168
index = self ._index_by_name (name )
164
169
if index > - 1 :
0 commit comments