Skip to content

Commit

Permalink
Use walrus operator to avoid mypy disable
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jul 3, 2023
1 parent 2318a47 commit 51c7441
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,16 +1133,12 @@ def _check_super_with_arguments(self, node: nodes.Call) -> None:
if not isinstance(node.func, nodes.Name) or node.func.name != "super":
return

# pylint: disable=too-many-boolean-expressions
if (
len(node.args) != 2
or not isinstance(node.args[1], nodes.Name)
or not all(isinstance(arg, nodes.Name) for arg in node.args)
or node.args[1].name != "self"
or not isinstance(node.args[0], nodes.Name)
or not isinstance(node.args[1], nodes.Name)
or node_frame_class(node) is None
# TODO: PY38: Use walrus operator, this will also fix the mypy issue
or node.args[0].name != node_frame_class(node).name # type: ignore[union-attr]
or (frame_class := node_frame_class(node)) is None
or node.args[0].name != frame_class.name
):
return

Expand Down

0 comments on commit 51c7441

Please sign in to comment.