MCPcopy Index your code
hub / github.com/idank/explainshell / _path_stem

Function _path_stem

tests/evals/_common.py:46–54  ·  view source on GitHub ↗

Encode a repo-relative .gz path as a flat artifact-filename stem. `/` is replaced with `__` (no manpage filename in the corpus contains `__`, so the encoding stays reversible) and the `.gz` suffix is stripped.

(rel_path: str)

Source from the content-addressed store, hash-verified

44
45
46def _path_stem(rel_path: str) -> str:
47 """Encode a repo-relative .gz path as a flat artifact-filename stem.
48
49 `/` is replaced with `__` (no manpage filename in the corpus contains
50 `__`, so the encoding stays reversible) and the `.gz` suffix is stripped.
51 """
52 if rel_path.endswith(".gz"):
53 rel_path = rel_path[:-3]
54 return rel_path.replace("/", "__")
55
56
57def _read_corpus(corpus_path: Path) -> list[Path]:

Callers 2

_on_resultFunction · 0.90
_render_pageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected