From db3767f7ef2b551eb6a0d776192a3f09eb4c5ea4 Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 28 Feb 2018 17:13:52 +0100 Subject: [PATCH] tweak prettyprint for some known elements --- trezorlib/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/trezorlib/client.py b/trezorlib/client.py index d0c63b0264..62c8ca441f 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -105,11 +105,14 @@ def format_protobuf(pb, indent=0, sep=' '*4): for key, val in sorted(value.items()): if val is None or val == []: continue - lines.append(leadin + key + ': ' + pformat_value(val, indent + 1) + ',') + if key == 'address_n' and isinstance(val, list): + lines.append(leadin + key + ': ' + repr(val) + ',') + else: + lines.append(leadin + key + ': ' + pformat_value(val, indent + 1) + ',') lines.append(level + '}') return '\n'.join(lines) - if isinstance(value, bytes) or isinstance(value, bytearray): - return '{type}(0x{hex})'.format(type=type(value).__name__, hex=value.hex()) + if isinstance(value, bytearray): + return 'bytearray(0x{})'.format(value.hex()) return repr(value)