MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / internal_edges

Function internal_edges

tools/find_import_cycles.py:55–68  ·  view source on GitHub ↗
(root: Path)

Source from the content-addressed store, hash-verified

53
54
55def internal_edges(root: Path) -> dict[str, set[str]]:
56 mod_to_file = module_to_file_map(root)
57 internal = set(mod_to_file)
58 edges: dict[str, set[str]] = defaultdict(set)
59
60 for mod, file in mod_to_file.items():
61 for imported in extract_imports(file, mod):
62 # Keep only imports that are inside the package
63 for candidate in internal:
64 if imported == candidate or imported.startswith(candidate + "."):
65 edges[mod].add(candidate)
66 break
67
68 return edges
69
70
71def find_cycles(edges: dict[str, set[str]]) -> list[list[str]]:

Callers 1

mainFunction · 0.85

Calls 4

module_to_file_mapFunction · 0.85
extract_importsFunction · 0.85
itemsMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected