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

Function extractPythonReExports

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

* A Python module's imports ARE its re-exports: `from .impl import foo` makes * `foo` an attribute of the module, which is exactly how a package * `__init__.py` publishes its API. Chased only after a direct lookup misses, * with the shared cycle guard and depth cap.

(content: string)

Source from the content-addressed store, hash-verified

2723 * with the shared cycle guard and depth cap.
2724 */
2725function extractPythonReExports(content: string): ReExport[] {
2726 const out: ReExport[] = [];
2727 for (const { source, names, star } of pythonFromImports(stripCommentsForRegex(content, 'python'))) {
2728 if (star) out.push({ kind: 'wildcard', source });
2729 for (const { name, alias } of names) {
2730 out.push({ kind: 'named', exportedName: alias, originalName: name, source });
2731 }
2732 }
2733 return out;
2734}
2735
2736/**
2737 * Resolve a reference using import mappings

Callers 1

extractReExportsFunction · 0.85

Calls 3

stripCommentsForRegexFunction · 0.90
pythonFromImportsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected