Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
quantum-information
quantum-error-correction
schur-channels
semidefinite-programming
research-artifact
Download verify_release.py from PureOne/LUNEI-Complex-Schur-Recovery: direct link, hf CLI and curl.
- Browser
- Download file 2.76 kB
-
https://huggingface.co/datasets/PureOne/LUNEI-Complex-Schur-Recovery/resolve/main/verify_release.py
- Command line
-
hf download hf://datasets/PureOne/LUNEI-Complex-Schur-Recovery/verify_release.py
-
curl -L -o verify_release.py https://huggingface.co/datasets/PureOne/LUNEI-Complex-Schur-Recovery/resolve/main/verify_release.py
2.76 kB
| #!/usr/bin/env python3 | |
| """Verify this prepared release locally without network access or credentials.""" | |
| from __future__ import annotations | |
| import ast | |
| import hashlib | |
| import json | |
| import re | |
| from pathlib import Path, PurePosixPath | |
| ROOT = Path(__file__).resolve().parent | |
| def main() -> None: | |
| expected = {} | |
| for line in (ROOT / "SHA256SUMS.txt").read_text(encoding="utf-8").splitlines(): | |
| match = re.fullmatch(r"([0-9a-f]{64}) (.+)", line) | |
| if not match: | |
| raise ValueError("Malformed checksum line") | |
| digest, relative = match.groups() | |
| path = PurePosixPath(relative) | |
| if path.is_absolute() or ".." in path.parts or relative in expected: | |
| raise ValueError("Unsafe or duplicate manifest entry") | |
| data = (ROOT / relative).read_bytes() | |
| if hashlib.sha256(data).hexdigest() != digest: | |
| raise ValueError("Checksum mismatch: " + relative) | |
| expected[relative] = digest | |
| counts = {} | |
| for report in sorted((ROOT / "results" / "recorded").glob("*.json")): | |
| result = json.loads(report.read_text(encoding="utf-8")) | |
| if not result["all_checks_passed"] or len(result["checks"]) != result["check_count"]: | |
| raise ValueError("Inconsistent recorded report: " + report.name) | |
| counts[report.name] = result["check_count"] | |
| records = [json.loads(line) for line in (ROOT / "data" / "verification_cases.jsonl") | |
| .read_text(encoding="utf-8").splitlines()] | |
| fields = {"case_id", "suite", "kind", "case_name", "passed", "tolerance", "source_report", "details_json"} | |
| if len(records) != 157 or sum(counts.values()) != 157: | |
| raise ValueError("Unexpected verification count") | |
| if len({row["case_id"] for row in records}) != len(records): | |
| raise ValueError("Duplicate case identifier") | |
| for row in records: | |
| if set(row) != fields or not row["passed"]: | |
| raise ValueError("Unexpected verification row schema/status") | |
| json.loads(row["details_json"]) | |
| for script in (ROOT / "code").glob("*.py"): | |
| ast.parse(script.read_text(encoding="utf-8"), filename=str(script)) | |
| provenance = json.loads((ROOT / "release" / "SOURCE_SHA256.json").read_text()) | |
| for relative, digest in provenance.items(): | |
| if hashlib.sha256((ROOT / relative).read_bytes()).hexdigest() != digest: | |
| raise ValueError("Original research bytes changed: " + relative) | |
| print(json.dumps({"status": "PASS", "checked_files": len(expected), | |
| "recorded_cases": len(records), "suite_counts": counts, | |
| "original_research_files_preserved": len(provenance), | |
| "network_access_used": False}, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |