Method: pylint.utils.ast_walker.ASTWalker.walk
Calls: 86988, Exceptions: 0, Paths: 13Back
Path 1: 39199 calls (0.45)
Name (16440) Const (12000) AssignName (9286) Arguments (1114) List (154) Dict (130) Tuple (46) DelName (14) Yield (10) Slice (3)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 2: 20764 calls (0.24)
Call (5721) Attribute (3223) Arguments (2653) List (1433) Subscript (1199) Compare (1143) Tuple (1031) BinOp (815) Keyword (788) AssignAttr (510)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 3: 9847 calls (0.11)
Assign (3740) FunctionDef (3469) ClassDef (1476) For (523) ExceptHandler (357) With (176) AsyncFunctionDef (54) TryFinally (52)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 4: 7607 calls (0.09)
Expr (3231) Return (1573) If (1201) AnnAssign (421) TryExcept (314) Raise (300) AugAssign (268) Assert (130) While (104) Delete (34)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 5: 2937 calls (0.03)
Pass (1350) ImportFrom (652) Import (615) Break (133) Raise (48) Return (46) Continue (38) Global (31) Nonlocal (24)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 6: 2349 calls (0.03)
Name (1773) Const (384) AssignName (150) Arguments (30) Module (11) List (1)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 7: 2047 calls (0.02)
Expr (1834) Assign (139) Return (32) FunctionDef (28) ClassDef (8) ExceptHandler (5) AugAssign (1)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 8: 1464 calls (0.02)
Module (960) Lambda (243) ListComp (133) GeneratorExp (71) DictComp (38) SetComp (19)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 9: 298 calls (0.0)
Module (146) BinOp (85) Call (20) Attribute (13) Keyword (11) Arguments (9) Tuple (8) List (5) Slice (1)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 10: 242 calls (0.0)
Import (119) ImportFrom (118) Pass (5)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 11: 187 calls (0.0)
Module (187)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 12: 45 calls (0.0)
ClassDef (45)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise
Path 13: 2 calls (0.0)
For (2)
1def walk(self, astroid: nodes.NodeNG) -> None:
2 """Call visit events of astroid checkers for the given node, recurse on
3 its children, then leave events.
4 """
5 cid = astroid.__class__.__name__.lower()
6
7 # Detect if the node is a new name for a deprecated alias.
8 # In this case, favour the methods for the deprecated
9 # alias if any, in order to maintain backwards
10 # compatibility.
11 visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
12 leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
13
14 # pylint: disable = too-many-try-statements
15 try:
16 if astroid.is_statement:
17 self.nbstatements += 1
18 # generate events for this node on each checker
19 for callback in visit_events:
20 callback(astroid)
21 # recurse on children
22 for child in astroid.get_children():
23 self.walk(child)
24 for callback in leave_events:
25 callback(astroid)
26 except Exception:
27 if self.exception_msg is False:
28 file = getattr(astroid.root(), "file", None)
29 print(
30 f"Exception on node {repr(astroid)} in file '{file}'",
31 file=sys.stderr,
32 )
33 traceback.print_exc()
34 self.exception_msg = True
35 raise