* 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 )
| 1788 | * side-effect module import. |
| 1789 | */ |
| 1790 | function resolvePythonAbsoluteModule( |
| 1791 | ref: UnresolvedRef, |
| 1792 | context: ResolutionContext |
| 1793 | ): ResolvedRef | null { |
| 1794 | if (ref.referenceKind !== 'imports') return null; |
| 1795 | // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf |
| 1796 | // (`from app.api.routes import authentication`) is ambiguous on its own — three |
| 1797 | // `authentication.py` files may exist — so leave it to resolveModuleImportToFile, |
| 1798 | // which uses the import's source (`app.api.routes`) to build the full path. |
| 1799 | if (!ref.referenceName.includes('.')) return null; |
| 1800 | const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath); |
| 1801 | return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null; |
| 1802 | } |
| 1803 | |
| 1804 | /** |
| 1805 | * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix |
no test coverage detected