-
-
Notifications
You must be signed in to change notification settings - Fork 292
Add typing to NodeNG.statement
#1217
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d8347f0
Add typing to ``NodeNG.statement``
DanielNoord f9fe68d
Rewrite to use ``StatementMissing``
DanielNoord 7c47926
Merge branch 'main' of https://github.com/PyCQA/astroid into statement
DanielNoord b6373e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 19c5ed4
Add ``future`` parameter to ``NodeNG.statement()`` and add typing
DanielNoord baef395
Merge branch 'statement' of https://github.com/DanielNoord/astroid in…
DanielNoord 005a9ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] da1b989
Update astroid/exceptions.py
DanielNoord d95d5ac
Fix overload
DanielNoord 4a9af1e
Merge branch 'statement' of https://github.com/DanielNoord/astroid in…
DanielNoord ef019e6
Update astroid/nodes/node_ng.py
DanielNoord 1f6ec98
WIP Code Review
DanielNoord df9b49c
Update astroid/nodes/scoped_nodes.py
DanielNoord 6026560
Add NoReturn
DanielNoord d07374c
Code review
DanielNoord 2596ee6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e8d0ff2
Apply suggestions from code review
DanielNoord 73fb21d
Add tests
DanielNoord 6777dc9
Apply suggestions from code review
DanielNoord 1900532
Code Review
DanielNoord 11aefd2
Added keyword parameter to all overloads and statements
DanielNoord 2b6e7d0
Add disable
DanielNoord cab6a88
Update astroid/exceptions.py
DanielNoord 78588ff
Update astroid/nodes/scoped_nodes.py
DanielNoord File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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.
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 think the spirit of the check is to signal the problem to people that don't really know how to use super(). Here it's a false positive because calling the father's function is what you really want to do, but maybe in most case and especially for beginner the check is right. If we remove this "false positive" the check will only have really obvious cases where the class called is not even an ancestor ?
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.
🤔 Not sure about that. What it comes done to is if we want to emit errors for valid Python code. Even if it's probably not what was intended, there are still situations where it's useful and has it's place, especially with multi-inheritance.
The check also emits errors in cases that could cause recursion loops:
Any modifications should also make sure to still emit errors if the class is not part of the MRO.
Test cases taken from the
pylint
testsuit: super_checks.pyThere 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.
OK, I was trying to search for the initial issue where this was implemented for the rational but I can't find it. It makes sense to not warn for valid code, and the check has a lot of valid test cases, so let's fix this false positive.