Download scripts/validate.py from jumplander/JumpForge-Agentic-SE-3K: direct link, hf CLI and curl.
- Browser
- Download file 830 Bytes
-
https://huggingface.co/datasets/jumplander/JumpForge-Agentic-SE-3K/resolve/main/scripts/validate.py
- Command line
-
hf download hf://datasets/jumplander/JumpForge-Agentic-SE-3K/scripts/validate.py
-
curl -L -o validate.py https://huggingface.co/datasets/jumplander/JumpForge-Agentic-SE-3K/resolve/main/scripts/validate.py
830 Bytes
| #!/usr/bin/env python3 | |
| import json | |
| from pathlib import Path | |
| from jsonschema import Draft202012Validator | |
| ROOT = Path(__file__).resolve().parents[1] | |
| schema = json.loads((ROOT / "schemas" / "record.schema.json").read_text(encoding="utf-8")) | |
| validator = Draft202012Validator(schema) | |
| errors = [] | |
| count = 0 | |
| for split in ("train", "validation", "test"): | |
| with (ROOT / "data" / f"{split}.jsonl").open(encoding="utf-8") as f: | |
| for line_number, line in enumerate(f, 1): | |
| count += 1 | |
| record = json.loads(line) | |
| for error in validator.iter_errors(record): | |
| errors.append((split, line_number, record.get("id"), error.message)) | |
| print(f"Validated records: {count}") | |
| print(f"Schema errors: {len(errors)}") | |
| for item in errors[:20]: | |
| print(item) | |
| raise SystemExit(1 if errors else 0) | |