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

Function isProjectPythonModule

src/resolution/import-resolver.ts:4736–4742  ·  view source on GitHub ↗

* Whether a Python import's module is in one of the project's own folders: a * relative one is, and an absolute one when a folder of the project ends in its * dotted path (`app/api` for `app.api`, the package) or in the package holding * it (`app` for `app.api`, a module file), at any depth, as `

(source: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

4734 * `fastapi/` keeps its other files.
4735 */
4736function isProjectPythonModule(source: string, context: ResolutionContext): boolean {
4737 if (source.startsWith('.')) return true;
4738 const folders = projectFolderSuffixes(context);
4739 const modulePath = source.replace(/\./g, '/');
4740 const slash = modulePath.lastIndexOf('/');
4741 return folders.has(modulePath) || (slash > 0 && folders.has(modulePath.slice(0, slash)));
4742}
4743
4744/**
4745 * Per-context memo: every trailing run of folder names the project's files sit

Callers 1

pythonImportBindingTailFunction · 0.85

Calls 2

projectFolderSuffixesFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected