Fix cyclic imports of constants

M1nd3r/thp5
M1nd3r 2 months ago
parent 7d9c09d305
commit 27765bfb78

@ -24,7 +24,12 @@ from .thp_messages import (
InitHeader, InitHeader,
) )
from .thp_session import ThpError from .thp_session import ThpError
from .writer import write_payload_to_wire from .writer import (
CONT_DATA_OFFSET,
INIT_DATA_OFFSET,
REPORT_LENGTH,
write_payload_to_wire,
)
if TYPE_CHECKING: if TYPE_CHECKING:
from trezorio import WireInterface # pyright:ignore[reportMissingImports] from trezorio import WireInterface # pyright:ignore[reportMissingImports]
@ -35,12 +40,9 @@ _MOCK_INTERFACE_HID = b"\x00"
_PUBKEY_LENGTH = const(32) _PUBKEY_LENGTH = const(32)
INIT_DATA_OFFSET = const(5)
CONT_DATA_OFFSET = const(3)
MESSAGE_TYPE_LENGTH = const(2) MESSAGE_TYPE_LENGTH = const(2)
REPORT_LENGTH = const(64)
MAX_PAYLOAD_LEN = const(60000) MAX_PAYLOAD_LEN = const(60000)

@ -1,9 +1,13 @@
from micropython import const # pyright: ignore[reportMissingModuleSource]
from typing import TYPE_CHECKING # pyright: ignore[reportShadowedImports] from typing import TYPE_CHECKING # pyright: ignore[reportShadowedImports]
from trezor import io, log, loop, utils from trezor import io, log, loop, utils
from trezor.wire.thp.channel import CONT_DATA_OFFSET, INIT_DATA_OFFSET, REPORT_LENGTH
from trezor.wire.thp.thp_messages import InitHeader from trezor.wire.thp.thp_messages import InitHeader
INIT_DATA_OFFSET = const(5)
CONT_DATA_OFFSET = const(3)
REPORT_LENGTH = const(64)
if TYPE_CHECKING: if TYPE_CHECKING:
from trezorio import WireInterface # pyright: ignore[reportMissingImports] from trezorio import WireInterface # pyright: ignore[reportMissingImports]

Loading…
Cancel
Save