MCPcopy Create free account
hub / github.com/bab2min/tomotopy / setstate

Method setstate

src/python/handler/py_utils.cpp:65–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void VocabObject::setstate(PyObject* dict)
66{
67 PyObject* id2word = PyDict_GetItemString(dict, "id2word");
68 this->~VocabObject();
69 vocabs = new tomoto::Dictionary;
70 dep = {};
71 size = -1;
72 py::foreach<std::string>(id2word, [&](const std::string& str)
73 {
74 vocabs->add(str);
75 }, "");
76 if (PyErr_Occurred()) throw py::ExcPropagation{};
77}
78
79size_t VocabObject::len() const
80{

Callers

nothing calls this directly

Calls 4

~VocabObjectMethod · 0.95
emplace_backMethod · 0.80
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected