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

Function pythonModulePath

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

Source from the content-addressed store, hash-verified

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

Callers 2

namedFunction · 0.90
pythonImportBindingTailFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected