Repository navigation
Clear all 18 mypy errors in detector.py (#432 session 6) - #446
Merged
Merged
Conversation
Root cause plus several smaller fixes: - `classes`: the same-class regex-extracted class/struct/interface list (linked to functions via parent_class_name -- the exact structure investigated for #108/#429's 5-tier hierarchy work) mixes str/List[str]/ int/float per entry, widening to "object" under mypy. Added a ClassInfo TypedDict, split via inheritance into a `_ClassInfoWithBounds` subclass so the two `del cls["_start_line"/"_end_line"]` calls (temporary spatial-bounds cleanup) stay valid -- mypy rejects deleting a required TypedDict key, only an optional/total=False one. - `DEFINITIONS`/`HANDSHAKE_REGISTRY` (class attrs): same heterogeneous- literal pattern as #431's RECORDING_SCHEMAS/LENS_CONFIG. Dict[str, Any] / List[Dict[str, Any]] respectively. - `self.languages`: pinned Dict[str, Any] at its first assignment, but a same-method reassignment (`self.languages = LANGUAGE_DEFINITIONS`, the AUTO-HEAL branch) still re-narrowed it to LANGUAGE_DEFINITIONS' own wide inferred type for the rest of that branch -- confirmed via reveal_type that a `.get()` right after actually returned `object`, not Any, despite the declared type. Wrapped that reassignment in cast(Dict[str, Any], ...) instead of fighting the narrowing. - Six missing annotations: `regex_telemetry`/`spatial_map` (Dict[str, float] / Dict[str, List[int]]), `doc_buffer`/`all_satellites`/ `satellites` x3 (List[str] / List[FunctionNode] x4). - Three `# type: ignore[union-attr]`, each on a `.finditer()`/`.findall()` call already guarded by an existing try/except or hasattr() check mypy doesn't narrow through -- confirmed each is provably safe at runtime before silencing, not blanket-suppressed. 104 -> 86 unique baseline entries. Verified: detector.py reports zero mypy errors ("Success: no issues found in 1 source file"). flake8, dead_key_audit.py --ci, full pytest suite (866 passed, 1 deselected, 1 pre-existing xfail) all clean.
Contributor
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.
Summary
Part of #429/#432, one file per session. This session: `detector.py`.
104 → 86 unique baseline entries.
Test plan