* 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)
| 4734 | * `fastapi/` keeps its other files. |
| 4735 | */ |
| 4736 | function isProjectPythonModule(source: string, context: ResolutionContext): boolean { |
| 4737 | if (source.startsWith('.')) return true; |
| 4738 | const folders = projectFolderSuffixes(context); |
| 4739 | const modulePath = source.replace(/\./g, '/'); |
| 4740 | const slash = modulePath.lastIndexOf('/'); |
| 4741 | return folders.has(modulePath) || (slash > 0 && folders.has(modulePath.slice(0, slash))); |
| 4742 | } |
| 4743 | |
| 4744 | /** |
| 4745 | * Per-context memo: every trailing run of folder names the project's files sit |
no test coverage detected