chore(types): annotate fifteen signatures mypy could not check
Twelve gain `-> None`, each confirmed by AST to contain no returning `return` and no `yield` rather than by reading the name and assuming. The three context-manager exits gain the canonical type[BaseException]/BaseException/TracebackType argument triple. Both files taking TracebackType needed the import, and inserting it before the first import broke ruff's I001 — lint was exit 0 at the baseline commit, verified by stashing this work and re-running, so that breakage was mine. Fixed with `ruff check --fix` on the two files, which placed the import in sorted position. 86 errors -> 75; no-untyped-def 29 -> 14. Suite: 658 passed. The baseline was 657 passed with one failure in test_tatlock_tool_call_logging_calculator, which asserts on the content of a live model's reply. It passing here is nondeterminism, NOT evidence this commit fixed anything, and it may fail again on the next run. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -218,7 +218,7 @@ class DelegationTask:
|
||||
result: str | None = None
|
||||
task_id: str = ""
|
||||
|
||||
def __post_init__(self):
|
||||
def __post_init__(self) -> None:
|
||||
"""Generate task ID if not provided."""
|
||||
if not self.task_id:
|
||||
import uuid
|
||||
|
||||
@@ -109,7 +109,7 @@ class StewardAgent:
|
||||
(preferred) and Ollama (fallback) backends via direct API calls.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Initialize Steward with backend selection based on availability."""
|
||||
# Ollama config (primary)
|
||||
self.ollama_host = str(config.OLLAMA_HOST).rstrip("/")
|
||||
|
||||
@@ -36,7 +36,7 @@ class ToolCallTracker:
|
||||
|
||||
calls: list[str] = field(default_factory=list)
|
||||
|
||||
def log_call(self, message: str):
|
||||
def log_call(self, message: str) -> None:
|
||||
"""Log a tool call."""
|
||||
self.calls.append(message)
|
||||
|
||||
@@ -155,14 +155,14 @@ class TatlockAgent(AgentInterface):
|
||||
currently in Phase 1 (basic LLM integration without expert agents).
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Initialize Tatlock (lazy agent creation)."""
|
||||
# Deps are a ToolCallTracker: every registered tool takes
|
||||
# RunContext[ToolCallTracker], and run() is called with one. Saying so
|
||||
# is what lets the tool registrations below type-check at all.
|
||||
self._agent: Agent[ToolCallTracker, str] | None = None # Lazy initialization
|
||||
|
||||
def _ensure_agent(self):
|
||||
def _ensure_agent(self) -> None:
|
||||
"""Ensure the PydanticAI agent is initialized (lazy initialization)."""
|
||||
if self._agent is not None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user