INNER CODE UNIT · Python
result
lean-dojo/TorchLean · torchlean/__init__.py:294
result = _run(command, [str(path), *checks], report=True)
try:
report = json.loads(result.stdout)
except json.JSONDecodeError as error:
raise RuntimeError(
f"checker did not produce a JSON report: {result.stderr.strip()}") from error
if not isinstance(report, dict) or report.get("format") != "torchlean.verification.v1":
raise RuntimeError("checker returned an unknown verification report format")
findings = report.get("checks")
if (not isinstance(findings, list) or not all(isinstance(item, dict) for item in findings)
or [item.get("name") for item in findings] != list(checks)
or type(report.get("ok")) is not bool):
raise RuntimeError("checker report does not cover the requested checks")
if (result.returncode == 0) != report["ok"]:
raise RuntimeError("checker exit status conflicts with its verification report")
return report