diff --git a/CHANGELOG.md b/CHANGELOG.md index f930c4a5ba288d827993d2d09f0bb484dbdc85f9..e5c0480e18a40db8b9b77d73c362ba3b8d077ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,4 +4,5 @@ have been made so far, between releases. # v1.2.6 -* _banana banana banana_ +* __repr__ improved + diff --git a/compile_definitions/__main__.py b/compile_definitions/__main__.py index c61f16799bd2cd8cae34265d8036ad94a341030c..2ddf101f38bb02a7d70aad220da9e8c45d7401b6 100644 --- a/compile_definitions/__main__.py +++ b/compile_definitions/__main__.py @@ -70,6 +70,11 @@ from coolamqp.framing.compilation import compile_particular_content_property_lis logger = logging.getLogger(__name__) +def to_repr(obj): + if isinstance(obj, memoryview): + obj = obj.tobytes().decode('utf8') + return repr(obj) + Field = collections.namedtuple('Field', ('name', 'type', 'basic_type', 'reserved')) '''.encode('utf8')) @@ -461,7 +466,7 @@ Field = collections.namedtuple('Field', ('name', 'type', 'basic_type', 'reserved :return: Python string representation """ - return '%s(%S)' % (', '.join(map(repr, [%s])))''', + return '%s(%S)' % (', '.join(map(to_repr, [%s])))''', full_class_name, u", ".join(['self.' + format_field_name(field.name) for field in non_reserved_fields])) diff --git a/coolamqp/__init__.py b/coolamqp/__init__.py index f9273f3273a57856cd3ff874fbfb72d80bb04b3a..59c4dbbfe30f17e53d76408684d1dab8b99091a1 100644 --- a/coolamqp/__init__.py +++ b/coolamqp/__init__.py @@ -1 +1 @@ -__version__ = '1.2.6_a1' +__version__ = '1.2.6_a2'