Answer prose round 1: 0 🔴, 9 🟡 (0 misread); docstrings say what the code does, and each fact sits in one place

This commit is contained in:
2026-11-10 22:32:49 +01:00
parent f2fef1d32d
commit 998e295ef9
17 changed files with 19 additions and 22 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
"""The order blockers impose on the ranked items: each blocker above every item it blocks, and no blocker in a later release or in a loop."""
"""The order blockers impose on the ranked items: each blocker above every item it blocks, no blocker in a later release than an item it blocks, and no blockers in a loop."""
import dataclasses
import graphlib
@@ -8,7 +8,7 @@ from release_plan.release import version
def blockers_first(scored: list[tuple[Item, float]]) -> list[tuple[Item, float]] | Failure:
"""scored, each blocker that ranks below an item it blocks moved up to just above the first such item; a blocker the table no longer holds was finished or deleted, and is dropped."""
"""scored, each blocker that ranks below an item it blocks moved up to just above the first such item; a blocker the table no longer holds was finished or deleted, and is dropped from the Blocked by cells."""
held = {item.id: (item, value) for item, value in scored}
position = {item.id: index for index, (item, _) in enumerate(scored)}
for item, _ in scored:
@@ -33,7 +33,7 @@ def blocking_loop(held: dict[int, tuple[Item, float]]) -> list[int] | None:
def place(id_: int, held: dict[int, tuple[Item, float]], position: dict[int, int], placed: set[int]) -> list[tuple[Item, float]]:
"""The item id_, unless placed holds it, preceded by those of its blockers placed doesn't hold yet, each in score order, and theirs before them. Each item it returns joins placed. blocking_loop has ruled out a loop."""
"""id_'s item, preceded by each of its blockers not yet in placed, in score order, each of them preceded in turn by its own blockers; empty where placed already holds id_. Each item returned joins placed. blocking_loop has ruled out a loop, so the recursion ends."""
if id_ in placed:
return []
placed.add(id_)
+1 -1
View File
@@ -53,11 +53,11 @@ def evaluate(node: ast.AST, values: dict[str, float]) -> float:
divisor = evaluate(right, values)
return evaluate(left, values) / divisor if divisor else math.nan
case ast.BinOp(left, ast.Pow(), right):
# math.pow raises on a negative base with a fractional exponent, zero to a negative power, and overflow; one catch covers all three.
base, exponent = evaluate(left, values), evaluate(right, values)
# A nan from a zero divisor stays nan, though math.pow(1, nan) and math.pow(nan, 0) give 1.
if math.isnan(base) or math.isnan(exponent):
return math.nan
# math.pow raises on a negative base with a fractional exponent, zero to a negative power, and overflow; one catch covers all three.
try:
return math.pow(base, exponent)
except (OverflowError, ValueError):
+2 -2
View File
@@ -1,4 +1,4 @@
"""todo.md on disk: read it with the files beside it that ranking reads, rank it, write it back, and print what ranking reports."""
"""todo.md on disk: read it with the project files ranking reads, then rank or check it, write it back, and print what ranking reports."""
import pathlib
import sys
@@ -41,7 +41,7 @@ def check_failures(todo: pathlib.Path) -> list[str]:
def read_all(todo: pathlib.Path) -> tuple[str, str, str, str] | Failure:
"""todo.md, the README.md beside it, and its docs/decisions.md and docs/comprehension-history.md, each empty when there is none."""
"""todo.md, the README.md beside it, and its docs/decisions.md and docs/comprehension-history.md. The last two are empty when missing; a missing todo.md or README.md is a Failure."""
texts = []
for path, missing in ((todo, "every project keeps a todo.md beside its README.md, and rank_todo.py --help shows one"), (todo.parent / "README.md", "rank_todo.py weighs goals from the README.md beside todo.md"), (todo.parent / "docs" / "decisions.md", None), (todo.parent / HISTORY, None)):
try:
-2
View File
@@ -1,6 +1,4 @@
"""Rank todo.md's items by the formula it states, weighing code health first and then README.md's achieve goals by their position, and hold them to its bar; rank_todo.py --help states the rules.
formula.py holds the formula's language, blockers.py the order blockers impose, and plan_file.py reads and writes todo.md on disk.
"""
import ast
import dataclasses