diff --git a/trezorctl b/trezorctl index 1b164782c..63e663a99 100755 --- a/trezorctl +++ b/trezorctl @@ -327,9 +327,7 @@ def wipe_device(connect, bootloader): click.echo("Please switch your device to bootloader mode.") sys.exit(1) else: - click.echo( - "Wiping user data and firmware!" - ) + click.echo("Wiping user data and firmware!") else: if client.features.bootloader_mode: click.echo( diff --git a/trezorlib/client.py b/trezorlib/client.py index 3f17b9bd1..77aac35d2 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -15,15 +15,10 @@ # If not, see . import functools -import getpass import logging -import os import sys -import time import warnings -from mnemonic import Mnemonic - from . import ( btc, cosi, diff --git a/trezorlib/debuglink.py b/trezorlib/debuglink.py index 0549f7866..35756b30c 100644 --- a/trezorlib/debuglink.py +++ b/trezorlib/debuglink.py @@ -19,8 +19,8 @@ from mnemonic import Mnemonic from . import messages as proto, tools from .client import TrezorClient -from .tools import expect from .protobuf import format_message +from .tools import expect class DebugLink: diff --git a/trezorlib/device.py b/trezorlib/device.py index f89ba5098..afff38001 100644 --- a/trezorlib/device.py +++ b/trezorlib/device.py @@ -17,12 +17,10 @@ import os import warnings -from mnemonic import Mnemonic - from . import messages as proto +from .exceptions import Cancelled from .tools import expect, session from .transport import enumerate_devices, get_transport -from .exceptions import Cancelled RECOVERY_BACK = "\x08" # backspace character, sent literally diff --git a/trezorlib/tests/device_tests/common.py b/trezorlib/tests/device_tests/common.py index 2877b63ad..97e7952aa 100644 --- a/trezorlib/tests/device_tests/common.py +++ b/trezorlib/tests/device_tests/common.py @@ -17,8 +17,8 @@ import os from trezorlib import coins, debuglink, device, tx_api -from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST from trezorlib.debuglink import TrezorClientDebugLink +from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST from . import conftest diff --git a/trezorlib/tests/device_tests/conftest.py b/trezorlib/tests/device_tests/conftest.py index cb750e283..4b2966df8 100644 --- a/trezorlib/tests/device_tests/conftest.py +++ b/trezorlib/tests/device_tests/conftest.py @@ -19,10 +19,10 @@ import os import pytest -from trezorlib import coins, log +from trezorlib import coins, debuglink, log from trezorlib.debuglink import TrezorClientDebugLink +from trezorlib.device import wipe as wipe_device from trezorlib.transport import enumerate_devices, get_transport -from trezorlib import device, debuglink TREZOR_VERSION = None @@ -55,7 +55,7 @@ def client(): wirelink = get_device() client = TrezorClientDebugLink(wirelink) client.set_tx_api(coins.tx_api["Bitcoin"]) - device.wipe(client) + wipe_device(client) client.transport.session_begin() yield client diff --git a/trezorlib/ui.py b/trezorlib/ui.py index a26c59679..d3681fb2f 100644 --- a/trezorlib/ui.py +++ b/trezorlib/ui.py @@ -3,9 +3,9 @@ import os import click from mnemonic import Mnemonic -from .messages import WordRequestType, PinMatrixRequestType from . import device from .exceptions import Cancelled +from .messages import PinMatrixRequestType, WordRequestType PIN_MATRIX_DESCRIPTION = """ Use the numeric keypad to describe number positions. The layout is: @@ -110,7 +110,7 @@ try: key = msvcrt.getwch() if key == "\x03": raise KeyboardInterrupt - if key in (0x00, 0xe0): + if key in (0x00, 0xE0): # skip special keys: read the scancode and repeat msvcrt.getwch() continue @@ -138,4 +138,3 @@ def matrix_words(type): return ch if type == WordRequestType.Matrix9 and ch in "123456789": return ch -