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

src/apps: make flake8 happy

This commit is contained in:
Pavol Rusnak 2018-05-02 16:51:57 +01:00
parent 6a062ec5ea
commit 736b02394f
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 7 additions and 9 deletions

View File

@ -13,7 +13,7 @@ suffixes = {
def suffix_by_chain_id(chain_id, tx_type=None):
if (tx_type==1 or tx_type==6) and (chain_id==1 or chain_id==3):
return"WAN"
if tx_type in [1, 6] and chain_id in [1, 3]:
return 'WAN'
else:
return suffixes.get(chain_id, 'UNKN')

View File

@ -46,7 +46,7 @@ async def ethereum_sign_tx(ctx, msg):
sha = HashWriter(sha3_256)
sha.extend(rlp.encode_length(total_length, True)) # total length
if not msg.tx_type is None:
if msg.tx_type is not None:
sha.extend(rlp.encode(msg.tx_type))
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
@ -75,7 +75,7 @@ async def ethereum_sign_tx(ctx, msg):
def get_total_length(msg: EthereumSignTx, data_total: int) -> int:
length = 0
if not msg.tx_type is None:
if msg.tx_type is not None:
length += rlp.field_length(1, [msg.tx_type])
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
@ -130,10 +130,10 @@ def node_derive(root, address_n: list):
def check(msg: EthereumSignTx):
if msg.tx_type not in [1, 6, None]:
raise ValueError(FailureType.DataError, 'Txtype out of bounds')
raise wire.DataError('tx_type out of bounds')
if msg.chain_id < 0 or msg.chain_id > MAX_CHAIN_ID:
raise wire.DataError('Chain id out of bounds')
raise wire.DataError('chain_id out of bounds')
if msg.data_length > 0:
if not msg.data_initial_chunk:

View File

@ -2,7 +2,6 @@ from trezor import config, ui, wire
from trezor.crypto import bip39
from trezor.messages.ButtonRequest import ButtonRequest
from trezor.messages.ButtonRequestType import MnemonicWordCount, MnemonicInput
from trezor.messages.FailureType import ProcessError, UnexpectedMessage
from trezor.messages.Success import Success
from trezor.messages.wire_types import ButtonAck
from trezor.pin import pin_to_int

View File

@ -1,7 +1,6 @@
from trezor import ui, wire
from trezor.crypto.curve import secp256k1
from trezor.messages.InputScriptType import SPENDADDRESS, SPENDP2SHWITNESS, SPENDWITNESS
from trezor.messages.FailureType import ProcessError
from trezor.messages.MessageSignature import MessageSignature
from trezor.ui.text import Text
from apps.common import coins, seed