From 2a2da218790277c8eb8a8100ce26955bf8f1810c Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 25 Oct 2021 13:46:28 +0200 Subject: [PATCH] fix(python/debuglink): fix formatting for expected messages This was broken by the previous commit removing f-strings. For this reason, `format()` was renamed to `to_string` to make it clearer that it's not the `str.format` method. --- python/src/trezorlib/debuglink.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index 1fa2051908..b147b51171 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -307,7 +307,7 @@ class MessageFilter: return True - def format(self, maxwidth=80): + def to_string(self, maxwidth=80): fields = [] for field in self.message_type.FIELDS.values(): if field.name not in self.fields: @@ -316,7 +316,7 @@ class MessageFilter: if isinstance(value, IntEnum): field_str = value.name elif isinstance(value, MessageFilter): - field_str = value.format(maxwidth - 4) + field_str = value.to_string(maxwidth - 4) elif isinstance(value, protobuf.MessageType): field_str = protobuf.format_message(value) else: @@ -563,7 +563,7 @@ class TrezorClientDebugLink(TrezorClient): for i in range(start_at, stop_at): exp = expected[i] prefix = " " if i != current else ">>> " - output.append(textwrap.indent(exp, prefix)) + output.append(textwrap.indent(exp.to_string(), prefix)) if stop_at < len(expected): omitted = len(expected) - stop_at output.append(f" (...{omitted} following responses omitted)")