One-line summary of a Decision for --dry-run output.
(d: prefilter.Decision)
| 268 | |
| 269 | |
| 270 | def _format_decision(d: prefilter.Decision) -> str: |
| 271 | """One-line summary of a Decision for --dry-run output.""" |
| 272 | if isinstance(d, prefilter.Work): |
| 273 | return f"WORK {d.short_path}" |
| 274 | if isinstance(d, prefilter.SizeSkip): |
| 275 | cmp = ">" if d.direction == "small" else "<=" |
| 276 | return f"SIZE-SKIP {d.short_path} ({d.size} {cmp} {d.threshold})" |
| 277 | if isinstance(d, prefilter.AlreadyStored): |
| 278 | return f"ALREADY {d.short_path}" |
| 279 | if isinstance(d, prefilter.FilterSkip): |
| 280 | return ( |
| 281 | f"FILTER-SKIP {d.short_path} " |
| 282 | f"(stored {d.stored_extractor}/{d.stored_model})" |
| 283 | ) |
| 284 | if isinstance(d, prefilter.Symlink): |
| 285 | loc = "in-input-set" if d.canonical_in_inputs else "not-in-inputs" |
| 286 | stale = ", stale-in-db" if d.stale_in_db else "" |
| 287 | return f"SYMLINK {d.short_path} -> {d.canonical_source} ({loc}{stale})" |
| 288 | if isinstance(d, prefilter.ContentDup): |
| 289 | return f"CONTENT-DUP {d.short_path} -> {d.canonical_source}" |
| 290 | return repr(d) |
| 291 | |
| 292 | |
| 293 | def _run_plan( |