From 827ccbfa07df08c670ab66eceff95869a56352fe Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Aug 2019 11:42:44 +1000 Subject: [PATCH] protcol: just print the class name during str() doesn't make things easier to debug Signed-off-by: Peter Hutterer --- tuhi/protocol.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tuhi/protocol.py b/tuhi/protocol.py index 6c02419..e3845f2 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -144,7 +144,7 @@ def as_hex_string(data): elif isinstance(data, list): return ' '.join([f'{x:02x}' for x in data]) - raise ValueError('Unsupported data format {data.__class__} for {data}') + raise ValueError('Unsupported data format {data.__class__.__name__} for {data}') def _get_protocol_dictionary(protocol): @@ -391,7 +391,7 @@ class UnexpectedReply(ProtocolError): self.msg = msg def __str__(self): - return f'{self.__class__}: {self.msg}: {self.message}' + return f'{self.__class__.__name__}: {self.msg}: {self.message}' class UnexpectedDataError(ProtocolError): @@ -413,7 +413,7 @@ class UnexpectedDataError(ProtocolError): self.bytes = bytes def __str__(self): - return f'{self.__class__}: {self.bytes} - {self.message}' + return f'{self.__class__.__name__}: {self.bytes} - {self.message}' class DeviceError(ProtocolError): @@ -563,7 +563,7 @@ class Msg(object): return self # allow chaining def __str__(self): - return f'{self.__class__}: {self.interaction} - {self.request} → {self.reply}' + return f'{self.__class__.__name__}: {self.interaction} - {self.request} → {self.reply}' class MsgConnectIntuosPro(Msg):