Answer prose round 1: 1 🔴, 6 🟡; fix the help's fetch claim, the doubled-run scope, the decision title and the docstrings

This commit is contained in:
2026-10-17 21:28:53 +02:00
parent 2972f1c404
commit 410ae7695c
9 changed files with 51 additions and 25 deletions
+5 -5
View File
@@ -43,7 +43,6 @@ class Entry:
"""One paired ruling, which names the commit it was against and its ruling, or one scoring run, which names neither. The places under a scoring seat's label are scored_places; a ruling recorded before PR #255 may hold them too."""
heading: str
time: str
label: str
commit: str
against: str | None
ruling: str | None
@@ -100,14 +99,15 @@ def entries(history: str) -> list[Entry]:
if named := HEADING.match(heading):
body = "\n".join(bodies)
ruling = RULING.search(body)
found.append(Entry(heading, named.group(1), named.group(2), named.group(3), named.group(4), ruling.group(1) if ruling else None, seat_places(body, RULED_PLACES), seat_places(body, SCORED_PLACES), body))
found.append(Entry(heading, named.group(1), named.group(3), named.group(4), ruling.group(1) if ruling else None, seat_places(body, RULED_PLACES), seat_places(body, SCORED_PLACES), body))
return found
def latest_places(history: str) -> str | None:
"""The places seats found hard from the newest entry, by time, that is a scoring run or holds scoring seats' places: in it and each later entry, each ruled place opening with a dimension its seat's vote counted as worse, and every scoring seat's place. Each entry's places come under its heading, oldest first; with no such entry, it starts at the oldest entry. None when no place counts."""
"""The places seats found hard from the oldest entry on the commit of the newest entry, by time, that is a scoring run or holds scoring seats' places: in it and each later entry, each ruled place opening with a dimension its seat's vote counted as worse, and every scoring seat's place. Each entry's places come under its heading, oldest first; with no such entry, it starts at the oldest entry. None when no place counts."""
found = sorted(entries(history), key=lambda entry: entry.time)
newest = max((index for index, entry in enumerate(found) if not entry.paired or entry.scored_places), default=0)
scored = [index for index, entry in enumerate(found) if not entry.paired or entry.scored_places]
newest = next((index for index in scored if found[index].commit == found[scored[-1]].commit), 0)
parts = [placed(entry, worse_places(entry) + labelled_bullets(entry.body, SCORED_PLACES)) for entry in found[newest:]]
return "\n".join(part for part in parts if part) or None
@@ -130,7 +130,7 @@ def worse_votes(body: str) -> dict[str, set[str]]:
def table_rows(body: str) -> dict[str, list[str]]:
"""The cells after the first cell of each table row, by that cell, from the first row that has it; a table's header and its Mean row come with the seats'."""
"""Each table row's cells after its first, keyed by that first cell; where rows share a first cell, the first row wins. Header and Mean rows are included."""
found: dict[str, list[str]] = {}
for line in body.splitlines():
if line.startswith("| "):