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

Function pythonModuleAt

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

* The module file at `base` (dir-relative path), in Python's own order: a * regular package `base/__init__.py` beats a module `base.py`; a bare * directory (a namespace portion) has no file of its own.

(base: string, index: PythonModuleIndex)

Source from the content-addressed store, hash-verified

819 * directory (a namespace portion) has no file of its own.
820 */
821function pythonModuleAt(base: string, index: PythonModuleIndex): string | null {
822 const init = joinRel(base, '__init__.py');
823 if (index.files.has(init)) return init;
824 return index.files.has(`${base}.py`) ? `${base}.py` : null;
825}
826
827/**
828 * The module file for the dotted path `relPath` (slash-joined) under `root`,

Callers 2

pythonModuleUnderFunction · 0.85
pythonHeadKindFunction · 0.85

Calls 2

joinRelFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected