-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Refactor and add typing to NodeNG.frame()
#1225
Conversation
At some point I will learn to skip for 3.8... 😅 |
for more information, see https://pre-commit.ci
Well, no pressure : it bring only temporary benefit, after the 27th of June 2023 it won't matter anymore 😄 |
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.
I like the new added tests 👍
@@ -3054,3 +3062,13 @@ def _get_assign_nodes(self): | |||
child_node._get_assign_nodes() for child_node in self.body | |||
) | |||
return list(itertools.chain.from_iterable(children_assign_nodes)) | |||
|
|||
def frame(self: T) -> T: |
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.
Shouldn't we use ClassDef
here if we duplicate the function for typing purpose ?
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.
We could, but this will tell the typing engine the same. self
gets set to T
so T
is ClassDef
here. This works similar to scope()
which also is able to distinguish between NodeNG.scope()
and ClassDef.scope()
. You can test the latter in pylint
yourself already!
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.
Thank you for the explanation :)
@cdce8p Sorry for requesting a review after this has been merged. I know you wanted to review this change so I thought I would tag you either way. |
I had already started with the review when Pierre merged it. Wasn't fast enough I guess ;) Nothing major though. The tests could have been written slightly differently to emphasize the difference between Aside from that I was a bit surprised that |
I don't really know myself as well 😅 I know I tried googling for "python frame" and didn't find a direct definition as well. Might it be something introduced in this project some years ago of which the definition has now been lost? |
Sorry for merging before your review @cdce8p ! I'm trying to wrap up pylint 2.12 because there are a lot of bug fixes in it and some fixed issues are getting duplicates (also pylint is broken for < 3.6.2 users) |
Steps
Description
/CC @cdce8p
As discussed in #1224
I also added
Lambda
and added it to the docstrings as we seemed to have forgotten to add it.Type of Changes
Related Issue