diff --git a/.flake8 b/.flake8 index c1e3840..f70b8f4 100644 --- a/.flake8 +++ b/.flake8 @@ -19,4 +19,6 @@ ignore = # E402: module level import not at top of file E402, # E501: line too long - E501 + E501, + # E721: do not compare types, use 'isinstance()' + E721 diff --git a/trezorlib/client.py b/trezorlib/client.py index aeea308..eb99231 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -254,18 +254,18 @@ class TextUIMixin(object): return proto.WordAck(word='\x08') # ignore middle column if only 6 keys requested. - if (isinstance(msg.type, types.WordRequestType_Matrix6) and character in ('2', '5', '8')): + if msg.type == types.WordRequestType_Matrix6 and character in ('2', '5', '8'): continue - if (ord(character) >= ord('1') and ord(character) <= ord('9')): + if character.isdigit(): return proto.WordAck(word=character) def callback_PinMatrixRequest(self, msg): - if msg.type == 1: + if msg.type == types.PinMatrixRequestType_Current: desc = 'current PIN' - elif msg.type == 2: + elif msg.type == types.PinMatrixRequestType_NewFirst: desc = 'new PIN' - elif msg.type == 3: + elif msg.type == types.PinMatrixRequestType_NewSecond: desc = 'new PIN again' else: desc = 'PIN'