Implement __repr__ for _StructureField
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 Nov 2017 16:56:46 +0000 (11:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 Nov 2017 20:16:22 +0000 (15:16 -0500)
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/bt2/bt2/fields.py

index 2f910635c4348bd9544580457fc4f9b828682e49..c79bb8996508f9dfb8f7b53066e617facd117fe4 100644 (file)
@@ -526,6 +526,10 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping):
 
     value = property(fset=_set_value)
 
+    def __repr__(self):
+        items = ['{}: {}'.format(repr(k), repr(v)) for k, v in self.items()]
+        return '{{{}}}'.format(', '.join(items))
+
 
 class _VariantField(_Field):
     _NAME = 'Variant'
This page took 0.035746 seconds and 4 git commands to generate.