1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

core: remove or mark star imports

This commit is contained in:
matejcik 2019-05-07 16:20:37 +02:00
parent af82fe1d8e
commit 388400bc1b
6 changed files with 25 additions and 12 deletions

View File

@ -2,7 +2,8 @@ from apps.common import HARDENED
from apps.monero import CURVE from apps.monero import CURVE
if False: 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): def get_creds(keychain, address_n=None, network_type=None):

View File

@ -3,7 +3,7 @@ from trezor import utils
from apps.monero.xmr import crypto from apps.monero.xmr import crypto
if False: 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 BUILD_KEY_BUFFER = bytearray(32 + 12 + 4) # key + disc + index

View File

@ -3,7 +3,8 @@ from micropython import const
from apps.monero.xmr import crypto from apps.monero.xmr import crypto
if False: 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) DISPLAY_DECIMAL_POINT = const(12)

View File

@ -1,6 +1,5 @@
if False: if False:
from trezor.crypto import monero as tcry from trezor.crypto import monero as tcry
from typing import * # noqa: F401
Ge25519 = tcry.ge25519 Ge25519 = tcry.ge25519
Sc25519 = tcry.bignum256modm Sc25519 = tcry.bignum256modm

View File

@ -48,8 +48,11 @@ def blend(ca: int, cb: int, t: float) -> int:
) )
# import style definitions # import style later to avoid circular dep
from trezor.ui.style import * # isort:skip 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: def contains(area: tuple, pos: tuple) -> bool:
@ -83,10 +86,10 @@ async def alert(count: int = 3):
current = display.backlight() current = display.backlight()
for i in range(count * 2): for i in range(count * 2):
if i % 2 == 0: if i % 2 == 0:
display.backlight(BACKLIGHT_MAX) display.backlight(style.BACKLIGHT_MAX)
yield short_sleep yield short_sleep
else: else:
display.backlight(BACKLIGHT_NORMAL) display.backlight(style.BACKLIGHT_NORMAL)
yield long_sleep yield long_sleep
display.backlight(current) display.backlight(current)
@ -121,8 +124,8 @@ def backlight_slide_sync(val: int, delay: int = 35000, step: int = 20):
def layout(f): def layout(f):
async def inner(*args, **kwargs): async def inner(*args, **kwargs):
await backlight_slide(BACKLIGHT_DIM) await backlight_slide(style.BACKLIGHT_DIM)
slide = backlight_slide(BACKLIGHT_NORMAL) slide = backlight_slide(style.BACKLIGHT_NORMAL)
try: try:
layout = f(*args, **kwargs) layout = f(*args, **kwargs)
workflow.onlayoutstart(layout) workflow.onlayoutstart(layout)
@ -149,7 +152,11 @@ def layout_no_slide(f):
def header( 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: if icon is not None:
display.icon(14, 15, res.load(icon), ifg, bg) display.icon(14, 15, res.load(icon), ifg, bg)

View File

@ -1,10 +1,15 @@
import protobuf import protobuf
from trezor import log, loop, messages, utils, workflow from trezor import log, loop, messages, utils, workflow
from trezor.messages import FailureType
from trezor.wire import codec_v1 from trezor.wire import codec_v1
from trezor.wire.errors import * from trezor.wire.errors import Error
from apps.common import seed 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 = {} workflow_handlers = {}