Answer architecture round 3: 0 🔴, 3 🟡; date the legacy case by PR #255, count the newest scoring entry's own worse places, and read a seat's vote from the votes table only
This commit is contained in:
@@ -40,7 +40,7 @@ class Place:
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
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 2026-10-13 holds them too where a fallen dimension called the scoring seats."""
|
||||
"""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 holds them too where a fallen dimension called the scoring seats."""
|
||||
heading: str
|
||||
time: str
|
||||
commit: str
|
||||
@@ -104,11 +104,10 @@ def entries(history: str) -> list[Entry]:
|
||||
|
||||
|
||||
def latest_places(history: str) -> str | None:
|
||||
"""The places seats found hard since the newest entry, by time, that holds scoring seats' places: all of that entry's scoring places, then, in each later paired ruling, each place opening with a dimension its seat's vote counted as worse. Each entry's places come under its heading, oldest first; with no such entry, every ruling's count. None when no place counts."""
|
||||
"""The places seats found hard from the newest entry, by time, that 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, every ruling's count. None when no place counts."""
|
||||
found = sorted(entries(history), key=lambda entry: entry.time)
|
||||
newest = max((index for index, entry in enumerate(found) if entry.scored_places), default=None)
|
||||
first = [placed(found[newest], labelled_bullets(found[newest].body, SCORED_PLACES))] if newest is not None else []
|
||||
parts = first + [placed(entry, worse_places(entry)) for entry in (found if newest is None else found[newest + 1:])]
|
||||
newest = max((index for index, entry in enumerate(found) if entry.scored_places), default=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
|
||||
|
||||
|
||||
@@ -125,9 +124,13 @@ def placed(entry: Entry, labelled: list[tuple[str, list[str]]]) -> str:
|
||||
|
||||
|
||||
def worse_votes(body: str) -> dict[str, set[str]]:
|
||||
"""Each seat's dimensions, Overall included, whose vote in the ruling's table counted as worse; `same (voted worse, …)` counted as same."""
|
||||
rows = [[cell.strip() for cell in line.strip("|").split("|")] for line in body.splitlines() if line.startswith("| ")]
|
||||
return {name: {dimension for dimension, vote in zip(DIMENSIONS, votes) if vote == "worse"} for name, *votes in rows if len(votes) == len(DIMENSIONS)}
|
||||
"""Each seat's dimensions, Overall included, whose vote in the ruling's table counted as worse; `same (voted worse, …)` counted as same. The votes table comes first, so a seat's row in a later scores table is not its vote."""
|
||||
found: dict[str, set[str]] = {}
|
||||
for line in body.splitlines():
|
||||
name, *votes = [cell.strip() for cell in line.strip("|").split("|")] if line.startswith("| ") else [""]
|
||||
if len(votes) == len(DIMENSIONS):
|
||||
found.setdefault(name, {dimension for dimension, vote in zip(DIMENSIONS, votes) if vote == "worse"})
|
||||
return found
|
||||
|
||||
|
||||
def place_dimensions(place: str) -> list[str]:
|
||||
|
||||
Reference in New Issue
Block a user