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

Function resolve_py_module_node

internal/cbm/extract_imports.c:221–234  ·  view source on GitHub ↗

Resolve the module_name node for a Python import_from_statement.

Source from the content-addressed store, hash-verified

219
220// Resolve the module_name node for a Python import_from_statement.
221static TSNode resolve_py_module_node(TSNode node) {
222 TSNode module_node = ts_node_child_by_field_name(node, "module_name", FIELD_LEN_MODULE_NAME);
223 if (ts_node_is_null(module_node)) {
224 uint32_t nc = ts_node_child_count(node);
225 for (uint32_t j = 0; j < nc; j++) {
226 TSNode c = ts_node_child(node, j);
227 if (strcmp(ts_node_type(c), "dotted_name") == 0 ||
228 strcmp(ts_node_type(c), "relative_import") == 0) {
229 return c;
230 }
231 }
232 }
233 return module_node;
234}
235
236// Emit a Python import-from name child (identifier/dotted_name).
237static void emit_py_import_from_name(CBMExtractCtx *ctx, TSNode child, const char *mod_path) {

Callers 1

process_py_import_fromFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected