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

Function isProjectPythonModule

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

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