chore(typing): extend the Any ban to tools and examples - #799
Merged
Conversation
tools/ and examples/ already contained zero explicit Any, so the mypy override locks in the current state before it drifts. disallow_any_unimported needed types-tqdm, which makes tqdm generic, so the two bar annotations in tools/benchmark.py gain a parameter; the bar is only updated and read for format_dict, never iterated. Also ignores .claude/worktrees/, which git add -A has swept into a commit before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the strict-mypy stack (#789–#797).
Changes
pyproject.toml— new["tools.*", "examples.*"]mypy override addingdisallow_any_explicitanddisallow_any_unimported. Both directories already contained zero explicitAny, so this locks in the current state rather than fixing a backlog.types-tqdmadded to the dev extras. It was the only thing blockingdisallow_any_unimported: without stubs,bar: tqdmsilently degraded toAny.tools/benchmark.py— with real stubstqdmis generic, so the two annotations gain a parameter (tqdm[NoReturn]). The bar is only ever.update()d and read via.format_dict, never iterated, so no element type is observable..gitignore— ignore.claude/worktrees/. Only.claude/settings.local.jsonwas listed, andgit add -Ahas swept an embedded worktree into a commit before.AGENTS.md— the typing section now states the ban coverspgqueuer/,tools/andexamples/, and thatAnyremains allowed undertest/.test/is deliberately left alone: 88Anyacross 18 files and 37type: ignoreacross 16, in code whose job is to build malformed payloads and loose stubs. Theignore-without-codeerror code already applies there.Verification
uv run mypy . --no-incrementaluv run ruff check ./format --checkuv run lint-importstest/test_benchmark_grace_period.pygit check-ignore .claude/worktrees/...