1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-31 01:41:18 +00:00

fix style after rebase

This commit is contained in:
M1nd3r 2024-12-20 14:37:43 +01:00
parent f5bbf228eb
commit c3130d52bf
10 changed files with 13 additions and 5 deletions

View File

@ -132,7 +132,7 @@ class Channel:
# TODO Check CRC and if valid, check tag, if valid update nonces # TODO Check CRC and if valid, check tag, if valid update nonces
self._finish_fallback() self._finish_fallback()
# TODO self.write() failure device is busy - use channel buffer to send this failure message!! # TODO self.write() failure device is busy - use channel buffer to send this failure message!!
return return None
return received_message_handler.handle_received_message(self, buffer) return received_message_handler.handle_received_message(self, buffer)
elif self.expected_payload_length + INIT_HEADER_LENGTH > self.bytes_read: elif self.expected_payload_length + INIT_HEADER_LENGTH > self.bytes_read:
self.is_cont_packet_expected = True self.is_cont_packet_expected = True

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
import storage.cache_codec import storage.cache_codec

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
import storage.cache_codec import storage.cache_codec

View File

@ -378,7 +378,7 @@ class TestStorageCache(unittest.TestCase):
session_id = cache_codec.start_session() session_id = cache_codec.start_session()
self.assertEqual(cache_codec.start_session(session_id), session_id) self.assertEqual(cache_codec.start_session(session_id), session_id)
get_active_session().set(KEY, b"A") get_active_session().set(KEY, b"A")
for i in range(_PROTOCOL_CACHE._MAX_SESSIONS_COUNT): for _ in range(_PROTOCOL_CACHE._MAX_SESSIONS_COUNT):
cache_codec.start_session() cache_codec.start_session()
self.assertNotEqual(cache_codec.start_session(session_id), session_id) self.assertNotEqual(cache_codec.start_session(session_id), session_id)
self.assertIsNone(get_active_session().get(KEY)) self.assertIsNone(get_active_session().get(KEY))

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
if utils.USE_THP: if utils.USE_THP:

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
from trezorcrypto import aesgcm, curve25519 from trezorcrypto import aesgcm, curve25519
@ -101,8 +102,8 @@ class TestTrezorHostProtocolCrypto(unittest.TestCase):
def test_iv_from_nonce(self): def test_iv_from_nonce(self):
for v in self.vectors_iv: for v in self.vectors_iv:
x = v[0] # x = v[0]
y = x.to_bytes(8, "big") # y = x.to_bytes(8, "big")
iv = crypto._get_iv_from_nonce(v[0]) iv = crypto._get_iv_from_nonce(v[0])
self.assertEqual(iv, v[1]) self.assertEqual(iv, v[1])
with self.assertRaises(AssertionError) as e: with self.assertRaises(AssertionError) as e:

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
from mock_wire_interface import MockHID from mock_wire_interface import MockHID
from trezor import config, io, protobuf from trezor import config, io, protobuf
@ -256,7 +257,7 @@ class TestTrezorHostProtocol(unittest.TestCase):
# test invalid tag in handshake phase # test invalid tag in handshake phase
cid_2 = get_channel_id_from_response(expected_response_1) cid_2 = get_channel_id_from_response(expected_response_1)
cid_2_bytes = cid_2.to_bytes(2, "big") # cid_2_bytes = cid_2.to_bytes(2, "big")
channel = thp_main._CHANNELS[cid_2] channel = thp_main._CHANNELS[cid_2]
channel.iface = self.interface channel.iface = self.interface

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
from typing import Any, Awaitable from typing import Any, Awaitable

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from common import * # isort:skip from common import * # isort:skip
import ustruct import ustruct
from typing import TYPE_CHECKING from typing import TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# flake8: noqa: F403,F405
from trezor import utils from trezor import utils
from trezor.wire.thp import ChannelState from trezor.wire.thp import ChannelState