Dedup options using synthetic description length based on line span. This wraps dedup_options by injecting a synthetic "description" key so that the longest-span entry wins during dedup.
(raw_options: list[dict])
| 280 | |
| 281 | |
| 282 | def dedup_ref_options(raw_options: list[dict]) -> list[dict]: |
| 283 | """Dedup options using synthetic description length based on line span. |
| 284 | |
| 285 | This wraps dedup_options by injecting a synthetic "description" key |
| 286 | so that the longest-span entry wins during dedup. |
| 287 | """ |
| 288 | for opt in raw_options: |
| 289 | lines = opt.get("lines") |
| 290 | if lines and isinstance(lines, list) and len(lines) == 2: |
| 291 | opt["description"] = "x" * (int(lines[1]) - int(lines[0]) + 1) |
| 292 | elif "description" not in opt: |
| 293 | opt["description"] = "" |
| 294 | return dedup_options(raw_options) |