Method: pylint.checkers.base.basic_checker.BasicChecker.visit_with
Calls: 168, Exceptions: 0, Paths: 4Back
Path 1: 160 calls (0.95)
With (160)
1@utils.only_required_for_messages("confusing-with-statement")
2 def visit_with(self, node: nodes.With) -> None:
3 # a "with" statement with multiple managers corresponds
4 # to one AST "With" node with multiple items
5 pairs = node.items
6 if pairs:
7 for prev_pair, pair in zip(pairs, pairs[1:]):
8 if isinstance(prev_pair[1], nodes.AssignName) and (
9 pair[1] is None and not isinstance(pair[0], nodes.Call)
10 ):
11 # Don't emit a message if the second is a function call
12 # there's no way that can be mistaken for a name assignment.
13 # If the line number doesn't match
14 # we assume it's a nested "with".
15 self.add_message("confusing-with-statement", node=node)
Path 2: 4 calls (0.02)
With (4)
1@utils.only_required_for_messages("confusing-with-statement")
2 def visit_with(self, node: nodes.With) -> None:
3 # a "with" statement with multiple managers corresponds
4 # to one AST "With" node with multiple items
5 pairs = node.items
6 if pairs:
7 for prev_pair, pair in zip(pairs, pairs[1:]):
8 if isinstance(prev_pair[1], nodes.AssignName) and (
9 pair[1] is None and not isinstance(pair[0], nodes.Call)
10 ):
11 # Don't emit a message if the second is a function call
12 # there's no way that can be mistaken for a name assignment.
13 # If the line number doesn't match
14 # we assume it's a nested "with".
15 self.add_message("confusing-with-statement", node=node)
Path 3: 3 calls (0.02)
With (3)
1@utils.only_required_for_messages("confusing-with-statement")
2 def visit_with(self, node: nodes.With) -> None:
3 # a "with" statement with multiple managers corresponds
4 # to one AST "With" node with multiple items
5 pairs = node.items
6 if pairs:
7 for prev_pair, pair in zip(pairs, pairs[1:]):
8 if isinstance(prev_pair[1], nodes.AssignName) and (
9 pair[1] is None and not isinstance(pair[0], nodes.Call)
10 ):
11 # Don't emit a message if the second is a function call
12 # there's no way that can be mistaken for a name assignment.
13 # If the line number doesn't match
14 # we assume it's a nested "with".
15 self.add_message("confusing-with-statement", node=node)
Path 4: 1 calls (0.01)
With (1)
1@utils.only_required_for_messages("confusing-with-statement")
2 def visit_with(self, node: nodes.With) -> None:
3 # a "with" statement with multiple managers corresponds
4 # to one AST "With" node with multiple items
5 pairs = node.items
6 if pairs:
7 for prev_pair, pair in zip(pairs, pairs[1:]):
8 if isinstance(prev_pair[1], nodes.AssignName) and (
9 pair[1] is None and not isinstance(pair[0], nodes.Call)
10 ):
11 # Don't emit a message if the second is a function call
12 # there's no way that can be mistaken for a name assignment.
13 # If the line number doesn't match
14 # we assume it's a nested "with".
15 self.add_message("confusing-with-statement", node=node)