(a_path: str, b_path: str, format_uri=("text",), output_opts=None)
| 131 | |
| 132 | |
| 133 | def 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 | |
| 169 | def scan_mirror(output_dir: Path): |
nothing calls this directly
no test coverage detected