New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typing for set_local
#1837
Add typing for set_local
#1837
Conversation
Pull Request Test Coverage Report for Build 3401620989
💛 - Coveralls |
As I said before, We might need to fix that brain or just accept |
Thanks for the followup @DanielNoord! I should have checked it more carefully. The only example I found now is with I'll update the PR. |
Update |
Ah yeah, I knew there was something with Like I said, I'm not even sure if it is correct or we should actually reject types like I do think that updating this will cause multiple trickle down issues in other places as I think many return values depend on |
Since it so widely used in brain modules, I suspect any code dealing with it needs to handle Just a note, I've only updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final question!
@@ -26,7 +27,7 @@ class LocalsDictNodeNG(node_classes.LookupMixIn): | |||
|
|||
# attributes below are set by the builder module or by raw factories | |||
|
|||
locals: dict[str, list[nodes.NodeNG]] = {} | |||
locals: dict[str, list[SuccessfulInferenceResult]] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to update all other places where we define local
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed an update. AFAICT there wasn't that much to deal with. Added type: ignore
in a few places where node.locals
would only return node.NodeNG
. Those could theoretical be cast
as well. Let me know what you think.
c36cb2c
to
0fe5feb
Compare
Ref #1834 (review)
/CC: @DanielNoord