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

Function isProjectPythonModule

src/resolution/import-resolver.ts:4958–4964  ·  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

4956 * `fastapi/` keeps its other files.
4957 */
4958function isProjectPythonModule(source: string, context: ResolutionContext): boolean {
4959 if (source.startsWith('.')) return true;
4960 const folders = projectFolderSuffixes(context);
4961 const modulePath = source.replace(/\./g, '/');
4962 const slash = modulePath.lastIndexOf('/');
4963 return folders.has(modulePath) || (slash > 0 && folders.has(modulePath.slice(0, slash)));
4964}
4965
4966/**
4967 * 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