From dcd59c16efb9a56ce1a729c51c0222680dac8545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Thu, 9 Jul 2020 18:20:05 +0200
Subject: [PATCH] __repr__ for method frames improved

---
 CHANGELOG.md                    | 3 ++-
 compile_definitions/__main__.py | 7 ++++++-
 coolamqp/__init__.py            | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f930c4a..e5c0480 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 c61f167..2ddf101 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 f9273f3..59c4dbb 100644
--- a/coolamqp/__init__.py
+++ b/coolamqp/__init__.py
@@ -1 +1 @@
-__version__ = '1.2.6_a1'
+__version__ = '1.2.6_a2'
-- 
GitLab