* 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)
| 5203 | * `fastapi/` keeps its other files. |
| 5204 | */ |
| 5205 | function isProjectPythonModule(source: string, context: ResolutionContext): boolean { |
| 5206 | if (source.startsWith('.')) return true; |
| 5207 | const folders = projectFolderSuffixes(context); |
| 5208 | const modulePath = source.replace(/\./g, '/'); |
| 5209 | const slash = modulePath.lastIndexOf('/'); |
| 5210 | return folders.has(modulePath) || (slash > 0 && folders.has(modulePath.slice(0, slash))); |
| 5211 | } |
| 5212 | |
| 5213 | /** |
| 5214 | * Per-context memo: every trailing run of folder names the project's files sit |
no test coverage detected