From: Marc Schink Date: Fri, 29 Mar 2024 12:41:45 +0000 (+0100) Subject: bindings/python: Add __repr__() to 'ChannelGroup' class X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=refs%2Fremotes%2Fgithub%2Fmaster;p=libsigrok.git bindings/python: Add __repr__() to 'ChannelGroup' class The following lines show the class string representation before and after this patch: *' at 0x7fdf4b29f660> > ChannelGroup (name='A0', channels=(Channel (type=ChannelType.ANALOG, name='A0', index=8, enabled=True),)) Signed-off-by: Marc Schink --- diff --git a/bindings/python/sigrok/core/classes.i b/bindings/python/sigrok/core/classes.i index 46672a39..90667f59 100644 --- a/bindings/python/sigrok/core/classes.i +++ b/bindings/python/sigrok/core/classes.i @@ -623,4 +623,13 @@ std::map dict_to_map_options(PyObject *dict, } } +%extend sigrok::ChannelGroup +{ +%pythoncode +{ + def __repr__(self): + return _class_attribute_repr(self, ['name', 'channels']) +} +} + %include "doc_end.i"