* Whether a Python import's module is in one of the project's own folders: a * relative one is, and an absolute one when a folder of the project ends in its * dotted path (`app/api` for `app.api`, the package) or in the package holding * it (`app` for `app.api`, a module file), at any depth, as `
(source: string, context: ResolutionContext)
| 4956 | * `fastapi/` keeps its other files. |
| 4957 | */ |
| 4958 | function isProjectPythonModule(source: string, context: ResolutionContext): boolean { |
| 4959 | if (source.startsWith('.')) return true; |
| 4960 | const folders = projectFolderSuffixes(context); |
| 4961 | const modulePath = source.replace(/\./g, '/'); |
| 4962 | const slash = modulePath.lastIndexOf('/'); |
| 4963 | return folders.has(modulePath) || (slash > 0 && folders.has(modulePath.slice(0, slash))); |
| 4964 | } |
| 4965 | |
| 4966 | /** |
| 4967 | * Per-context memo: every trailing run of folder names the project's files sit |
no test coverage detected