Spaces:
Sleeping
Sleeping
Download server/grader.py from Chirag0123/codebase-nav-env: direct link, hf CLI and curl.
- Browser
- Download file 455 Bytes
-
https://huggingface.co/spaces/Chirag0123/codebase-nav-env/resolve/main/server/grader.py
- Command line
-
hf download hf://spaces/Chirag0123/codebase-nav-env/server/grader.py
-
curl -L -o grader.py https://huggingface.co/spaces/Chirag0123/codebase-nav-env/resolve/main/server/grader.py
455 Bytes
| # server/grader.py | |
| """ | |
| Grading utilities for computing final scores. | |
| """ | |
| from .sandbox import run_pytest_sandboxed | |
| def compute_final_score(repo_path: str, test_file: str = None) -> float: | |
| """ | |
| Run pytest and return the pass rate as the final score. | |
| Returns float in [0.0, 1.0]. | |
| """ | |
| pass_rate, output, timed_out = run_pytest_sandboxed(repo_path, test_file) | |
| if timed_out: | |
| return 0.0 | |
| return min(1.0, max(0.0, pass_rate)) | |