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

Function python_import_local_materialized

src/pipeline/pass_pkgmap.c:1654–1676  ·  view source on GitHub ↗

#2127, call side: an imported name binds the file's identifier to that * import for the whole module, exactly like a parameter binds it for a body. * When the import could not be materialized (external module) the resolver * falls through to project-wide short-name strategies and binds `patch(...)` * (or `mock.patch(...)`) to whatever project definition shares the leaf. True * when the callee

Source from the content-addressed store, hash-verified

1652 * name from anywhere -- and a chain consistent with the target (src/ layout)
1653 * keeps the edge. `gbuf` NULL means "no IMPORTS edges" (all external). */
1654static bool python_import_local_materialized(const cbm_gbuf_t *gbuf, const char *project_name,
1655 const char *rel_path, const char *local_name) {
1656 if (!gbuf || !rel_path) {
1657 return false;
1658 }
1659 char *file_qn = cbm_pipeline_fqn_compute(project_name, rel_path, "__file__");
1660 const cbm_gbuf_node_t *file_node = file_qn ? cbm_gbuf_find_by_qn(gbuf, file_qn) : NULL;
1661 safe_free(file_qn);
1662 const cbm_gbuf_edge_t **edges = NULL;
1663 int edge_count = 0;
1664 if (!file_node || cbm_gbuf_find_edges_by_source_type(gbuf, file_node->id, "IMPORTS", &edges,
1665 &edge_count) != 0) {
1666 return false;
1667 }
1668 char needle[CBM_SZ_256];
1669 snprintf(needle, sizeof(needle), "\"local_name\":\"%s\"", local_name);
1670 for (int i = 0; i < edge_count; i++) {
1671 if (edges[i]->properties_json && strstr(edges[i]->properties_json, needle)) {
1672 return true;
1673 }
1674 }
1675 return false;
1676}
1677
1678bool cbm_python_import_binding_contradicts(const CBMImportArray *imports, const char *callee_name,
1679 const char *resolved_qn, const cbm_gbuf_t *gbuf,

Callers 1

Calls 3

cbm_pipeline_fqn_computeFunction · 0.85
cbm_gbuf_find_by_qnFunction · 0.85

Tested by

no test coverage detected