Repository navigation
[pyright] Make transform and inference tip protocols positional-only - #3412
Open
Pierre-Sassoulas wants to merge 3 commits into
Open
Pierre-Sassoulas wants to merge 3 commits into
Pierre-Sassoulas wants to merge 3 commits into
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3412 +/- ##
=======================================
Coverage 91.01% 91.01%
=======================================
Files 93 93
Lines 11800 11801 +1
Branches 1939 1939
=======================================
+ Hits 10740 10741 +1
Misses 744 744
Partials 316 316
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Pierre-Sassoulas
force-pushed
the
pyright-transform-protocols
branch
from
October 20, 2026 14:44
df468f8 to
0861b9a
Compare
Transforms and inference tips are always called with positional arguments, but the protocols named their parameters, so any brain function whose parameter was called ctx instead of context, or that had no infer_function parameter, did not match. Inference tips are always given a context, so it no longer needs a default either. This also fixes two annotations pyright then found: the PySide signal transform is registered for ClassDef, not FunctionDef, and the namedtuple base predicate returned a set instead of a bool.
The inference tip it registers now matches InferFn, which was the last mypy error in the file.
Both files pass pyright now. mypy runs in strict mode and only asked for the missing annotations. Once annotated, easy_class_getitem_inference had to use _extract_single_node, since extract_node may return a list.
Pierre-Sassoulas
force-pushed
the
pyright-transform-protocols
branch
from
October 21, 2026 13:01
0861b9a to
d0b7b78
Compare
This branch has not been deployed
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.
Type of Changes
Description
Transforms and inference tips are always called with positional arguments, but the protocols named their parameters, so any brain function whose parameter was called ctx instead of context, or that had no infer_function parameter, did not match. Inference tips are always given a context, so it no longer needs a default either.
This also fixes two annotations pyright then found: the PySide signal transform is registered for ClassDef, not FunctionDef, and the namedtuple base predicate returned a set instead of a bool.