Same shape as #14 (merged as #32, which covered consensus.py + agent.py): tighten the loose annotations in two core modules. Hints only — zero behaviour change. These two files are the red-line guard and the tamper-evidence record, so the diff must be provably inert: annotations and typing imports, nothing else.
What is wanted
parley/preferences.py:
Evaluation.violated: list → List[str]
PreferenceSheet.__init__: hard: Optional[list] → Optional[List[HardConstraint]]; annotate the instance attributes and add the missing -> None
parley/transcript.py:
self.entries → List[dict] (annotate in __init__)
record(self, option: Any, verdicts) — verdicts is a sequence of Verdict; hint it as Iterable[Verdict] with the import under typing.TYPE_CHECKING (plus from __future__ import annotations) so the module gains no new runtime import
to_dict() -> dict and finalize(...) are already annotated; leave them
Match the style the #32 pass used (explicit typing.List/Optional imports, no from x import *).
How to verify
.venv/bin/pytest -q tests/test_preferences.py tests/test_transcript.py
.venv/bin/pytest -q
Identical pass/fail as before your change — the diff is annotations only.
Same shape as #14 (merged as #32, which covered
consensus.py+agent.py): tighten the loose annotations in two core modules. Hints only — zero behaviour change. These two files are the red-line guard and the tamper-evidence record, so the diff must be provably inert: annotations andtypingimports, nothing else.What is wanted
parley/preferences.py:Evaluation.violated: list→List[str]PreferenceSheet.__init__:hard: Optional[list]→Optional[List[HardConstraint]]; annotate the instance attributes and add the missing-> Noneparley/transcript.py:self.entries→List[dict](annotate in__init__)record(self, option: Any, verdicts)—verdictsis a sequence ofVerdict; hint it asIterable[Verdict]with the import undertyping.TYPE_CHECKING(plusfrom __future__ import annotations) so the module gains no new runtime importto_dict() -> dictandfinalize(...)are already annotated; leave themMatch the style the #32 pass used (explicit
typing.List/Optionalimports, nofrom x import *).How to verify
Identical pass/fail as before your change — the diff is annotations only.