MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / pythonRootHeads

Function pythonRootHeads

src/resolution/import-resolver.ts:1117–1128  ·  view source on GitHub ↗

Every root (project or local) providing the top-level name `head`, by kind.

(head: string, index: PythonModuleIndex)

Source from the content-addressed store, hash-verified

1115
1116/** Every root (project or local) providing the top-level name `head`, by kind. */
1117function pythonRootHeads(head: string, index: PythonModuleIndex): { concrete: string[]; namespace: string[] } {
1118 let heads = index.headsByName.get(head);
1119 if (!heads) {
1120 heads = { concrete: [], namespace: [] };
1121 for (const root of [...index.projectRoots, ...index.localRoots.keys()]) {
1122 const kind = pythonHeadKind(root, head, index);
1123 if (kind) heads[kind].push(root);
1124 }
1125 index.headsByName.set(head, heads);
1126 }
1127 return heads;
1128}
1129
1130/**
1131 * Resolve a Python import specifier to the file of the module it names —

Callers 1

resolvePythonModuleFunction · 0.85

Calls 4

pythonHeadKindFunction · 0.85
pushMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected