+ def __repr__(self):
+ items = ['{}: {}'.format(repr(k), repr(v)) for k, v in self.items()]
+ return '{{{}}}'.format(', '.join(items))
+
+
+class MapValue(_MapValueConst, _Container, collections.abc.MutableMapping, _Value):
+ _NAME = 'Map'
+ _borrow_entry_value_ptr = staticmethod(native_bt.value_map_borrow_entry_value)
+
+ def __init__(self, value=None):
+ ptr = native_bt.value_map_create()
+ self._check_create_status(ptr)
+ super().__init__(ptr)
+
+ # Python will raise a TypeError if there's anything wrong with
+ # the iterable/mapping protocol.
+ if value is not None:
+ for key, elem in value.items():
+ self[key] = elem
+