(source: string, fromFile: string)
| 4776 | * `..forms` → 'app/forms'. Null when its dots climb above the project. |
| 4777 | */ |
| 4778 | export function pythonModulePath(source: string, fromFile: string): string | null { |
| 4779 | const name = source.replace(/^\.+/, ''); |
| 4780 | const dots = source.length - name.length; |
| 4781 | if (dots === 0) return name.replace(/\./g, '/'); |
| 4782 | const modulePath = path.posix.join(path.posix.dirname(fromFile), '../'.repeat(dots - 1), name.replace(/\./g, '/')); |
| 4783 | return modulePath === '..' || modulePath.startsWith('../') ? null : modulePath; |
| 4784 | } |
| 4785 | |
| 4786 | /** |
| 4787 | * The import binding of the type a call's receiver is declared with, read the |
no test coverage detected