MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / py_repr

Function py_repr

imperative/python/src/ops.cpp:208–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206
207template <typename T>
208struct EnumWrapper {
209 PyEnumHead std::string to_string() const {
210 return members[static_cast<size_t>(value)];
211 }
212 static PyObject* py_repr(PyObject* self) {
213 return py::cast(
214 std::string(name) + "." +
215 reinterpret_cast<EnumWrapper*>(self)->to_string())
216 .release()
217 .ptr();
218 }
219
220 static PyObject* py_dump(PyObject* self) {
221 return py::cast(reinterpret_cast<EnumWrapper*>(self)->to_string())

Callers

nothing calls this directly

Calls 4

castFunction · 0.85
ptrMethod · 0.45
releaseMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected