Download benchmark data from GitHub if not already present.
()
| 53 | |
| 54 | |
| 55 | def _ensure_data(): |
| 56 | """Download benchmark data from GitHub if not already present.""" |
| 57 | _DATA_DIR.mkdir(parents=True, exist_ok=True) |
| 58 | |
| 59 | if not _BENCHMARK_PATH.exists(): |
| 60 | print("Downloading WritingBench benchmark data...") |
| 61 | url = f"{_GITHUB_RAW_BASE}/benchmark_all.jsonl" |
| 62 | if not _download_file(url, _BENCHMARK_PATH): |
| 63 | print("ERROR: Could not download benchmark_all.jsonl. Exiting.") |
| 64 | sys.exit(1) |
| 65 | print(f" Saved to {_BENCHMARK_PATH}") |
| 66 | |
| 67 | # Download requirement subset files (optional, for detailed scoring) |
| 68 | for rel_path in _REQUIREMENT_FILES: |
| 69 | dest = _DATA_DIR / rel_path |
| 70 | if not dest.exists(): |
| 71 | url = f"{_GITHUB_RAW_BASE}/{rel_path}" |
| 72 | _download_file(url, dest) |
| 73 | |
| 74 | |
| 75 | def _load_queries(query_indices=None, limit=None) -> List[dict]: |
no test coverage detected