Method: pylint.extensions.comparison_placement.MisplacedComparisonConstantChecker._check_misplaced_constant
Calls: 7, Exceptions: 0, Paths: 2Back
Path 1: 6 calls (0.86)
Compare (6)
Const (6)
Name (2) Call (2) Attribute (2)
'==' (3) '<=' (1) '<' (1) '!=' (1)
1def _check_misplaced_constant(
2 self,
3 node: nodes.Compare,
4 left: nodes.NodeNG,
5 right: nodes.NodeNG,
6 operator: str,
7 ) -> None:
8 if isinstance(right, nodes.Const):
9 return
10 operator = REVERSED_COMPS.get(operator, operator)
11 suggestion = f"{right.as_string()} {operator} {left.value!r}"
12 self.add_message("misplaced-comparison-constant", node=node, args=(suggestion,))
Path 2: 1 calls (0.14)
Compare (1)
Const (1)
Const (1)
'==' (1)
None (1)
1def _check_misplaced_constant(
2 self,
3 node: nodes.Compare,
4 left: nodes.NodeNG,
5 right: nodes.NodeNG,
6 operator: str,
7 ) -> None:
8 if isinstance(right, nodes.Const):
9 return
10 operator = REVERSED_COMPS.get(operator, operator)
11 suggestion = f"{right.as_string()} {operator} {left.value!r}"
12 self.add_message("misplaced-comparison-constant", node=node, args=(suggestion,))