From: Marc Schink Date: Fri, 29 Mar 2024 12:41:19 +0000 (+0100) Subject: bindings/python: Add __repr__() to 'Driver' class X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=90a9e8916111b4d0d8c0f52894b1870d6b987555;p=libsigrok.git bindings/python: Add __repr__() to 'Driver' class The following lines show the class string representation before and after this patch: *' at 0x7fdf4b29cff0> > Driver (name='demo', long_name='Demo driver and pattern generator') Signed-off-by: Marc Schink --- diff --git a/bindings/python/sigrok/core/classes.i b/bindings/python/sigrok/core/classes.i index 325983d7..efcd763e 100644 --- a/bindings/python/sigrok/core/classes.i +++ b/bindings/python/sigrok/core/classes.i @@ -494,6 +494,12 @@ std::map dict_to_map_options(PyObject *dict, return $self->scan(options); } + +%pythoncode +{ + def __repr__(self): + return _class_attribute_repr(self, ['name', 'long_name']) +} } %pythoncode