Download tasks/33/solution/site/implementation/clone/source_inventory.py from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 854 Bytes
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/33/solution/site/implementation/clone/source_inventory.py
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/33/solution/site/implementation/clone/source_inventory.py
-
curl -L -o source_inventory.py https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/33/solution/site/implementation/clone/source_inventory.py
854 Bytes
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| from typing import Any | |
| VALID_STATUSES = { | |
| "direct-source-complete", | |
| "local-functional-complete", | |
| "implemented-browser-unverified", | |
| "evidence-incomplete", | |
| "deferred-enrolled-source-required", | |
| "out-of-scope", | |
| } | |
| def load_inventory(path: Path | None = None) -> dict[str, Any]: | |
| inventory_path = path or Path(__file__).resolve().parents[1] / "scope" / "learner-coverage.json" | |
| inventory = json.loads(inventory_path.read_text(encoding="utf-8")) | |
| for entry in inventory.get("entries", []): | |
| if entry.get("status") not in VALID_STATUSES: | |
| raise ValueError(f"unknown status: {entry.get('status')}") | |
| return inventory | |
| def iter_entries(inventory: dict[str, Any]) -> tuple[dict[str, Any], ...]: | |
| return tuple(inventory["entries"]) | |