MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / pythonModulePath

Function pythonModulePath

src/resolution/import-resolver.ts:4778–4784  ·  view source on GitHub ↗
(source: string, fromFile: string)

Source from the content-addressed store, hash-verified

4776 * `..forms` → 'app/forms'. Null when its dots climb above the project.
4777 */
4778export 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

Callers 2

namedFunction · 0.90
pythonImportBindingTailFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected