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

Function pythonRootHeads

src/resolution/import-resolver.ts:871–882  ·  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

869
870/** Every root (project or local) providing the top-level name `head`, by kind. */
871function pythonRootHeads(head: string, index: PythonModuleIndex): { concrete: string[]; namespace: string[] } {
872 let heads = index.headsByName.get(head);
873 if (!heads) {
874 heads = { concrete: [], namespace: [] };
875 for (const root of [...index.projectRoots, ...index.localRoots.keys()]) {
876 const kind = pythonHeadKind(root, head, index);
877 if (kind) heads[kind].push(root);
878 }
879 index.headsByName.set(head, heads);
880 }
881 return heads;
882}
883
884/**
885 * 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