"""Fill raw/hubstats/ (past downloads from cfahlgren1/hub-stats) by hand. python scripts/backfill_hubstats.py [--every 7] [--since 2025-01-01] [--push] The daily job does this by itself when the folder is empty in the dataset (see hfeco/hubstats.py); this is for refilling it by hand, e.g. with a different step. """ import argparse import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) from hfeco import hubstats, org, store # noqa: E402 def main(): ap = argparse.ArgumentParser() ap.add_argument("--every", type=int, default=7) ap.add_argument("--since", default="2025-01-01") ap.add_argument("--push", action="store_true", help="upload what was written to the dataset") a = ap.parse_args() paths = hubstats.backfill(org.history_ids(org.public_models()), a.every, a.since) if a.push and paths: store.push(paths, "hub-stats downloads history") print("pushed") if __name__ == "__main__": main()