MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / data_diff

Function data_diff

aura/commands.py:133–166  ·  view source on GitHub ↗
(a_path: str, b_path: str, format_uri=("text",), output_opts=None)

Source from the content-addressed store, hash-verified

131
132
133def data_diff(a_path: str, b_path: str, format_uri=("text",), output_opts=None):
134 try:
135 from . import diff
136 except exceptions.FeatureDisabled:
137 traceback.print_exc(file=sys.stderr)
138 sys.exit(2)
139
140 if output_opts is None:
141 output_opts = {}
142
143 start = time.monotonic()
144 uri_handler1, uri_handler2 = URIHandler.diff_from_uri(a_path, b_path)
145
146 if type(format_uri) not in (tuple, list):
147 format_uri = (format_uri,)
148
149 formatters = [DiffOutputBase.from_uri(x, opts=output_opts) for x in format_uri]
150
151 if "detections" in output_opts:
152 detections = output_opts["detections"]
153 else:
154 detections = any(x.detections for x in formatters)
155
156 analyzer = diff.DiffAnalyzer()
157 analyzer.compare(uri_handler1, uri_handler2)
158 if detections: # FIXME pass a list of allowed analyzers
159 analyzer.analyze_changes()
160
161 for formatter in formatters:
162 with formatter:
163 formatter.output_diff(analyzer)
164
165 end = time.monotonic()
166 logger.info(f"Diff completed in {end-start}s")
167
168
169def scan_mirror(output_dir: Path):

Callers

nothing calls this directly

Calls 5

compareMethod · 0.95
analyze_changesMethod · 0.95
diff_from_uriMethod · 0.80
from_uriMethod · 0.45
output_diffMethod · 0.45

Tested by

no test coverage detected