(source: string, fromFile: string)
| 5245 | * `..forms` → 'app/forms'. Null when its dots climb above the project. |
| 5246 | */ |
| 5247 | export function pythonModulePath(source: string, fromFile: string): string | null { |
| 5248 | const name = source.replace(/^\.+/, ''); |
| 5249 | const dots = source.length - name.length; |
| 5250 | if (dots === 0) return name.replace(/\./g, '/'); |
| 5251 | const modulePath = path.posix.join(path.posix.dirname(fromFile), '../'.repeat(dots - 1), name.replace(/\./g, '/')); |
| 5252 | return modulePath === '..' || modulePath.startsWith('../') ? null : modulePath; |
| 5253 | } |
| 5254 | |
| 5255 | /** |
| 5256 | * The import binding of the type a call's receiver is declared with, read the |
no test coverage detected