Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

34 lines
926 B
Python
Executable File

#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ pyyaml toml ])"
import csv
from pathlib import Path
import sys
import toml
import yaml
requests_csv_path = Path(sys.argv[1])
registry_path = Path(sys.argv[2])
# Generate list of tuples (UUID, count)
rows = []
with open(requests_csv_path) as f:
reader = csv.reader(f)
for row in reader:
if row[2] == "user":
# Get UUID and request_count
rows.append((row[0], int(row[4])))
rows.sort(key=(lambda x: x[1]), reverse=True)
# Build a map from UUID -> name
registry = toml.load(registry_path / "Registry.toml")
uuid_to_name = {k: v["name"] for k, v in registry["packages"].items()}
results = []
for (uuid, count) in rows:
name = uuid_to_name.get(uuid)
if not name: continue
results.append({ "uuid": uuid, "name": uuid_to_name.get(uuid), "count": count })
yaml.dump(results, sys.stdout, default_flow_style=False)