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:
2026-08-20 00:18:35 +02:00
co-authored by Claude
parent 7c5fca06c3
commit eabf0f4a11
9 changed files with 33 additions and 15 deletions
+13 -2
View File
@@ -18,6 +18,7 @@ Usage:
"""
from contextvars import ContextVar
from types import TracebackType
def get_default_user() -> str:
@@ -142,7 +143,12 @@ class RequestContext:
self._conv_token = current_conversation.set(self.conversation_id)
return self
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
async def __aexit__(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None:
"""Reset context variables on exit."""
if self._user_token is not None:
current_user.reset(self._user_token)
@@ -155,7 +161,12 @@ class RequestContext:
self._conv_token = current_conversation.set(self.conversation_id)
return self
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None:
"""Sync context manager exit."""
if self._user_token is not None:
current_user.reset(self._user_token)