From 8e6ee3cbb8fa030a9f09953b2d8fcea83ba4e812 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 19 Jul 2023 19:07:39 +0200 Subject: [PATCH] Add Flags.keys() in Python, for working dict(flags) --- libsrc/core/python_ngcore_export.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsrc/core/python_ngcore_export.cpp b/libsrc/core/python_ngcore_export.cpp index facbcda7..25098812 100644 --- a/libsrc/core/python_ngcore_export.cpp +++ b/libsrc/core/python_ngcore_export.cpp @@ -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))