INNER CODE UNIT · Python
_tool_version
valqore/valqore · benchmarks/run_benchmark.py:46
def _tool_version(cmd: list[str]) -> str | None:
"""Capture a tool's version string for provenance, or None if absent."""
exe = cmd[0]
if exe != sys.executable and not shutil.which(exe):
return None
try:
p = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
out = (p.stdout or p.stderr or "").strip().splitlines()
return out[0].strip() if out else None
except Exception:
return None
def _corpus_provenance() -> dict:
"""Hash every corpus file so a reviewer can confirm they ran the same inputs."""
files = {}
h_all = hashlib.sha256()
for f in sorted(CORPUS.rglob("*")):