chore: fix pyright type errors; add pyright config

- Cast res.color to DotColor in run_live loop.
- Add [tool.pyright] extraPaths to pyproject.toml for IDE resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-15 22:26:57 +00:00
parent 51dc1e403f
commit 6cf4b7a570
2 changed files with 11 additions and 1 deletions

View File

@@ -35,3 +35,9 @@ where = ["src"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
testpaths = ["tests"] testpaths = ["tests"]
pythonpath = ["src"] pythonpath = ["src"]
[tool.pyright]
include = ["src"]
extraPaths = ["src"]
pythonVersion = "3.11"
reportMissingImports = true

View File

@@ -6,9 +6,13 @@ import os
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING, cast
from atm.config import Config # stdlib-only (tomllib); safe at module level from atm.config import Config # stdlib-only (tomllib); safe at module level
if TYPE_CHECKING:
from atm.state_machine import DotColor
# Module-level reference — set lazily by _cmd_dryrun; tests may monkeypatch it. # Module-level reference — set lazily by _cmd_dryrun; tests may monkeypatch it.
dryrun = None dryrun = None
@@ -208,7 +212,7 @@ def run_live(cfg, duration_s=None, capture_stub: bool = False) -> None:
# detection # detection
res = detector.step(now) res = detector.step(now)
if res.accepted and res.color: if res.accepted and res.color:
tr = fsm.feed(res.color, now) tr = fsm.feed(cast("DotColor", res.color), now)
audit.log({ audit.log({
"ts": now, "event": "tick", "ts": now, "event": "tick",
"color": res.color, "state": tr.next.value, "reason": tr.reason, "color": res.color, "state": tr.next.value, "reason": tr.reason,