Skip to content
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

Merged
merged 3 commits into from Sep 4, 2021

Conversation

sakibguy
Copy link
Owner

@sakibguy sakibguy commented Sep 3, 2021

Additional test based on a suggestion in pylint-dev#4907

Type of Changes

Type
βœ“ πŸ› Bug fix
βœ“ ✨ New feature
βœ“ πŸ”¨ Refactoring
βœ“ πŸ“œ Docs

Description

Closes #XXX

Additional test based on a suggestion in #4907
@sakibguy sakibguy added the documentation Improvements or additions to documentation label Sep 3, 2021
@sakibguy sakibguy self-assigned this Sep 3, 2021
DanielNoord and others added 2 commits September 3, 2021 13:47
* 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>
@sakibguy sakibguy merged commit 6c81831 into sakibguy:main Sep 4, 2021
Copy link
Owner Author

@sakibguy sakibguy left a 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
Copy link
Owner Author

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
Copy link
Owner Author

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:
Copy link
Owner Author

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:
Copy link
Owner Author

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:
Copy link
Owner Author

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
Copy link
Owner Author

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.*,
Copy link
Owner Author

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:
Copy link
Owner Author

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)
Copy link
Owner Author

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")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@sakibguy sakibguy changed the title Add test to superfluous-parens USA-UDACITY: Add test to superfluous-parens Jan 27, 2023
@sakibguy sakibguy changed the title USA-UDACITY: Add test to superfluous-parens [ORG] USA-UDACITY: Add test to superfluous-parens Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
2 participants