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:250–263  ·  view source on GitHub ↗

Resolve the module_name node for a Python import_from_statement.

Source from the content-addressed store, hash-verified

248
249// Resolve the module_name node for a Python import_from_statement.
250static TSNode resolve_py_module_node(TSNode node) {
251 TSNode module_node = ts_node_child_by_field_name(node, "module_name", FIELD_LEN_MODULE_NAME);
252 if (ts_node_is_null(module_node)) {
253 uint32_t nc = ts_node_child_count(node);
254 for (uint32_t j = 0; j < nc; j++) {
255 TSNode c = ts_node_child(node, j);
256 if (strcmp(ts_node_type(c), "dotted_name") == 0 ||
257 strcmp(ts_node_type(c), "relative_import") == 0) {
258 return c;
259 }
260 }
261 }
262 return module_node;
263}
264
265// Emit a Python import-from name child (identifier/dotted_name).
266static 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