MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / resolvePythonAbsoluteModule

Function resolvePythonAbsoluteModule

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

1540 * side-effect module import.
1541 */
1542function resolvePythonAbsoluteModule(
1543 ref: UnresolvedRef,
1544 context: ResolutionContext
1545): ResolvedRef | null {
1546 if (ref.referenceKind !== 'imports') return null;
1547 // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1548 // (`from app.api.routes import authentication`) is ambiguous on its own — three
1549 // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1550 // which uses the import's source (`app.api.routes`) to build the full path.
1551 if (!ref.referenceName.includes('.')) return null;
1552 const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1553 return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1554}
1555
1556/**
1557 * 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