1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

client: fix matrix recovery, use named enums, use isdigit(), ignore broken E721 test

This commit is contained in:
Saleem Rashid 2017-07-31 12:35:31 +01:00 committed by Pavol Rusnak
parent 81d5170c10
commit b469519e26
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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'