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

Resolve the module_name node for a Python import_from_statement.

Source from the content-addressed store, hash-verified

230
231// Resolve the module_name node for a Python import_from_statement.
232static TSNode resolve_py_module_node(TSNode node) {
233 TSNode module_node = ts_node_child_by_field_name(node, "module_name", FIELD_LEN_MODULE_NAME);
234 if (ts_node_is_null(module_node)) {
235 uint32_t nc = ts_node_child_count(node);
236 for (uint32_t j = 0; j < nc; j++) {
237 TSNode c = ts_node_child(node, j);
238 if (strcmp(ts_node_type(c), "dotted_name") == 0 ||
239 strcmp(ts_node_type(c), "relative_import") == 0) {
240 return c;
241 }
242 }
243 }
244 return module_node;
245}
246
247// Emit a Python import-from name child (identifier/dotted_name).
248static 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