MCPcopy Create free account
hub / github.com/pybind/pybind11 / enum_name

Function enum_name

include/pybind11/pybind11.h:2931–2939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2929PYBIND11_NAMESPACE_BEGIN(detail)
2930
2931inline str enum_name(handle arg) {
2932 dict entries = type::handle_of(arg).attr("__entries");
2933 for (auto kv : entries) {
2934 if (handle(kv.second[int_(0)]).equal(arg)) {
2935 return pybind11::str(kv.first);
2936 }
2937 }
2938 return "???";
2939}
2940
2941struct enum_base {
2942 enum_base(const handle &base, const handle &parent) : m_base(base), m_parent(parent) {}

Callers 1

initFunction · 0.85

Calls 5

int_Class · 0.85
strClass · 0.85
attrMethod · 0.80
handleFunction · 0.70
equalMethod · 0.45

Tested by

no test coverage detected