1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-20 17:19:01 +00:00

fix: style

This commit is contained in:
M1nd3r 2025-04-14 12:27:48 +02:00
parent 8085a32343
commit b4fa00f56a
5 changed files with 10 additions and 8 deletions

View File

@ -63,6 +63,7 @@ class TrezorClient:
_last_active_session: SessionV1 | None = None
_session_id_counter: int = 0
def __init__(
self,
transport: Transport,

View File

@ -33,14 +33,18 @@ from mnemonic import Mnemonic
from . import btc, mapping, messages, models, protobuf
from .client import ProtocolVersion, TrezorClient
from .exceptions import Cancelled, TrezorFailure, UnexpectedMessageError
from .exceptions import (
Cancelled,
DeviceLockedException,
TrezorFailure,
UnexpectedMessageError,
)
from .log import DUMP_BYTES
from .messages import DebugWaitType
from .tools import parse_path
from .transport import Timeout
from .transport.session import ProtocolV2Channel, Session
from .transport.thp.protocol_v1 import ProtocolV1Channel
from trezorlib import exceptions
if t.TYPE_CHECKING:
from typing_extensions import Protocol
@ -1102,7 +1106,7 @@ class TrezorClientDebugLink(TrezorClient):
try:
super().__init__(transport)
except exceptions.DeviceLockedException:
except DeviceLockedException:
self.use_pin_sequence(["1234"])
self.debug.input(self.debug.encode_pin("1234"))
super().__init__(transport)
@ -1444,7 +1448,6 @@ class TrezorClientDebugLink(TrezorClient):
return resp
def notify_read(self, msg: protobuf.MessageType) -> None:
pass
try:
if self.actual_responses is not None:
self.actual_responses.append(msg)

View File

@ -3,7 +3,6 @@ from __future__ import annotations
import logging
import typing as t
from .. import exceptions, messages, models
from ..client import MAX_PIN_LENGTH
from ..protobuf import MessageType
@ -275,7 +274,7 @@ class SessionV2(Session):
self.channel.write(self.sid, msg)
def _read(self) -> t.Any:
from trezorlib.debuglink import TrezorClientDebugLink
from ..debuglink import TrezorClientDebugLink
msg = self.channel.read(self.sid)
LOG.debug("reading message %s", type(msg))

View File

@ -348,7 +348,7 @@ def _client_unlocked(
sleep(LOCK_TIME)
try:
_raw_client = _raw_client.get_new_client()
except Exception as e:
except Exception:
sleep(1.5)
_raw_client = _get_raw_client(request)

View File

@ -37,7 +37,6 @@ from trezorlib.messages import (
from trezorlib.transport.thp import curve25519
from trezorlib.transport.thp.cpace import Cpace
from .connect import (
get_encrypted_transport_protocol,
handle_pairing_request,