Sort todo_item's imports and narrow the changelog text for mypy
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"""The text edits behind todo-item: filing an item in todo.md, removing a finished one, and adding a bullet to CHANGELOG.md. Each returns new text; ranking.rank then orders the table and details and writes the derived cells."""
|
||||
import re
|
||||
|
||||
from release_plan.todo_table import cells, DETAILS, items_table, Table
|
||||
from failure import Failure
|
||||
from release_plan.ranking import stated
|
||||
from release_plan.todo_table import cells, DETAILS, items_table, Table
|
||||
|
||||
# A line that would end the item's detail, or open another one, inside ## Details.
|
||||
HEADING = re.compile(r"^#{1,3} ", re.M)
|
||||
|
||||
@@ -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)):
|
||||
|
||||
@@ -7,9 +7,9 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))
|
||||
|
||||
from release_plan import ranking
|
||||
from release_plan.test_ranking import DECISIONS, README, TODO
|
||||
from todo_item import main
|
||||
from release_plan import ranking
|
||||
|
||||
ADD = ["add", "--release", "0.1.0", "--l", "1", "--e", "1", "--i", "1", "--s", "1", "--moves", "1 by 9", "Count the `a | b` runs."]
|
||||
ROW = "| 6 | 0.1.0 | | | **Count the `a \\| b` runs.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 |"
|
||||
|
||||
Reference in New Issue
Block a user