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

Function pythonModulePath

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

Source from the content-addressed store, hash-verified

4999 * `..forms` → 'app/forms'. Null when its dots climb above the project.
5000 */
5001export function pythonModulePath(source: string, fromFile: string): string | null {
5002 const name = source.replace(/^\.+/, '');
5003 const dots = source.length - name.length;
5004 if (dots === 0) return name.replace(/\./g, '/');
5005 const modulePath = path.posix.join(path.posix.dirname(fromFile), '../'.repeat(dots - 1), name.replace(/\./g, '/'));
5006 return modulePath === '..' || modulePath.startsWith('../') ? null : modulePath;
5007}
5008
5009/**
5010 * 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