chore: format the whole tree and lint the scratch measurement scripts; CI has been red since 25ae4b4

CI runs ruff format --check and ruff check over the whole repository; 29 files had drifted from the formatter and
four measurement scripts carried lint findings, so every push since 25ae4b4 failed before pytest ran.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Marius Ciepluch
2026-10-14 02:49:44 +02:00
co-authored by Claude Fable 5.1
parent fbbc03f3ea
commit 0d7d3f0dc9
29 changed files with 281 additions and 133 deletions
@@ -1,23 +1,45 @@
"""Compare the baseline labels (old modules) with the labels built on source.py, sentinel-normalised."""
import glob, json, collections, sys
import collections
import glob
import json
import sys
def load(pattern):
files = glob.glob(pattern)
if not files:
sys.exit(f"no labels file for {pattern}")
rows = [json.loads(l) for l in open(files[0]) if l.strip()]
with open(files[0]) as stream:
rows = [json.loads(line) for line in stream if line.strip()]
return files[0], rows
bfile, before = load("/home/mc/ousast-results/fossil/p1-baseline/out/labels-*.jsonl")
afile, after = load("/home/mc/ousast-results/fossil/p1-after/out/labels-*.jsonl")
def key(r):
s = json.dumps(r, sort_keys=True).replace("<global>", "<module>")
return s
B = collections.Counter(key(r) for r in before); A = collections.Counter(key(r) for r in after)
only_b = B - A; only_a = A - B
print("baseline:", bfile, len(before), "rows"); print("after: ", afile, len(after), "rows")
B = collections.Counter(key(r) for r in before)
A = collections.Counter(key(r) for r in after)
only_b = B - A
only_a = A - B
print("baseline:", bfile, len(before), "rows")
print("after: ", afile, len(after), "rows")
print("identical after sentinel normalisation:", len(only_b) == 0 and len(only_a) == 0)
print("rows only in baseline:", sum(only_b.values()), " rows only in after:", sum(only_a.values()))
def summarize(c, title):
print(f"--- {title} (first 8)")
for s, n in list(c.items())[:8]:
r = json.loads(s); print(" ", {k: r.get(k) for k in ("candidate", "family", "label", "source", "unit", "pin_role") if k in r})
summarize(only_b, "only baseline"); summarize(only_a, "only after")
for s in list(c)[:8]:
r = json.loads(s)
print(" ", {k: r.get(k) for k in ("candidate", "family", "label", "source", "unit", "pin_role") if k in r})
summarize(only_b, "only baseline")
summarize(only_a, "only after")