mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
add dict constructor of flags for implicit convertion back
This commit is contained in:
parent
3029b5422a
commit
3bb804eeaf
@ -149,6 +149,12 @@ PYBIND11_MODULE(pyngcore, m) // NOLINT
|
||||
py::class_<Flags>(m, "Flags")
|
||||
.def(py::init<>())
|
||||
.def("__str__", &ToString<Flags>)
|
||||
.def(py::init([](py::dict kwargs) {
|
||||
Flags flags;
|
||||
for (auto d : kwargs)
|
||||
SetFlag(flags, d.first.cast<string>(), d.second.cast<py::object>());
|
||||
return flags;
|
||||
}), "Create flags from dict")
|
||||
.def(py::init([](py::kwargs kwargs) {
|
||||
Flags flags;
|
||||
for (auto d : kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user