Download tools/review.py from Giuliocc/doxa-methods: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/datasets/Giuliocc/doxa-methods/resolve/main/tools/review.py
- Command line
-
hf download hf://datasets/Giuliocc/doxa-methods/tools/review.py
-
curl -L -o review.py https://huggingface.co/datasets/Giuliocc/doxa-methods/resolve/main/tools/review.py
1.71 kB
| """Produce the engineering preview audit and enforce the human release gate.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| import pyarrow.parquet as pq | |
| from build_data import ROOT, json_file | |
| from methods import canonical_sha, compare, review_gate | |
| def main(): | |
| parser=argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--data",type=Path,default=ROOT/"work") | |
| parser.add_argument("--reviewed",type=Path) | |
| parser.add_argument("--approvals",type=Path) | |
| parser.add_argument("--require-reviewed",action="store_true") | |
| args=parser.parse_args() | |
| if args.require_reviewed and not (args.reviewed and args.approvals): | |
| parser.error("A reviewed reference dataset and independent sign-off records are required") | |
| rows = (json.loads(args.reviewed.read_text()) if args.reviewed | |
| else pq.read_table(args.data/"development_test.parquet").to_pylist()) | |
| approvals=json.loads(args.approvals.read_text()) if args.approvals else [] | |
| identity=canonical_sha(rows) | |
| gate=review_gate(rows,approvals,identity) | |
| pairs=json.loads((args.data/"audit_pairs.json").read_text()) | |
| score=compare(pairs) | |
| json_file(args.data/"scorecard.json",score) | |
| json_file(args.data/"review_status.json",gate) | |
| print(json.dumps({"gate":gate["ready_for_human_reviewed_release"],"failure_count":len(gate["failures"]), | |
| "eligible_pairs":score["eligible_pairs"],"complete_pairs":score["complete_pairs"], | |
| "gap_bounds":score["gap_bounds"],"excluded":score["exclusions"]},indent=2)) | |
| if args.require_reviewed and not gate["ready_for_human_reviewed_release"]: | |
| raise SystemExit(2) | |
| if __name__=="__main__": | |
| main() | |