| 10 | using namespace std; |
| 11 | |
| 12 | inline tomoto::RawDoc::MiscType transformMisc(const tomoto::RawDoc::MiscType& misc, PyObject* transform) |
| 13 | { |
| 14 | if (!transform || transform == Py_None) return misc; |
| 15 | py::UniqueObj args{ py::buildPyValue(misc) }; |
| 16 | py::UniqueObj res{ PyObject_CallFunctionObjArgs(transform, args.get(), nullptr) }; |
| 17 | if (!res) throw py::ExcPropagation{}; |
| 18 | tomoto::RawDoc::MiscType ret; |
| 19 | if (!py::toCpp(res.get(), ret)) |
| 20 | { |
| 21 | throw py::ValueError{ "`transform` must return an instance of `dict`." }; |
| 22 | } |
| 23 | return ret; |
| 24 | } |
| 25 | |
| 26 | tomoto::RawDoc::MiscType LDAModelObject::convertMisc(const tomoto::RawDoc::MiscType& o) const |
| 27 | { |
no test coverage detected