| 625 | } |
| 626 | |
| 627 | PyObject* 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 | |
| 639 | PyObject* get_dag_value(GetDagValuesResponse* res, |
| 640 | int32_t node_id, |