@@ -102,13 +102,13 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]:
102102return out
103103
104104
105- def _find_by_name (tree_data :Sequence [Union [ EntryTup , None ] ],name :str ,is_dir :bool ,start_at :int
106- )-> Union [ EntryTup , None ] :
105+ def _find_by_name (tree_data :Sequence [EntryTupOrNone ],name :str ,is_dir :bool ,start_at :int
106+ )-> EntryTupOrNone :
107107"""return data entry matching the given name and tree mode
108108 or None.
109109 Before the item is returned, the respective data item is set
110110 None in the tree_data list to mark it done"""
111- tree_data_list :List [Union [ EntryTup , None ] ]= list (tree_data )
111+ tree_data_list :List [EntryTupOrNone ]= list (tree_data )
112112try :
113113item = tree_data_list [start_at ]
114114if item and item [2 ]== name and S_ISDIR (item [1 ])== is_dir :
@@ -136,15 +136,15 @@ def _to_full_path(item: EntryTup, path_prefix: str) -> EntryTup:
136136 ...
137137
138138
139- def _to_full_path (item :Union [ EntryTup , None ], path_prefix :str )-> Union [ EntryTup , None ] :
139+ def _to_full_path (item :EntryTupOrNone , path_prefix :str )-> EntryTupOrNone :
140140"""Rebuild entry with given path prefix"""
141141if not item :
142142return item
143143return (item [0 ],item [1 ],path_prefix + item [2 ])
144144
145145
146146def traverse_trees_recursive (odb :'GitCmdObjectDB' ,tree_shas :Sequence [Union [bytes ,None ]],
147- path_prefix :str )-> List [Union [ EntryTup , None ] ]:
147+ path_prefix :str )-> List [EntryTupOrNone ]:
148148"""
149149 :return: list with entries according to the given binary tree-shas.
150150 The result is encoded in a list
@@ -159,11 +159,11 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by
159159 :param path_prefix: a prefix to be added to the returned paths on this level,
160160 set it '' for the first iteration
161161 :note: The ordering of the returned items will be partially lost"""
162- trees_data :List [List [Union [ EntryTup , None ] ]]= []
162+ trees_data :List [List [EntryTupOrNone ]]= []
163163nt = len (tree_shas )
164164for tree_sha in tree_shas :
165165if tree_sha is None :
166- data :List [Union [ EntryTup , None ] ]= []
166+ data :List [EntryTupOrNone ]= []
167167else :
168168data = list (tree_entries_from_data (odb .stream (tree_sha ).read ()))# make new list for typing as invariant
169169# END handle muted trees
@@ -181,7 +181,7 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by
181181if not item :
182182continue
183183# END skip already done items
184- entries :List [Union [ EntryTup , None ] ]
184+ entries :List [EntryTupOrNone ]
185185entries = [None for _ in range (nt )]
186186entries [ti ]= item
187187_sha ,mode ,name = item
@@ -196,8 +196,6 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by
196196entries [tio ]= _find_by_name (td ,name ,is_dir ,ii )
197197
198198# END for each other item data
199- #Revealed type is "builtins.list[Union[Tuple[builtins.bytes, builtins.int, builtins.str], None]]"## #
200- #Revealed type is "builtins.list[Union[Tuple[builtins.bytes, builtins.int, builtins.str], None]]"
201199# if we are a directory, enter recursion
202200if is_dir :
203201out .extend (traverse_trees_recursive (