MCPcopy Create free account
hub / github.com/alibaba/graph-learn / PyArrayFromStringVector

Function PyArrayFromStringVector

graphlearn/python/c/py_wrapper.h:627–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627PyObject* PyArrayFromStringVector(
628 const std::string* const* data, npy_intp* size) {
629 PyArray_Descr* descr = PyArray_DescrFromType(NPY_OBJECT);
630 PyObject* obj = PyArray_Empty(1, size, descr, 0);
631 PyArrayObject* np_array = reinterpret_cast<PyArrayObject*>(obj);
632 PyObject** out = reinterpret_cast<PyObject**>(PyArray_DATA(np_array));
633 for (int32_t idx = 0; idx < size[0]; ++idx) {
634 out[idx] = PyBytes_FromString(data[idx]->c_str());
635 }
636 return obj;
637}
638
639PyObject* get_dag_value(GetDagValuesResponse* res,
640 int32_t node_id,

Callers 1

get_dag_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected