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

Function python_import_root

internal/cbm/extract_imports.c:113–119  ·  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

111 * `import xml.etree` introduces `xml`. Keep module_path intact for dependency
112 * resolution while recording the language-correct local spelling. */
113static const char *python_import_root(CBMArena *a, const char *path) {
114 if (!path) {
115 return NULL;
116 }
117 const char *dot = strchr(path, '.');
118 return dot ? cbm_arena_strndup(a, path, (size_t)(dot - path)) : path;
119}
120
121// --- Go imports ---
122// 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