diff --git a/core/src/apps/monero/misc.py b/core/src/apps/monero/misc.py index ecfef3832..fedec66e2 100644 --- a/core/src/apps/monero/misc.py +++ b/core/src/apps/monero/misc.py @@ -2,7 +2,8 @@ from apps.common import HARDENED from apps.monero import CURVE if False: - from apps.monero.xmr.types import * + from typing import Tuple + from apps.monero.xmr.types import Sc25519 def get_creds(keychain, address_n=None, network_type=None): diff --git a/core/src/apps/monero/signing/offloading_keys.py b/core/src/apps/monero/signing/offloading_keys.py index 431049ad7..e9262e20f 100644 --- a/core/src/apps/monero/signing/offloading_keys.py +++ b/core/src/apps/monero/signing/offloading_keys.py @@ -3,7 +3,7 @@ from trezor import utils from apps.monero.xmr import crypto if False: - from apps.monero.xmr.types import * + from apps.monero.xmr.types import Sc25519 BUILD_KEY_BUFFER = bytearray(32 + 12 + 4) # key + disc + index diff --git a/core/src/apps/monero/xmr/monero.py b/core/src/apps/monero/xmr/monero.py index a5a3be08c..8647455c0 100644 --- a/core/src/apps/monero/xmr/monero.py +++ b/core/src/apps/monero/xmr/monero.py @@ -3,7 +3,8 @@ from micropython import const from apps.monero.xmr import crypto if False: - from apps.monero.xmr.types import * + from typing import Tuple, Optional + from apps.monero.xmr.types import Ge25519, Sc25519 DISPLAY_DECIMAL_POINT = const(12) diff --git a/core/src/apps/monero/xmr/types.py b/core/src/apps/monero/xmr/types.py index e3523e65f..964463d35 100644 --- a/core/src/apps/monero/xmr/types.py +++ b/core/src/apps/monero/xmr/types.py @@ -1,6 +1,5 @@ if False: from trezor.crypto import monero as tcry - from typing import * # noqa: F401 Ge25519 = tcry.ge25519 Sc25519 = tcry.bignum256modm diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index 0afc00a33..579e20490 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -48,8 +48,11 @@ def blend(ca: int, cb: int, t: float) -> int: ) -# import style definitions -from trezor.ui.style import * # isort:skip +# import style later to avoid circular dep +from trezor.ui import style # isort:skip + +# import style definitions into namespace +from trezor.ui.style import * # isort:skip # noqa: F401,F403 def contains(area: tuple, pos: tuple) -> bool: @@ -83,10 +86,10 @@ async def alert(count: int = 3): current = display.backlight() for i in range(count * 2): if i % 2 == 0: - display.backlight(BACKLIGHT_MAX) + display.backlight(style.BACKLIGHT_MAX) yield short_sleep else: - display.backlight(BACKLIGHT_NORMAL) + display.backlight(style.BACKLIGHT_NORMAL) yield long_sleep display.backlight(current) @@ -121,8 +124,8 @@ def backlight_slide_sync(val: int, delay: int = 35000, step: int = 20): def layout(f): async def inner(*args, **kwargs): - await backlight_slide(BACKLIGHT_DIM) - slide = backlight_slide(BACKLIGHT_NORMAL) + await backlight_slide(style.BACKLIGHT_DIM) + slide = backlight_slide(style.BACKLIGHT_NORMAL) try: layout = f(*args, **kwargs) workflow.onlayoutstart(layout) @@ -149,7 +152,11 @@ def layout_no_slide(f): def header( - title: str, icon: bytes = ICON_DEFAULT, fg: int = FG, bg: int = BG, ifg: int = GREEN + title: str, + icon: bytes = style.ICON_DEFAULT, + fg: int = style.FG, + bg: int = style.BG, + ifg: int = style.GREEN, ): if icon is not None: display.icon(14, 15, res.load(icon), ifg, bg) diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 4aba1a3b4..eac141ec8 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -1,10 +1,15 @@ import protobuf from trezor import log, loop, messages, utils, workflow +from trezor.messages import FailureType from trezor.wire import codec_v1 -from trezor.wire.errors import * +from trezor.wire.errors import Error from apps.common import seed +# import all errors into namespace, so that `wire.Error` is available elsewhere +from trezor.wire.errors import * # isort:skip # noqa: F401,F403 + + workflow_handlers = {}