-
Notifications
You must be signed in to change notification settings - Fork 0
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
[ORG] USA-UDACITY: Add test to superfluous-parens
#1
Conversation
Additional test based on a suggestion in #4907
* Add type annotations to ``visit`` & ``leave`` calls This adds typing to most calls that visit nodes. All other changes are due to mypy errors resulting from introduction of typing. * Fix outstanding mypy issues This removes some of the `type: ignore` comments in favour of solving the mypy issues these comments were surpressing. * Fix remaining references to node_classes Except for two references to node_classes in the changelog this should be the last of them Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Based on discussion in #4787 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
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.
+single functional purpose (focused 1)
+lots of identifiers updated
+v good work
@@ -36,9 +36,11 @@ Firstly we will need to fill in some required boilerplate: | |||
.. code-block:: python | |||
|
|||
import astroid | |||
from astroid import nodes |
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.
ok
|
||
from pylint.checkers import BaseChecker | ||
from pylint.interfaces import IAstroidChecker | ||
from pylint.lint import PyLinter |
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.
ok
@@ -117,14 +119,14 @@ Next we'll track when we enter and leave a function. | |||
|
|||
.. code-block:: python | |||
|
|||
def __init__(self, linter=None): | |||
def __init__(self, linter: PyLinter =None) -> None: |
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.
ok go
super(UniqueReturnChecker, self).__init__(linter) | ||
self._function_stack = [] | ||
|
||
def visit_functiondef(self, node): | ||
def visit_functiondef(self, node: nodes.FunctionDef) -> None: |
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.
go
self._function_stack.append([]) | ||
|
||
def leave_functiondef(self, node): | ||
def leave_functiondef(self, node: nodes.FunctionDef) -> None: |
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.
go
@@ -11,7 +11,7 @@ class Klass(object): | |||
print(Klass().aBC_set1) | |||
print(Klass().ham.does.not_.exist) | |||
print(Klass().spam.does.not_.exist) # [no-member] | |||
node_classes.Tuple.does.not_.exist | |||
nodes.Tuple.does.not_.exist |
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.
ok
@@ -6,6 +6,6 @@ generated-members= | |||
\Afunctional\.g\.generated_members\.Klass\.ham\Z, | |||
DoesNotExist, | |||
"[a-zA-Z]+_set{1,2}", | |||
node_classes.Tuple.*, | |||
nodes.Tuple.*, |
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.
ok
|
||
def visit_if(self, node): | ||
from astroid import nodes | ||
def visit_if(self, node: nodes.If) -> None: |
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.
go
@@ -80,7 +80,7 @@ class A: | |||
|
|||
|
|||
@patch("pylint.pyreverse.utils.get_annotation") | |||
@patch("astroid.node_classes.NodeNG.infer", side_effect=astroid.InferenceError) | |||
@patch("astroid.nodes.NodeNG.infer", side_effect=astroid.InferenceError) |
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.
ok
@@ -93,7 +93,7 @@ def test_infer_node_1(mock_infer, mock_get_annotation): | |||
|
|||
|
|||
@patch("pylint.pyreverse.utils.get_annotation") | |||
@patch("astroid.node_classes.NodeNG.infer") | |||
@patch("astroid.nodes.NodeNG.infer") |
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.
okay
superfluous-parens
superfluous-parens
superfluous-parens
superfluous-parens
Additional test based on a suggestion in pylint-dev#4907
Type of Changes
Description
Closes #XXX