Sort todo_item's imports and narrow the changelog text for mypy

This commit is contained in:
2026-11-09 01:39:24 +01:00
parent 0c5ea295f1
commit 126b125e9b
3 changed files with 9 additions and 8 deletions
+7 -6
View File
@@ -23,10 +23,10 @@ import pathlib
import sys
import typing
from todo_item.edits import added, finished, with_bullet
from release_plan.todo_table import BLOCKED_BY, MOVES
from failure import Failure
from release_plan import ranking
from release_plan.todo_table import BLOCKED_BY, MOVES
from todo_item.edits import added, finished, with_bullet
# Each score flag, as --l or --L, and the column it fills.
LETTERS = ("L", "E", "I", "S")
@@ -95,11 +95,12 @@ def finish(args: argparse.Namespace, folder: pathlib.Path) -> str | Failure:
ranked = ranking.rank(text, *texts[1:])
if isinstance(ranked, Failure):
return ranked
news = None
news: str | None = None
if args.changelog is not None:
news = with_bullet(changelog.read_text(encoding="utf-8") if changelog.exists() else "", args.changelog)
if isinstance(news, Failure):
return news
bulleted = with_bullet(changelog.read_text(encoding="utf-8") if changelog.exists() else "", args.changelog)
if isinstance(bulleted, Failure):
return bulleted
news = bulleted
if unwritten := ranking.write(todo, ranked.text):
return unwritten
if news is not None and (unwritten := ranking.write(changelog, news)):