Method: pylint.checkers.dunder_methods.DunderCallChecker.visit_call
Calls: 5626, Exceptions: 0, Paths: 7Back
Path 1: 3938 calls (0.7)
Call (3938)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 2: 1580 calls (0.28)
Call (1580)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 3: 91 calls (0.02)
Call (91)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 4: 8 calls (0.0)
Call (8)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 5: 4 calls (0.0)
Call (4)
None (4)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 6: 3 calls (0.0)
Call (3)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )
Path 7: 2 calls (0.0)
Call (2)
1def visit_call(self, node: nodes.Call) -> None:
2 """Check if method being called is an unnecessary dunder method."""
3 if (
4 isinstance(node.func, nodes.Attribute)
5 and node.func.attrname in self._dunder_methods
6 and not self.within_dunder_def(node)
7 and not (
8 isinstance(node.func.expr, nodes.Call)
9 and isinstance(node.func.expr.func, nodes.Name)
10 and node.func.expr.func.name == "super"
11 )
12 ):
13 inf_expr = safe_infer(node.func.expr)
14 if not (inf_expr in {None, Uninferable} or isinstance(inf_expr, Instance)):
15 # Skip dunder calls to non instantiated classes.
16 return
17
18 self.add_message(
19 "unnecessary-dunder-call",
20 node=node,
21 args=(node.func.attrname, self._dunder_methods[node.func.attrname]),
22 confidence=HIGH,
23 )