Download scripts/test_regenerate.py from SCRIPTMASTERLABS/x402-pulse: direct link, hf CLI and curl.
- Browser
- Download file 2.48 kB
-
https://huggingface.co/datasets/SCRIPTMASTERLABS/x402-pulse/resolve/main/scripts/test_regenerate.py
- Command line
-
hf download hf://datasets/SCRIPTMASTERLABS/x402-pulse/scripts/test_regenerate.py
-
curl -L -o test_regenerate.py https://huggingface.co/datasets/SCRIPTMASTERLABS/x402-pulse/resolve/main/scripts/test_regenerate.py
2.48 kB
| #!/usr/bin/env python3 | |
| """Compare regenerate.py output against the published 2026-11-21 Pulse files.""" | |
| from __future__ import annotations | |
| import csv | |
| import json | |
| import subprocess | |
| import sys | |
| import tempfile | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| SCRIPT = ROOT / "scripts" / "regenerate.py" | |
| RAW = ROOT / "data" / "data_raw.json" | |
| PUB_JSON = ROOT / "data" / "x402-pulse-2026-11.json" | |
| PUB_CSV = ROOT / "data" / "x402-pulse-2026-11.csv" | |
| def main() -> int: | |
| published = json.loads(PUB_JSON.read_text()) | |
| with tempfile.TemporaryDirectory() as td: | |
| out = Path(td) | |
| subprocess.check_call( | |
| [ | |
| sys.executable, | |
| str(SCRIPT), | |
| "--source", | |
| str(RAW), | |
| "--out", | |
| str(out), | |
| "--slug", | |
| "x402-pulse-2026-11", | |
| "--published", | |
| "2026-11-21", | |
| ] | |
| ) | |
| got = json.loads((out / "data" / "x402-pulse-2026-11.json").read_text()) | |
| assert got["totals"] == published["totals"], (got["totals"], published["totals"]) | |
| assert got["excluded_scriptmasterlabs_rows"] == published["excluded_scriptmasterlabs_rows"] | |
| assert got["week_over_week"]["nov_7_13"] == published["week_over_week"]["nov_7_13"] | |
| assert got["week_over_week"]["nov_14_20"] == published["week_over_week"]["nov_14_20"] | |
| assert got["week_over_week"]["multiple"] == published["week_over_week"]["multiple"] | |
| assert got["price_mix"] == published["price_mix"] | |
| assert got["concentration_since_2026_11_14"] == published["concentration_since_2026_11_14"] | |
| assert got["largest_seller_since_2026_11_14"] == published["largest_seller_since_2026_11_14"] | |
| assert got["supply_snapshot"] == published["supply_snapshot"] | |
| assert got["quotable"] == published["quotable"] | |
| assert got["window"] == published["window"] | |
| assert got["daily"] == published["daily"] | |
| assert got["caveats"] == published["caveats"] | |
| with (out / "data" / "x402-pulse-2026-11.csv").open() as f, PUB_CSV.open() as g: | |
| got_rows = list(csv.reader(f)) | |
| pub_rows = list(csv.reader(g)) | |
| assert got_rows == pub_rows, "CSV does not match the published file" | |
| print("regenerate.py matches the published 2026-11 Pulse CSV, totals, quotable, seller and caveats") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |