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

core: update isort config to place relative imports last

This commit is contained in:
Tomas Susanka 2020-05-18 11:17:34 +00:00
parent 3a3965af9b
commit 1ac0f60550
35 changed files with 75 additions and 76 deletions

View File

@ -11,11 +11,11 @@ from trezor.strings import format_amount
from trezor.ui.scroll import Paginated
from trezor.ui.text import Text
from . import helpers
from apps.common.confirm import require_hold_to_confirm
from apps.common.layout import split_address
from . import helpers
async def require_confirm_transfer(ctx, msg: BinanceTransferMsg):
def make_input_output_pages(msg: BinanceInputOutput, direction):

View File

@ -4,13 +4,13 @@ from trezor.crypto.hashlib import sha256
from trezor.messages import InputScriptType
from trezor.messages.MultisigRedeemScriptType import MultisigRedeemScriptType
from apps.common import HARDENED, address_type, paths
from apps.common.coininfo import CoinInfo
from .common import ecdsa_hash_pubkey, encode_bech32_address
from .multisig import multisig_get_pubkeys, multisig_pubkey_index
from .scripts import output_script_multisig, output_script_native_p2wpkh_or_p2wsh
from apps.common import HARDENED, address_type, paths
from apps.common.coininfo import CoinInfo
if False:
from typing import List
from trezor.crypto import bip32

View File

@ -2,13 +2,13 @@ from trezor.crypto import bip32
from trezor.messages import InputScriptType
from trezor.messages.Address import Address
from apps.common.layout import address_n_to_str, show_address, show_qr, show_xpub
from apps.common.paths import validate_path
from . import addresses
from .keychain import with_keychain
from .multisig import multisig_pubkey_index
from apps.common.layout import address_n_to_str, show_address, show_qr, show_xpub
from apps.common.paths import validate_path
if False:
from typing import List
from trezor.messages import HDNodeType

View File

@ -3,10 +3,10 @@ from trezor.messages import InputScriptType
from trezor.messages.HDNodeType import HDNodeType
from trezor.messages.PublicKey import PublicKey
from .keychain import get_keychain_for_coin
from apps.common import HARDENED, coins, layout, seed
from .keychain import get_keychain_for_coin
async def get_keychain_for_curve(ctx: wire.Context, curve_name: str) -> seed.Keychain:
"""Set up a keychain for SLIP-13 and SLIP-17 namespaces with a specified curve."""

View File

@ -3,12 +3,12 @@ from trezor.crypto.curve import secp256k1
from trezor.messages.InputScriptType import SPENDADDRESS, SPENDP2SHWITNESS, SPENDWITNESS
from trezor.messages.MessageSignature import MessageSignature
from .addresses import get_address, validate_full_path
from .keychain import with_keychain
from apps.common.paths import validate_path
from apps.common.signverify import message_digest, require_confirm_sign_message
from .addresses import get_address, validate_full_path
from .keychain import with_keychain
@with_keychain
async def sign_message(ctx, msg, keychain, coin):

View File

@ -4,11 +4,11 @@ from trezor.messages.SignTx import SignTx
from trezor.messages.TxAck import TxAck
from trezor.messages.TxRequest import TxRequest
from apps.common import coininfo, paths, seed
from ..keychain import with_keychain
from . import bitcoin, helpers, layout, progress
from apps.common import coininfo, paths, seed
if not utils.BITCOIN_ONLY:
from . import bitcoinlike, decred, zcash

View File

@ -12,8 +12,6 @@ from .. import multisig, writers
from . import helpers
from .bitcoin import Bitcoin, input_is_nonsegwit
from apps.common.writers import write_bitcoin_varint
if False:
from typing import Union

View File

@ -16,10 +16,10 @@ from trezor.messages.TxOutputBinType import TxOutputBinType
from trezor.messages.TxOutputType import TxOutputType
from trezor.messages.TxRequest import TxRequest
from ..writers import TX_HASH_SIZE
from apps.common.coininfo import CoinInfo
from ..writers import TX_HASH_SIZE
if False:
from typing import Any, Awaitable, Dict, Union
from trezor.messages.TxInputType import EnumTypeInputScriptType

View File

@ -3,6 +3,9 @@ from trezor.crypto.curve import secp256k1
from trezor.messages.InputScriptType import SPENDADDRESS, SPENDP2SHWITNESS, SPENDWITNESS
from trezor.messages.Success import Success
from apps.common import coins
from apps.common.signverify import message_digest, require_confirm_verify_message
from .addresses import (
address_p2wpkh,
address_p2wpkh_in_p2sh,
@ -11,9 +14,6 @@ from .addresses import (
address_to_cashaddr,
)
from apps.common import coins
from apps.common.signverify import message_digest, require_confirm_verify_message
async def verify_message(ctx, msg):
message = msg.message

View File

@ -1,10 +1,10 @@
from trezor import wire
from . import CURVE, networks
from apps.common import HARDENED, seed
from apps.common.seed import get_keychain
from . import CURVE, networks
if False:
from typing import List
from typing_extensions import Protocol

View File

@ -1,12 +1,12 @@
from trezor.messages.LiskAddress import LiskAddress
from .helpers import get_address_from_public_key, validate_full_path
from apps.common import paths
from apps.common.layout import address_n_to_str, show_address, show_qr
from apps.common.seed import with_slip44_keychain
from apps.lisk import CURVE, SLIP44_ID
from .helpers import get_address_from_public_key, validate_full_path
@with_slip44_keychain(SLIP44_ID, CURVE, allow_testnet=True)
async def get_address(ctx, msg, keychain):

View File

@ -4,11 +4,11 @@ from trezor.strings import format_amount
from trezor.ui.text import Text
from trezor.utils import chunks
from .helpers import get_vote_tx_text
from apps.common.confirm import require_confirm, require_hold_to_confirm
from apps.common.layout import show_pubkey, split_address
from .helpers import get_vote_tx_text
async def require_confirm_tx(ctx, to, value):
text = Text("Confirm sending", ui.ICON_SEND, ui.GREEN)

View File

@ -2,11 +2,11 @@ from trezor import wire
from trezor.crypto.curve import ed25519
from trezor.messages.Success import Success
from apps.common.signverify import require_confirm_verify_message
from .helpers import get_address_from_public_key
from .sign_message import message_digest
from apps.common.signverify import require_confirm_verify_message
async def verify_message(ctx, msg):
digest = message_digest(msg.message)

View File

@ -9,14 +9,14 @@ from trezor.errors import MnemonicError
from trezor.messages import BackupType
from trezor.messages.Success import Success
from . import recover
from apps.common import mnemonic
from apps.common.layout import show_success
from apps.homescreen.homescreen import homescreen
from apps.management import backup_types
from apps.management.recovery_device import layout
from . import recover
if False:
from typing import Optional, Tuple
from trezor.messages.ResetDevice import EnumTypeBackupType

View File

@ -8,15 +8,15 @@ from trezor.ui.scroll import Paginated
from trezor.ui.text import Text
from trezor.ui.word_select import WordSelector
from apps.common.confirm import confirm, info_confirm, require_confirm
from apps.common.layout import show_success, show_warning
from apps.management import backup_types
from . import word_validity
from .keyboard_bip39 import Bip39Keyboard
from .keyboard_slip39 import Slip39Keyboard
from .recover import RecoveryAborted
from apps.common.confirm import confirm, info_confirm, require_confirm
from apps.common.layout import show_success, show_warning
from apps.management import backup_types
if __debug__:
from apps.debug import input_signal

View File

@ -6,12 +6,12 @@ from trezor.messages.ECDHSessionKey import ECDHSessionKey
from trezor.ui.text import Text
from trezor.utils import chunks
from .sign_identity import serialize_identity, serialize_identity_without_proto
from apps.common import HARDENED
from apps.common.confirm import require_confirm
from apps.common.seed import get_keychain
from .sign_identity import serialize_identity, serialize_identity_without_proto
async def get_ecdh_session_key(ctx, msg):
if msg.ecdsa_curve_name is None:

View File

@ -11,11 +11,11 @@ If number of inputs is small, in-memory mode is used = alpha, pseudo_outs are ke
Otherwise pseudo_outs are offloaded with HMAC, alpha is offloaded encrypted under chacha_poly with
key derived for exactly this purpose.
"""
from .state import State
from apps.monero.layout import confirms
from apps.monero.xmr import crypto, monero, serialize
from .state import State
if False:
from typing import List, Tuple, Optional
from apps.monero.xmr.types import Sc25519, Ge25519

View File

@ -16,10 +16,10 @@ HMAC correctness (host sends original sort idx) and ordering check
on the key images. This step is skipped.
"""
from .state import State
from apps.monero.layout.confirms import transaction_step
from .state import State
if False:
from typing import List
from trezor.messages.MoneroTransactionInputsPermutationAck import (

View File

@ -3,12 +3,12 @@ This step serves for an incremental hashing of tx.vin[i] to the tx_prefix_hasher
after the sorting on tx.vin[i].ki. The sorting order was received in the previous step.
"""
from .state import State
from apps.monero.layout import confirms
from apps.monero.signing import offloading_keys
from apps.monero.xmr import crypto
from .state import State
if False:
from trezor.messages.MoneroTransactionSourceEntry import (
MoneroTransactionSourceEntry,

View File

@ -3,11 +3,11 @@ All inputs set. Defining range signature parameters.
If in the applicable offloading mode, generate commitment masks.
"""
from .state import State
from apps.monero.layout import confirms
from apps.monero.xmr import crypto
from .state import State
if False:
from trezor.messages.MoneroTransactionAllInputsSetAck import (
MoneroTransactionAllInputsSetAck,

View File

@ -6,13 +6,13 @@ import gc
from trezor import utils
from .state import State
from apps.monero import signing
from apps.monero.layout import confirms
from apps.monero.signing import offloading_keys
from apps.monero.xmr import crypto, serialize
from .state import State
if False:
from typing import Tuple
from apps.monero.xmr.types import Sc25519, Ge25519

View File

@ -8,12 +8,12 @@ import gc
from trezor import utils
from .state import State
from apps.monero.layout import confirms
from apps.monero.signing import RctType
from apps.monero.xmr import crypto
from .state import State
if False:
from trezor.messages.MoneroTransactionAllOutSetAck import (
MoneroTransactionAllOutSetAck,

View File

@ -14,11 +14,11 @@ import gc
from trezor import utils
from .state import State
from apps.monero.layout import confirms
from apps.monero.xmr import crypto
from .state import State
if False:
from typing import List
from trezor.messages.MoneroTransactionSourceEntry import (

View File

@ -10,12 +10,12 @@ The private tx keys are used in other numerous Monero features.
from trezor.messages.MoneroTransactionFinalAck import MoneroTransactionFinalAck
from .state import State
from apps.monero import misc
from apps.monero.xmr import crypto
from apps.monero.xmr.crypto import chacha_poly
from .state import State
if False:
from typing import Tuple
from apps.monero.xmr.types import Sc25519

View File

@ -3,10 +3,10 @@ from trezor.messages import ButtonRequestType
from trezor.strings import format_amount
from trezor.ui.text import Text
from .helpers import NEM_MAX_DIVISIBILITY
from apps.common.confirm import require_confirm, require_hold_to_confirm
from .helpers import NEM_MAX_DIVISIBILITY
async def require_confirm_text(ctx, action: str):
content = action.split(" ")

View File

@ -11,6 +11,8 @@ from trezor.messages import (
from trezor.ui.scroll import Paginated
from trezor.ui.text import Text
from apps.common.layout import require_confirm, split_address
from ..layout import (
require_confirm_content,
require_confirm_fee,
@ -18,8 +20,6 @@ from ..layout import (
require_confirm_text,
)
from apps.common.layout import require_confirm, split_address
async def ask_mosaic_creation(
ctx, common: NEMTransactionCommon, creation: NEMMosaicCreation

View File

@ -9,6 +9,8 @@ from trezor.messages import (
)
from trezor.ui.text import Text
from apps.common.layout import split_address
from ..layout import (
require_confirm,
require_confirm_fee,
@ -16,8 +18,6 @@ from ..layout import (
require_confirm_text,
)
from apps.common.layout import split_address
async def ask_multisig(ctx, msg: NEMSignTx):
address = nem.compute_address(msg.multisig.signer, msg.transaction.network)

View File

@ -11,6 +11,9 @@ from trezor.messages import (
from trezor.strings import format_amount
from trezor.ui.text import Text
from apps.common.confirm import require_confirm
from apps.common.layout import split_address
from ..helpers import (
NEM_LEVY_PERCENTILE_DIVISOR_ABSOLUTE,
NEM_MAX_DIVISIBILITY,
@ -19,9 +22,6 @@ from ..helpers import (
from ..layout import require_confirm_final, require_confirm_text
from ..mosaic.helpers import get_mosaic_definition, is_nem_xem_mosaic
from apps.common.confirm import require_confirm
from apps.common.layout import split_address
async def ask_transfer(
ctx,

View File

@ -2,10 +2,10 @@ from micropython import const
from trezor.crypto.hashlib import ripemd160, sha256
from . import base58_ripple
from apps.common import HARDENED
from . import base58_ripple
# HASH_TX_ID = const(0x54584E00) # 'TXN'
HASH_TX_SIGN = const(0x53545800) # 'STX'
# HASH_TX_SIGN_TESTNET = const(0x73747800) # 'stx'

View File

@ -3,11 +3,11 @@ from trezor.messages import ButtonRequestType
from trezor.strings import format_amount
from trezor.ui.text import Text
from . import helpers
from apps.common.confirm import require_confirm, require_hold_to_confirm
from apps.common.layout import split_address
from . import helpers
async def require_confirm_fee(ctx, fee):
text = Text("Confirm fee", ui.ICON_SEND, ui.GREEN)

View File

@ -1,7 +1,7 @@
from .helpers import public_key_from_address
from apps.common.writers import write_bytes_unchecked, write_uint32_be, write_uint64_be
from .helpers import public_key_from_address
write_uint32 = write_uint32_be
write_uint64 = write_uint64_be

View File

@ -1,4 +1,3 @@
from trezor import utils
from trezorcrypto import ( # noqa: F401
aes,
bip32,
@ -9,5 +8,7 @@ from trezorcrypto import ( # noqa: F401
random,
)
from trezor import utils
if not utils.BITCOIN_ONLY:
from trezorcrypto import monero, nem # noqa: F401

View File

@ -1,5 +1,6 @@
from trezor import utils
from trezorcrypto import curve25519, ed25519, nist256p1, secp256k1 # noqa: F401
from trezor import utils
if not utils.BITCOIN_ONLY:
from trezorcrypto import secp256k1_zkp # noqa: F401

View File

@ -31,10 +31,10 @@ See https://github.com/satoshilabs/slips/blob/master/slip-0039.md.
"""
from micropython import const
from trezorcrypto import shamir, slip39
from trezor.crypto import hashlib, hmac, pbkdf2, random
from trezor.errors import MnemonicError
from trezorcrypto import shamir, slip39
if False:
from typing import Dict, Iterable, List, Optional, Set, Tuple

View File

@ -24,10 +24,9 @@ force_grid_wrap = 0
combine_as_imports = True
line_length = 88
not_skip=__init__.py
forced_separate = apps
known_standard_library = micropython,ubinascii,ustruct,uctypes,utime,utimeq,trezorio,trezorui,trezorutils,trezorconfig
known_third_party = curve25519,ecdsa,hypothesis,pytest,mnemonic,shamir-mnemonic
known_first_party = trezorlib
known_standard_library = micropython,ubinascii,ustruct,uctypes,utime,utimeq,trezorio,trezorui,trezorutils,trezorconfig,trezorcrypto
known_third_party = curve25519,ecdsa,hypothesis,pytest,mnemonic,shamir-mnemonic,trezor,storage,protobuf
known_first_party = trezorlib,apps
[tool:pytest]
addopts = -rfE --strict --random-order