Datasets:
Download code/src/pvr_eval/contracts/validators.py from wenjieshu/solveedit_benchmark_2728: direct link, hf CLI and curl.
- Browser
- Download file 836 Bytes
-
https://huggingface.co/datasets/wenjieshu/solveedit_benchmark_2728/resolve/main/code/src/pvr_eval/contracts/validators.py
- Command line
-
hf download hf://datasets/wenjieshu/solveedit_benchmark_2728/code/src/pvr_eval/contracts/validators.py
-
curl -L -o validators.py https://huggingface.co/datasets/wenjieshu/solveedit_benchmark_2728/resolve/main/code/src/pvr_eval/contracts/validators.py
836 Bytes
| """Contract validation helpers.""" | |
| from __future__ import annotations | |
| from pvr_eval.core.schema import EvalContract | |
| def validate_contract(contract: EvalContract) -> None: | |
| if not contract.case_id: | |
| raise ValueError("contract.case_id is required") | |
| if not contract.atomic_checks: | |
| raise ValueError(f"contract {contract.case_id!r} has no atomic checks") | |
| seen: set[str] = set() | |
| for check in contract.atomic_checks: | |
| if check.check_id in seen: | |
| raise ValueError(f"duplicate atomic check id {check.check_id!r} in {contract.case_id}") | |
| seen.add(check.check_id) | |
| if check.weight < 0: | |
| raise ValueError(f"atomic check {check.check_id!r} has negative weight") | |
| if not check.checker: | |
| raise ValueError(f"atomic check {check.check_id!r} has no checker") | |