Fix CachedMapper's rec/rec_function_definition typing#654
Open
majosm wants to merge 2 commits intoinducer:mainfrom
Open
Fix CachedMapper's rec/rec_function_definition typing#654majosm wants to merge 2 commits intoinducer:mainfrom
CachedMapper's rec/rec_function_definition typing#654majosm wants to merge 2 commits intoinducer:mainfrom
Conversation
953e246 to
646a66b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses recurring basedpyright warnings around CachedMapper subclasses overriding rec/rec_function_definition by adjusting how the base implementations are invoked so that typing information is preserved while still avoiding double-caching.
Changes:
- Switch
CachedMapper’s internal delegation from explicitMapper.rec(...)/Mapper.rec_function_definition(...)calls tosuper().rec(...)/super().rec_function_definition(...). - Update selected
CachedMapper-derived overrides to usesuper(CachedMapper, self).rec(...)to bypassCachedMapper.recand prevent double caching without triggering basedpyright “unknown member type” warnings. - Remove corresponding entries from the basedpyright baseline now that the warnings are resolved.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pytato/transform/metadata.py |
Updates AxisTagAttacher.rec to bypass CachedMapper.rec via super(CachedMapper, self) and tightens local typing assertions. |
pytato/transform/__init__.py |
Adjusts CachedMapper delegation to super() for improved typing; refines function-definition dispatch typing; updates comments to document the double-caching hazard and correct bypass pattern. |
pytato/analysis/__init__.py |
Updates TagCountMapper.rec to bypass CachedMapper.rec via super(CachedMapper, self) to avoid double caching with improved typing. |
.basedpyright/baseline.json |
Removes baseline suppressions corresponding to the fixed typing warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Eliminates the basedpyright warnings that appear every time a cached mapper overrides
rec/rec_function_definition, e.g.:by using
super(CachedMapper, self)instead ofMapper.Testing out Claude for type checking troubleshooting. 🙂 cc @lukeolson