Add Flags.keys() in Python, for working dict(flags)

This commit is contained in:
Matthias Hochsteger 2023-07-19 19:07:39 +02:00
parent ca5f562503
commit 8e6ee3cbb8

View File

@ -165,6 +165,9 @@ PYBIND11_MODULE(pyngcore, m) // NOLINT
return self;
}, py::arg("akey"), py::arg("value"), "Set flag by given value.")
.def("keys", [](Flags & self) -> py::list {
return CreateDictFromFlags(self).attr("keys")();
})
.def("__getitem__", [](Flags & self, const string& name) -> py::object {
if(self.NumListFlagDefined(name))