Download shared/tools/check_structure.py from qrlow/deepdesk-bench: direct link, hf CLI and curl.
- Browser
- Download file 4.19 kB
-
https://huggingface.co/datasets/qrlow/deepdesk-bench/resolve/main/shared/tools/check_structure.py
- Command line
-
hf download hf://datasets/qrlow/deepdesk-bench/shared/tools/check_structure.py
-
curl -L -o check_structure.py https://huggingface.co/datasets/qrlow/deepdesk-bench/resolve/main/shared/tools/check_structure.py
4.19 kB
| #!/usr/bin/env python3 | |
| """Check the four-task SnD Floaters suite layout and canonical assets.""" | |
| from __future__ import annotations | |
| import json | |
| import subprocess | |
| import tomllib | |
| from pathlib import Path | |
| SHARED = Path(__file__).resolve().parents[1] | |
| SUITE = SHARED.parent | |
| ROOT = SUITE.parent | |
| TASKS = [ | |
| ("snd-floaters-01-vessel-recon", "01-vessel-recon"), | |
| ("snd-floaters-02-cargo-reconciliation", "02-cargo-reconciliation"), | |
| ("snd-floaters-03-schedule-update", "03-schedule-update"), | |
| ("snd-floaters-04-full-update", "04-full-update"), | |
| ] | |
| def fail(message: str) -> None: | |
| raise SystemExit(message) | |
| def tracked_files() -> list[str]: | |
| result = subprocess.run( | |
| ["git", "ls-files"], | |
| cwd=ROOT, | |
| check=True, | |
| capture_output=True, | |
| text=True, | |
| ) | |
| return [line for line in result.stdout.splitlines() if line] | |
| def main() -> None: | |
| for retired in (ROOT / "harbor", ROOT / "snd-floaters-eval"): | |
| if retired.exists(): | |
| fail(f"retired directory still exists: {retired.relative_to(ROOT)}") | |
| registry = json.loads((ROOT / "registry.json").read_text()) | |
| entries = [entry for entry in registry if entry.get("name") == "snd-floaters"] | |
| if len(entries) != 1: | |
| fail("registry.json must contain exactly one snd-floaters dataset") | |
| expected_registry_tasks = [ | |
| {"name": name, "path": f"snd-floaters/{directory}"} | |
| for name, directory in TASKS | |
| ] | |
| if entries[0].get("tasks") != expected_registry_tasks: | |
| fail("snd-floaters must list the four original tasks in order") | |
| for expected_name, directory in TASKS: | |
| task_dir = SUITE / directory | |
| for required in ("instruction.md", "task.toml", "tests/test.sh", "solution/solve.sh"): | |
| if not (task_dir / required).is_file(): | |
| fail(f"missing {directory}/{required}") | |
| if not (task_dir / "environment").is_dir(): | |
| fail(f"missing {directory}/environment/") | |
| config = tomllib.loads((task_dir / "task.toml").read_text()) | |
| if config.get("task", {}).get("name") != f"qrlow/{expected_name}": | |
| fail(f"unexpected task name in {directory}/task.toml") | |
| tracked = tracked_files() | |
| expected_by_name = { | |
| "European_Gas_SnD_Start.xlsx": [ | |
| "snd-floaters/01-vessel-recon/environment/candidate/European_Gas_SnD_Start.xlsx", | |
| "snd-floaters/02-cargo-reconciliation/environment/candidate/European_Gas_SnD_Start.xlsx", | |
| "snd-floaters/03-schedule-update/environment/candidate/European_Gas_SnD_Start.xlsx", | |
| "snd-floaters/04-full-update/environment/candidate/European_Gas_SnD_Start.xlsx", | |
| "snd-floaters/shared/candidate/European_Gas_SnD_Start.xlsx", | |
| ], | |
| "score_submission.py": [ | |
| "snd-floaters/03-schedule-update/tests/score_submission.py", | |
| "snd-floaters/04-full-update/tests/score_submission.py", | |
| "snd-floaters/shared/scripts/score_submission.py", | |
| ], | |
| "answer_key.json": [ | |
| "snd-floaters/03-schedule-update/tests/answer_key.json", | |
| "snd-floaters/04-full-update/tests/answer_key.json", | |
| "snd-floaters/shared/private/answer_key.json", | |
| ], | |
| "European_Gas_SnD_Answer.xlsx": [ | |
| "snd-floaters/03-schedule-update/solution/European_Gas_SnD_Answer.xlsx", | |
| "snd-floaters/04-full-update/solution/European_Gas_SnD_Answer.xlsx", | |
| "snd-floaters/shared/private/European_Gas_SnD_Answer.xlsx", | |
| ], | |
| } | |
| suite_files = [path for path in tracked if path.startswith("snd-floaters/")] | |
| for basename, expected in expected_by_name.items(): | |
| found = sorted(path for path in suite_files if Path(path).name == basename) | |
| if found != sorted(expected): | |
| fail(f"unexpected {basename} files: {found}") | |
| generated_download = ( | |
| "snd-floaters/shared/portal/public/downloads/European_Gas_SnD_Start.xlsx" | |
| ) | |
| if generated_download in tracked: | |
| fail("the generated portal workbook download must not be tracked") | |
| print("SnD Floaters structure OK: one suite with four original tasks") | |
| if __name__ == "__main__": | |
| main() | |