MCPcopy
hub / github.com/idank/explainshell / dedup_ref_options

Function dedup_ref_options

explainshell/extraction/llm/response.py:282–294  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

280
281
282def 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)

Callers 2

_finalizeMethod · 0.90

Calls 1

dedup_optionsFunction · 0.70

Tested by 1