Datasets:
Download scripts/govdata/cli.py from ethux/belastingdienst-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/ethux/belastingdienst-dataset/resolve/main/scripts/govdata/cli.py
- Command line
-
hf download hf://datasets/ethux/belastingdienst-dataset/scripts/govdata/cli.py
-
curl -L -o cli.py https://huggingface.co/datasets/ethux/belastingdienst-dataset/resolve/main/scripts/govdata/cli.py
1.11 kB
| import argparse | |
| import importlib | |
| import json | |
| from pathlib import Path | |
| from govdata.common.pipeline import Options, run | |
| DATASETS = ["wetten", "belastingdienst"] | |
| def main(argv: list[str] | None = None) -> None: | |
| p = argparse.ArgumentParser(prog="govdata", description="Rebuild a dataset and publish it to Hugging Face.") | |
| p.add_argument("dataset", choices=DATASETS) | |
| p.add_argument("--limit", type=int, help="only index/fetch the first N records (for smoke runs)") | |
| p.add_argument("--no-upload", action="store_true", help="build locally, skip HF download and upload") | |
| p.add_argument("--out", type=Path, default=Path("out")) | |
| p.add_argument("--budget-hours", type=float, default=5.0, help="stop fetching after this long") | |
| args = p.parse_args(argv) | |
| src = importlib.import_module(f"govdata.{args.dataset}.source").SOURCE | |
| opt = Options(limit=args.limit, upload=not args.no_upload, out=args.out, budget_s=args.budget_hours * 3600) | |
| stats = run(src, opt, repo_root=Path(__file__).resolve().parents[2]) | |
| print(json.dumps(stats, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |