MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / compare

Method compare

aura/diff.py:154–188  ·  view source on GitHub ↗
(
        self,
        a_path: Union[ScanLocation, URIHandler, List[ScanLocation]],
        b_path: Union[ScanLocation, URIHandler, List[ScanLocation]],
    )

Source from the content-addressed store, hash-verified

152 self.diffs.append(diff)
153
154 def compare(
155 self,
156 a_path: Union[ScanLocation, URIHandler, List[ScanLocation]],
157 b_path: Union[ScanLocation, URIHandler, List[ScanLocation]],
158 ):
159 # TODO: add a check if one is URIHandler and the other one is Path or ScanLocation
160 if isinstance(a_path, URIHandler) and isinstance(b_path, URIHandler):
161 try:
162 for item in a_path.get_diff_paths(b_path):
163 if isinstance(item, Table):
164 self.tables.append(item)
165 continue
166
167 loc1, loc2 = item
168 self.compare(loc1, loc2)
169
170 except UnsupportedDiffLocation:
171 for item in b_path.get_diff_paths(a_path):
172 if isinstance(item, Table):
173 self.tables.append(item)
174 continue
175
176 loc2, loc1 = item
177 self.compare(loc1, loc2)
178
179 return
180 elif type(a_path) == list and type(b_path) == list:
181 self._diff_files(a_path, b_path)
182 elif a_path.location.is_file() and b_path.location.is_file():
183 self._diff_files([a_path], [b_path])
184 elif b_path.location.is_dir() and a_path.location.is_dir():
185 self._diff_dirs(a_path, b_path)
186 else:
187 # TODO: be able to compare an archive and a directory
188 raise ValueError(f"FS type mismatch: {str(a_path)}, {str(b_path)}")
189
190 def analyze_changes(self):
191 locations = {}

Callers 7

test_diff_same_renamedFunction · 0.95
test_diff_file_addedFunction · 0.95
test_diff_file_removedFunction · 0.95
test_diff_file_similarFunction · 0.95
test_diff_archivesFunction · 0.95
data_diffFunction · 0.95
diff_hookMethod · 0.95

Calls 3

_diff_filesMethod · 0.95
_diff_dirsMethod · 0.95
get_diff_pathsMethod · 0.45

Tested by 5

test_diff_same_renamedFunction · 0.76
test_diff_file_addedFunction · 0.76
test_diff_file_removedFunction · 0.76
test_diff_file_similarFunction · 0.76
test_diff_archivesFunction · 0.76