Repository navigation
Clear all 8 mypy errors in prism.py (#432 session 7) - #448
Merged
Merged
Conversation
PRISM_CONFIG (language_standards.py) mixed str/set/dict values were widening to Collection[str] under mypy, the same problem LENS_CONFIG had in #431 -- every .get()/re.compile() call on it in prism.py errored. Fixed with a PrismConfigSchema TypedDict, mirroring the LensConfig pattern. Two smaller fixes in prism.py itself: - _find_balanced_end's `limit` is declared to return int, but EMBEDDED_LOOKAHEAD_LIMIT (LENS_CONFIG["THRESHOLDS"], typed Dict[str, float]) made the min() expression a float. Wrapped in int() -- the value is a character offset, so this matches intent. - string_cache in _strip_nested_comments needed an explicit Dict[str, str] annotation. Baseline: 86 -> 78 unique entries.
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
Session 7 of the mypy cleanup epic (#432), following the same one-file-per-session pattern as sessions 1-6.
PRISM_CONFIGinlanguage_standards.pyhad mixed str/set/dict values that mypy widened toCollection[str], breaking every.get()/re.compile()call on it inprism.py-- the same shape of problemLENS_CONFIGhad in [REFACTOR] Fix root-cause type annotations causing mypy error fan-out #431. Fixed with aPrismConfigSchemaTypedDict, mirroring the existingLensConfigpattern._find_balanced_end'slimitis declared to returnint, butEMBEDDED_LOOKAHEAD_LIMIT(sourced fromLENS_CONFIG["THRESHOLDS"], typedDict[str, float]) made themin()expression afloat. Wrapped inint(...)-- the value is a character offset, so this matches intent and isn't just a cosmetic silence.string_cachein_strip_nested_commentsneeded an explicitDict[str, str]annotation.Baseline: 86 -> 78 unique entries.
Test plan
mypy gitgalaxy/ --ignore-missing-importsin the CI-matching minimal venv: all 8prism.pyerrors resolved, no fan-out regressions elsewherepython tests/mypy_audit.py --ci: passes against the regenerated 78-entry baselineflake8 . --count --select=E9,F63,F7,F82: 0python tests/dead_key_audit.py --ci: no new findingspytest tests/ -qin the full-precision venv: run in progress, will confirm green before merge🤖 Generated with Claude Code