MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / python_import_root

Function python_import_root

internal/cbm/extract_imports.c:118–124  ·  view source on GitHub ↗

An unaliased dotted Python import binds its first component, not its last: * `import xml.etree` introduces `xml`. Keep module_path intact for dependency * resolution while recording the language-correct local spelling. */

Source from the content-addressed store, hash-verified

116 * `import xml.etree` introduces `xml`. Keep module_path intact for dependency
117 * resolution while recording the language-correct local spelling. */
118static const char *python_import_root(CBMArena *a, const char *path) {
119 if (!path) {
120 return NULL;
121 }
122 const char *dot = strchr(path, '.');
123 return dot ? cbm_arena_strndup(a, path, (size_t)(dot - path)) : path;
124}
125
126// --- Go imports ---
127// import_declaration -> import_spec_list -> import_spec -> (name, path)

Callers 1

process_py_import_stmtFunction · 0.85

Calls 1

cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected