(root: Path)
| 53 | |
| 54 | |
| 55 | def 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 | |
| 71 | def find_cycles(edges: dict[str, set[str]]) -> list[list[str]]: |
no test coverage detected