Method: pylint.graph._get_cycles
Calls: 195, Exceptions: 0, Paths: 5Back
Path 1: 112 calls (0.57)
defaultdict (112)
['test_pylint_runners'] (18) [] (7) ['pylint.checkers'] (6) ['conftest'] (6) ['functional.u.ungrouped_imports_isort_compatible'] (4) ['lint.test_pylin...
set() (69) {'typing_extensions'} (4) {'astroid'} (3) {'pylint.testutils', 'typing_extensions'} (3) {'pylint.testutils', 'pytest', 'typing_extensions'}...
[] (105) list (7)
'typing_extensions' (12) 'astroid' (11) 'pytest' (7) 'input.func_w0401_package.thing1' (4) 'input.func_noerror_cycle.b' (4) 'pylint' (4) 'pylint.testu...
1def _get_cycles(
2 graph_dict: dict[str, set[str]],
3 path: list[str],
4 visited: set[str],
5 result: list[list[str]],
6 vertice: str,
7) -> None:
8 """Recursive function doing the real work for get_cycles."""
9 if vertice in path:
10 cycle = [vertice]
11 for node in path[::-1]:
12 if node == vertice:
13 break
14 cycle.insert(0, node)
15 # make a canonical representation
16 start_from = min(cycle)
17 index = cycle.index(start_from)
18 cycle = cycle[index:] + cycle[0:index]
19 # append it to result if not already in
20 if cycle not in result:
21 result.append(cycle)
22 return
23 path.append(vertice)
24 try:
25 for node in graph_dict[vertice]:
26 # don't check already visited nodes again
27 if node not in visited:
28 _get_cycles(graph_dict, path, visited, result, node)
29 visited.add(node)
30 except KeyError:
31 pass
32 path.pop()
Path 2: 74 calls (0.38)
defaultdict (74)
[] (66) ['input.func_w0401_package.all_the_things'] (2) ['input.func_w0401_package.thing2'] (2) ['input.func_w0401'] (2) ['input.w0401_cycle'] (2)
set() (72) {'input.func_w0401_package.thing1'} (2)
[] (62) list (12)
'input.w0401_cycle' (7) 'input.func_w0401_package.all_the_things' (4) 'input.func_w0401_package.thing2' (4) 'input.func_w0401' (4) 'test_pylint_runner...
1def _get_cycles(
2 graph_dict: dict[str, set[str]],
3 path: list[str],
4 visited: set[str],
5 result: list[list[str]],
6 vertice: str,
7) -> None:
8 """Recursive function doing the real work for get_cycles."""
9 if vertice in path:
10 cycle = [vertice]
11 for node in path[::-1]:
12 if node == vertice:
13 break
14 cycle.insert(0, node)
15 # make a canonical representation
16 start_from = min(cycle)
17 index = cycle.index(start_from)
18 cycle = cycle[index:] + cycle[0:index]
19 # append it to result if not already in
20 if cycle not in result:
21 result.append(cycle)
22 return
23 path.append(vertice)
24 try:
25 for node in graph_dict[vertice]:
26 # don't check already visited nodes again
27 if node not in visited:
28 _get_cycles(graph_dict, path, visited, result, node)
29 visited.add(node)
30 except KeyError:
31 pass
32 path.pop()
Path 3: 4 calls (0.02)
defaultdict (4)
['input.func_w0401_package.all_the_things', 'input.func_w0401_package.thing2'] (2) ['input.func_w0401', 'input.w0401_cycle'] (2)
{'input.func_w0401_package.thing1'} (2) set() (2)
[] (3) list (1)
'input.func_w0401_package.all_the_things' (2) 'input.func_w0401' (2)
None (4)
1def _get_cycles(
2 graph_dict: dict[str, set[str]],
3 path: list[str],
4 visited: set[str],
5 result: list[list[str]],
6 vertice: str,
7) -> None:
8 """Recursive function doing the real work for get_cycles."""
9 if vertice in path:
10 cycle = [vertice]
11 for node in path[::-1]:
12 if node == vertice:
13 break
14 cycle.insert(0, node)
15 # make a canonical representation
16 start_from = min(cycle)
17 index = cycle.index(start_from)
18 cycle = cycle[index:] + cycle[0:index]
19 # append it to result if not already in
20 if cycle not in result:
21 result.append(cycle)
22 return
23 path.append(vertice)
24 try:
25 for node in graph_dict[vertice]:
26 # don't check already visited nodes again
27 if node not in visited:
28 _get_cycles(graph_dict, path, visited, result, node)
29 visited.add(node)
30 except KeyError:
31 pass
32 path.pop()
Path 4: 4 calls (0.02)
defaultdict (4)
['input.func_w0401_package.thing2', 'input.func_w0401_package.all_the_things'] (2) ['input.w0401_cycle', 'input.func_w0401'] (2)
{'input.func_w0401_package.thing1'} (2) set() (2)
list (4)
'input.func_w0401_package.thing2' (2) 'input.w0401_cycle' (2)
None (4)
1def _get_cycles(
2 graph_dict: dict[str, set[str]],
3 path: list[str],
4 visited: set[str],
5 result: list[list[str]],
6 vertice: str,
7) -> None:
8 """Recursive function doing the real work for get_cycles."""
9 if vertice in path:
10 cycle = [vertice]
11 for node in path[::-1]:
12 if node == vertice:
13 break
14 cycle.insert(0, node)
15 # make a canonical representation
16 start_from = min(cycle)
17 index = cycle.index(start_from)
18 cycle = cycle[index:] + cycle[0:index]
19 # append it to result if not already in
20 if cycle not in result:
21 result.append(cycle)
22 return
23 path.append(vertice)
24 try:
25 for node in graph_dict[vertice]:
26 # don't check already visited nodes again
27 if node not in visited:
28 _get_cycles(graph_dict, path, visited, result, node)
29 visited.add(node)
30 except KeyError:
31 pass
32 path.pop()
Path 5: 1 calls (0.01)
defaultdict (1)
['y'] (1)
{'y.one'} (1)
[] (1)
'y.two' (1)
1def _get_cycles(
2 graph_dict: dict[str, set[str]],
3 path: list[str],
4 visited: set[str],
5 result: list[list[str]],
6 vertice: str,
7) -> None:
8 """Recursive function doing the real work for get_cycles."""
9 if vertice in path:
10 cycle = [vertice]
11 for node in path[::-1]:
12 if node == vertice:
13 break
14 cycle.insert(0, node)
15 # make a canonical representation
16 start_from = min(cycle)
17 index = cycle.index(start_from)
18 cycle = cycle[index:] + cycle[0:index]
19 # append it to result if not already in
20 if cycle not in result:
21 result.append(cycle)
22 return
23 path.append(vertice)
24 try:
25 for node in graph_dict[vertice]:
26 # don't check already visited nodes again
27 if node not in visited:
28 _get_cycles(graph_dict, path, visited, result, node)
29 visited.add(node)
30 except KeyError:
31 pass
32 path.pop()