From 17990e1c80fce668be6d019f5534ddaadf55a700 Mon Sep 17 00:00:00 2001 From: matejcik Date: Tue, 29 Apr 2025 12:12:56 +0200 Subject: [PATCH] style: fix linter complaints --- core/src/apps/solana/sign_tx.py | 1 - core/src/apps/solana/transaction/__init__.py | 4 ++-- python/src/trezorlib/cli/solana.py | 2 ++ tests/device_tests/ethereum/test_definitions.py | 14 ++++++++++---- .../device_tests/ethereum/test_definitions_bad.py | 2 +- tests/device_tests/ethereum/test_signtx.py | 2 +- tests/device_tests/solana/test_sign_tx.py | 4 ++-- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/core/src/apps/solana/sign_tx.py b/core/src/apps/solana/sign_tx.py index 7076a734a8..c98985e57d 100644 --- a/core/src/apps/solana/sign_tx.py +++ b/core/src/apps/solana/sign_tx.py @@ -1,6 +1,5 @@ from typing import TYPE_CHECKING -from trezor.crypto import base58 from trezor.wire import DataError from apps.common.keychain import with_slip44_keychain diff --git a/core/src/apps/solana/transaction/__init__.py b/core/src/apps/solana/transaction/__init__.py index a1ff290fd6..fa48bed6b8 100644 --- a/core/src/apps/solana/transaction/__init__.py +++ b/core/src/apps/solana/transaction/__init__.py @@ -309,10 +309,10 @@ class Transaction: SOLANA_TOKEN_ACCOUNT_SIZE, ) from ..transaction.instructions import ( - is_system_program_account_creation, - is_atap_account_creation, _TOKEN_2022_PROGRAM_ID, _TOKEN_PROGRAM_ID, + is_atap_account_creation, + is_system_program_account_creation, ) allocation = 0 diff --git a/python/src/trezorlib/cli/solana.py b/python/src/trezorlib/cli/solana.py index 7dd475404e..846cee5715 100644 --- a/python/src/trezorlib/cli/solana.py +++ b/python/src/trezorlib/cli/solana.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import json from typing import TYPE_CHECKING, Optional, TextIO diff --git a/tests/device_tests/ethereum/test_definitions.py b/tests/device_tests/ethereum/test_definitions.py index 226a7f83cc..8487a0cc3c 100644 --- a/tests/device_tests/ethereum/test_definitions.py +++ b/tests/device_tests/ethereum/test_definitions.py @@ -9,8 +9,8 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path -from ...input_flows import InputFlowConfirmAllWarnings from ... import definitions +from ...input_flows import InputFlowConfirmAllWarnings from .test_sign_typed_data import DATA as TYPED_DATA pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum] @@ -65,7 +65,9 @@ def test_slip44_external(client: Client) -> None: network = definitions.encode_eth_network(chain_id=66666, slip44=66666) params = DEFAULT_TX_PARAMS.copy() params.update(n=parse_path("m/44h/66666h/0h/0/0"), chain_id=66666) - ethereum.sign_tx(client, **params, definitions=definitions.make_eth_defs(network, None)) + ethereum.sign_tx( + client, **params, definitions=definitions.make_eth_defs(network, None) + ) def test_slip44_external_disallowed(client: Client) -> None: @@ -121,10 +123,14 @@ def test_builtin_token(client: Client) -> None: def test_external_token(client: Client) -> None: # A valid token definition must be provided to use a non-builtin token - token = definitions.encode_eth_token(address=ERC20_FAKE_ADDRESS, chain_id=1, decimals=8) + token = definitions.encode_eth_token( + address=ERC20_FAKE_ADDRESS, chain_id=1, decimals=8 + ) params = DEFAULT_ERC20_PARAMS.copy() params.update(to=ERC20_FAKE_ADDRESS) - ethereum.sign_tx(client, **params, definitions=definitions.make_eth_defs(None, token)) + ethereum.sign_tx( + client, **params, definitions=definitions.make_eth_defs(None, token) + ) # TODO check that FakeTok symbol is shown diff --git a/tests/device_tests/ethereum/test_definitions_bad.py b/tests/device_tests/ethereum/test_definitions_bad.py index 33bf55713d..917c3ade2f 100644 --- a/tests/device_tests/ethereum/test_definitions_bad.py +++ b/tests/device_tests/ethereum/test_definitions_bad.py @@ -13,8 +13,8 @@ from trezorlib.tools import parse_path from ...definitions import ( make_eth_defs, make_eth_network, - make_payload, make_eth_token, + make_payload, sign_payload, ) from .test_definitions import DEFAULT_ERC20_PARAMS, ERC20_FAKE_ADDRESS diff --git a/tests/device_tests/ethereum/test_signtx.py b/tests/device_tests/ethereum/test_signtx.py index 6fb5caaebe..da1892d686 100644 --- a/tests/device_tests/ethereum/test_signtx.py +++ b/tests/device_tests/ethereum/test_signtx.py @@ -23,6 +23,7 @@ from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path, unharden from ...common import parametrize_using_common_fixtures +from ...definitions import encode_eth_network from ...input_flows import ( InputFlowConfirmAllWarnings, InputFlowEthereumSignTxDataGoBack, @@ -32,7 +33,6 @@ from ...input_flows import ( InputFlowEthereumSignTxShowFeeInfo, InputFlowEthereumSignTxStaking, ) -from ...definitions import encode_eth_network TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef" diff --git a/tests/device_tests/solana/test_sign_tx.py b/tests/device_tests/solana/test_sign_tx.py index 7731598e4d..3bd4899030 100644 --- a/tests/device_tests/solana/test_sign_tx.py +++ b/tests/device_tests/solana/test_sign_tx.py @@ -19,13 +19,13 @@ import pytest from trezorlib import messages from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.solana import sign_tx -from trezorlib.tools import parse_path, b58decode +from trezorlib.tools import b58decode, parse_path from ...common import parametrize_using_common_fixtures +from ...definitions import encode_solana_token from ...input_flows import InputFlowConfirmAllWarnings from .construct.instructions import PROGRAMS, UnknownInstruction from .construct.transaction import Message, RawInstruction -from ...definitions import encode_solana_token pytestmark = [ pytest.mark.altcoin,