Method: pylint.checkers.refactoring.implicit_booleaness_checker.ImplicitBooleanessChecker.visit_unaryop
Calls: 218, Exceptions: 0, Paths: 3Back
Path 1: 110 calls (0.5)
UnaryOp (110)
1@utils.only_required_for_messages("use-implicit-booleaness-not-len")
2 def visit_unaryop(self, node: nodes.UnaryOp) -> None:
3 """`not len(S)` must become `not S` regardless if the parent block is a test
4 condition or something else (boolean expression) e.g. `if not len(S):`.
5 """
6 if (
7 isinstance(node, nodes.UnaryOp)
8 and node.op == "not"
9 and utils.is_call_of_name(node.operand, "len")
10 ):
11 self.add_message(
12 "use-implicit-booleaness-not-len", node=node, confidence=HIGH
13 )
Path 2: 104 calls (0.48)
UnaryOp (104)
1@utils.only_required_for_messages("use-implicit-booleaness-not-len")
2 def visit_unaryop(self, node: nodes.UnaryOp) -> None:
3 """`not len(S)` must become `not S` regardless if the parent block is a test
4 condition or something else (boolean expression) e.g. `if not len(S):`.
5 """
6 if (
7 isinstance(node, nodes.UnaryOp)
8 and node.op == "not"
9 and utils.is_call_of_name(node.operand, "len")
10 ):
11 self.add_message(
12 "use-implicit-booleaness-not-len", node=node, confidence=HIGH
13 )
Path 3: 4 calls (0.02)
UnaryOp (4)
1@utils.only_required_for_messages("use-implicit-booleaness-not-len")
2 def visit_unaryop(self, node: nodes.UnaryOp) -> None:
3 """`not len(S)` must become `not S` regardless if the parent block is a test
4 condition or something else (boolean expression) e.g. `if not len(S):`.
5 """
6 if (
7 isinstance(node, nodes.UnaryOp)
8 and node.op == "not"
9 and utils.is_call_of_name(node.operand, "len")
10 ):
11 self.add_message(
12 "use-implicit-booleaness-not-len", node=node, confidence=HIGH
13 )