Counters: a total padded wider than its index is none; report diff on shared ranges
- "Very Best Of The Who [01/010]", "[02/020]", "[07/070]": a posting tool's
total of index×10, so every track had a total of its own and was a
release of its own. A total zero-padded wider than its index is no
counter ("[001/010]" still is).
- corpus_sweep.py report compares builds over the ranges both replayed (the
corpus grows between builds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1a5035d988
commit
8e07478659
4 files changed
+53
-12
No files matched your search
+18
-9
@@ -113,13 +113,20 @@ def replay():
|
||||
shutil.rmtree(os.path.join(OUT, b))
|
||||
|
||||
|
||||
def load(build):
|
||||
"""Releases of one build's replay, merged by (group, key) as the catalog does."""
|
||||
def replayed(build):
|
||||
"""The ranges a build replayed, as paths relative to its directory."""
|
||||
root = os.path.join(OUT, build)
|
||||
return {os.path.relpath(os.path.join(d, f), root) for d, _, files in os.walk(root) for f in files if f.endswith('.jsonl')}
|
||||
|
||||
|
||||
def load(build, only=None):
|
||||
"""Releases of one build's replay (of the ranges in `only`, when given), merged by (group, key) as the catalog does."""
|
||||
releases = {}
|
||||
for dirpath, _, files in os.walk(os.path.join(OUT, build)):
|
||||
for f in files:
|
||||
if not f.endswith('.jsonl'):
|
||||
continue
|
||||
for rel in sorted(replayed(build)):
|
||||
if only is not None and rel not in only:
|
||||
continue
|
||||
dirpath, f = os.path.split(os.path.join(OUT, build, rel))
|
||||
if True:
|
||||
for line in open(os.path.join(dirpath, f), encoding='utf-8', errors='replace'):
|
||||
r = json.loads(line)
|
||||
k = (r['group'], r['key'])
|
||||
@@ -182,10 +189,12 @@ def report():
|
||||
show(r, ' ')
|
||||
|
||||
if len(builds) >= 2:
|
||||
before = load(builds[-2][1])
|
||||
print(f'\n== change since build {builds[-2][1]}: {len(before):,} → {len(rel):,} releases')
|
||||
# Over the ranges both replayed: the corpus grows between builds.
|
||||
both = replayed(builds[-2][1]) & replayed(build)
|
||||
before, after = load(builds[-2][1], both), load(build, both)
|
||||
print(f'\n== change since build {builds[-2][1]} on the {len(both)} ranges both replayed: {len(before):,} → {len(after):,} releases')
|
||||
names = lambda rs: collections.Counter((r['group'], r['name']) for r in rs.values())
|
||||
a, b = names(before), names(rel)
|
||||
a, b = names(before), names(after)
|
||||
moved = sorted(set(a) | set(b), key=lambda k: -abs(a[k] - b[k]))[:20]
|
||||
for k in moved:
|
||||
if a[k] != b[k]:
|
||||
|
||||
Reference in new issue
Block a user