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

Function resolvePythonAbsoluteModule

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

* Resolve a Python ABSOLUTE dotted module import (`import a.b.c`) to its file — * the Django `AppConfig.ready(): import myapp.signals` pattern and any * side-effect module import.

(
  ref: UnresolvedRef,
  context: ResolutionContext
)

Source from the content-addressed store, hash-verified

1803 * side-effect module import.
1804 */
1805function resolvePythonAbsoluteModule(
1806 ref: UnresolvedRef,
1807 context: ResolutionContext
1808): ResolvedRef | null {
1809 if (ref.referenceKind !== 'imports') return null;
1810 // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1811 // (`from app.api.routes import authentication`) is ambiguous on its own — three
1812 // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1813 // which uses the import's source (`app.api.routes`) to build the full path.
1814 if (!ref.referenceName.includes('.')) return null;
1815 const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1816 return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1817}
1818
1819/**
1820 * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix

Callers 1

resolveViaImportFunction · 0.85

Calls 1

findPythonModuleFileFunction · 0.85

Tested by

no test coverage detected