From a120ae1fa7be5bac98e77755a6220df59e443b16 Mon Sep 17 00:00:00 2001 From: gatecat Date: Tue, 14 Dec 2021 18:47:35 +0000 Subject: python: Bind getBelLocation/getPipLocation Signed-off-by: gatecat --- common/pybindings.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/pybindings.cc') diff --git a/common/pybindings.cc b/common/pybindings.cc index f9ee9eb7..eef460ce 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -83,6 +83,8 @@ template <> struct string_converter } // namespace PythonConversion +std::string loc_repr_py(Loc loc) { return stringf("Loc(%d, %d, %d)", loc.x, loc.y, loc.z); } + PYBIND11_EMBEDDED_MODULE(MODULE_NAME, m) { py::register_exception_translator([](std::exception_ptr p) { @@ -175,7 +177,8 @@ PYBIND11_EMBEDDED_MODULE(MODULE_NAME, m) .def(py::init()) .def_readwrite("x", &Loc::x) .def_readwrite("y", &Loc::y) - .def_readwrite("z", &Loc::z); + .def_readwrite("z", &Loc::z) + .def("__repr__", loc_repr_py); auto ci_cls = py::class_>(m, "CellInfo"); readwrite_wrapper, -- cgit v1.2.3