(source: string, fromFile: string)
| 4998 | * `..forms` → 'app/forms'. Null when its dots climb above the project. |
| 4999 | */ |
| 5000 | export function pythonModulePath(source: string, fromFile: string): string | null { |
| 5001 | const name = source.replace(/^\.+/, ''); |
| 5002 | const dots = source.length - name.length; |
| 5003 | if (dots === 0) return name.replace(/\./g, '/'); |
| 5004 | const modulePath = path.posix.join(path.posix.dirname(fromFile), '../'.repeat(dots - 1), name.replace(/\./g, '/')); |
| 5005 | return modulePath === '..' || modulePath.startsWith('../') ? null : modulePath; |
| 5006 | } |
| 5007 | |
| 5008 | /** |
| 5009 | * The import binding of the type a call's receiver is declared with, read the |
no test coverage detected