Path 1: 3920 calls (0.63)

list (3455) [] (465)

FunctionDef (3110) ClassDef (487) Module (271) AsyncFunctionDef (52)

list (3455) [] (465)

1def _get_functions(
2            functions: list[nodes.NodeNG], tree: nodes.NodeNG
3        ) -> list[nodes.NodeNG]:
4            """Recursively get all functions including nested in the classes from the
5            tree.
6            """
7
8            for node in tree.body:
9                if isinstance(node, (nodes.FunctionDef, nodes.AsyncFunctionDef)):
10                    functions.append(node)
11
12                if isinstance(
13                    node,
14                    (nodes.ClassDef, nodes.FunctionDef, nodes.AsyncFunctionDef),
15                ):
16                    _get_functions(functions, node)
17
18            return functions
            

Path 2: 1501 calls (0.24)

list (813) [] (688)

ClassDef (928) Module (466) FunctionDef (105) AsyncFunctionDef (2)

list (1501)

1def _get_functions(
2            functions: list[nodes.NodeNG], tree: nodes.NodeNG
3        ) -> list[nodes.NodeNG]:
4            """Recursively get all functions including nested in the classes from the
5            tree.
6            """
7
8            for node in tree.body:
9                if isinstance(node, (nodes.FunctionDef, nodes.AsyncFunctionDef)):
10                    functions.append(node)
11
12                if isinstance(
13                    node,
14                    (nodes.ClassDef, nodes.FunctionDef, nodes.AsyncFunctionDef),
15                ):
16                    _get_functions(functions, node)
17
18            return functions
            

Path 3: 486 calls (0.08)

list (260) [] (226)

Module (197) FunctionDef (195) ClassDef (93) AsyncFunctionDef (1)

list (260) [] (226)

1def _get_functions(
2            functions: list[nodes.NodeNG], tree: nodes.NodeNG
3        ) -> list[nodes.NodeNG]:
4            """Recursively get all functions including nested in the classes from the
5            tree.
6            """
7
8            for node in tree.body:
9                if isinstance(node, (nodes.FunctionDef, nodes.AsyncFunctionDef)):
10                    functions.append(node)
11
12                if isinstance(
13                    node,
14                    (nodes.ClassDef, nodes.FunctionDef, nodes.AsyncFunctionDef),
15                ):
16                    _get_functions(functions, node)
17
18            return functions
            

Path 4: 274 calls (0.04)

[] (228) list (46)

Module (227) FunctionDef (42) ClassDef (5)

list (219) [] (55)

1def _get_functions(
2            functions: list[nodes.NodeNG], tree: nodes.NodeNG
3        ) -> list[nodes.NodeNG]:
4            """Recursively get all functions including nested in the classes from the
5            tree.
6            """
7
8            for node in tree.body:
9                if isinstance(node, (nodes.FunctionDef, nodes.AsyncFunctionDef)):
10                    functions.append(node)
11
12                if isinstance(
13                    node,
14                    (nodes.ClassDef, nodes.FunctionDef, nodes.AsyncFunctionDef),
15                ):
16                    _get_functions(functions, node)
17
18            return functions