mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-06 20:52:40 +00:00
chore(core): change build_mocks to include empty lines
[no changelog]
This commit is contained in:
parent
1d747d3b7f
commit
8bf84c2907
@ -140,7 +140,7 @@ STATIC void mp_unpack_scalar(bignum256modm r, const mp_obj_t arg,
|
|||||||
/// """
|
/// """
|
||||||
/// EC point on ED25519
|
/// EC point on ED25519
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def __init__(self, x: Point | bytes | None = None):
|
/// def __init__(self, x: Point | bytes | None = None):
|
||||||
/// """
|
/// """
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@ -179,13 +179,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_monero_ge25519___del___obj,
|
|||||||
/// """
|
/// """
|
||||||
/// EC scalar on SC25519
|
/// EC scalar on SC25519
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def __init__(self, x: Scalar | bytes | int | None = None):
|
/// def __init__(self, x: Scalar | bytes | int | None = None):
|
||||||
/// """
|
/// """
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
///
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_monero_bignum256modm_make_new(
|
STATIC mp_obj_t mod_trezorcrypto_monero_bignum256modm_make_new(
|
||||||
const mp_obj_type_t *type, size_t n_args, size_t n_kw,
|
const mp_obj_type_t *type, size_t n_args, size_t n_kw,
|
||||||
const mp_obj_t *args) {
|
const mp_obj_t *args) {
|
||||||
@ -223,28 +222,27 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(
|
|||||||
/// """
|
/// """
|
||||||
/// XMR hasher
|
/// XMR hasher
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def __init__(self, x: bytes | None = None):
|
/// def __init__(self, x: bytes | None = None):
|
||||||
/// """
|
/// """
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def update(self, buffer: bytes) -> None:
|
/// def update(self, buffer: bytes) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update hasher
|
/// Update hasher
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def digest(self) -> bytes:
|
/// def digest(self) -> bytes:
|
||||||
/// """
|
/// """
|
||||||
/// Computes digest
|
/// Computes digest
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// def copy(self) -> Hasher:
|
/// def copy(self) -> Hasher:
|
||||||
/// """
|
/// """
|
||||||
/// Creates copy of the hasher, preserving the state
|
/// Creates copy of the hasher, preserving the state
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
///
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_monero_hasher_make_new(
|
STATIC mp_obj_t mod_trezorcrypto_monero_hasher_make_new(
|
||||||
const mp_obj_type_t *type, size_t n_args, size_t n_kw,
|
const mp_obj_type_t *type, size_t n_args, size_t n_kw,
|
||||||
const mp_obj_t *args) {
|
const mp_obj_t *args) {
|
||||||
|
@ -37,11 +37,11 @@ extern bool usb_connected_previously;
|
|||||||
/// def poll(ifaces: Iterable[int], list_ref: list, timeout_ms: int) -> bool:
|
/// def poll(ifaces: Iterable[int], list_ref: list, timeout_ms: int) -> bool:
|
||||||
/// """
|
/// """
|
||||||
/// Wait until one of `ifaces` is ready to read or write (using masks
|
/// Wait until one of `ifaces` is ready to read or write (using masks
|
||||||
// `io.POLL_READ` and `io.POLL_WRITE`) and assign the result into
|
/// `io.POLL_READ` and `io.POLL_WRITE`) and assign the result into
|
||||||
/// `list_ref`:
|
/// `list_ref`:
|
||||||
///
|
///
|
||||||
/// `list_ref[0]` - the interface number, including the mask
|
/// - `list_ref[0]` - the interface number, including the mask
|
||||||
/// `list_ref[1]` - for touch event, tuple of:
|
/// - `list_ref[1]` - for touch event, tuple of:
|
||||||
/// (event_type, x_position, y_position)
|
/// (event_type, x_position, y_position)
|
||||||
/// - for button event (T1), tuple of:
|
/// - for button event (T1), tuple of:
|
||||||
/// (event type, button number)
|
/// (event type, button number)
|
||||||
|
@ -25,14 +25,13 @@
|
|||||||
/// """
|
/// """
|
||||||
/// Provide access to device display.
|
/// Provide access to device display.
|
||||||
/// """
|
/// """
|
||||||
///
|
|
||||||
/// WIDTH: int # display width in pixels
|
/// WIDTH: int # display width in pixels
|
||||||
/// HEIGHT: int # display height in pixels
|
/// HEIGHT: int # display height in pixels
|
||||||
/// FONT_MONO: int # id of monospace font
|
/// FONT_MONO: int # id of monospace font
|
||||||
/// FONT_NORMAL: int # id of normal-width font
|
/// FONT_NORMAL: int # id of normal-width font
|
||||||
/// FONT_DEMIBOLD: int # id of demibold font
|
/// FONT_DEMIBOLD: int # id of demibold font
|
||||||
/// FONT_BOLD_UPPER: int # id of bold-width-uppercased font
|
/// FONT_BOLD_UPPER: int # id of bold-width-uppercased font
|
||||||
///
|
|
||||||
typedef struct _mp_obj_Display_t {
|
typedef struct _mp_obj_Display_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
} mp_obj_Display_t;
|
} mp_obj_Display_t;
|
||||||
|
@ -320,15 +320,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(
|
|||||||
mod_trezorutils_reboot_to_bootloader);
|
mod_trezorutils_reboot_to_bootloader);
|
||||||
|
|
||||||
/// VersionTuple = Tuple[int, int, int, int]
|
/// VersionTuple = Tuple[int, int, int, int]
|
||||||
///
|
|
||||||
/// class FirmwareHeaderInfo(NamedTuple):
|
/// class FirmwareHeaderInfo(NamedTuple):
|
||||||
/// version: VersionTuple
|
/// version: VersionTuple
|
||||||
/// vendor: str
|
/// vendor: str
|
||||||
/// fingerprint: bytes
|
/// fingerprint: bytes
|
||||||
/// hash: bytes
|
/// hash: bytes
|
||||||
///
|
|
||||||
/// mock:global
|
/// mock:global
|
||||||
///
|
|
||||||
/// def check_firmware_header(header : bytes) -> FirmwareHeaderInfo:
|
/// def check_firmware_header(header : bytes) -> FirmwareHeaderInfo:
|
||||||
/// """Parses incoming firmware header and returns information about it."""
|
/// """Parses incoming firmware header and returns information about it."""
|
||||||
STATIC mp_obj_t mod_trezorutils_check_firmware_header(mp_obj_t header) {
|
STATIC mp_obj_t mod_trezorutils_check_firmware_header(mp_obj_t header) {
|
||||||
|
@ -5,10 +5,12 @@ from typing import *
|
|||||||
def crc32(data: bytes, crc: int = 0) -> int:
|
def crc32(data: bytes, crc: int = 0) -> int:
|
||||||
"""
|
"""
|
||||||
Computes a CRC32 checksum of `data`.
|
Computes a CRC32 checksum of `data`.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
`data` (`bytes`): Input data.
|
`data` (`bytes`): Input data.
|
||||||
`crc` (`int`, `optional`): Initial CRC value for chaining
|
`crc` (`int`, `optional`): Initial CRC value for chaining
|
||||||
computations over multiple data segments. Defaults to 0.
|
computations over multiple data segments. Defaults to 0.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
`int`: Computed CRC32 checksum.
|
`int`: Computed CRC32 checksum.
|
||||||
"""
|
"""
|
||||||
|
@ -72,13 +72,16 @@ class HID:
|
|||||||
def poll(ifaces: Iterable[int], list_ref: list, timeout_ms: int) -> bool:
|
def poll(ifaces: Iterable[int], list_ref: list, timeout_ms: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Wait until one of `ifaces` is ready to read or write (using masks
|
Wait until one of `ifaces` is ready to read or write (using masks
|
||||||
|
`io.POLL_READ` and `io.POLL_WRITE`) and assign the result into
|
||||||
`list_ref`:
|
`list_ref`:
|
||||||
`list_ref[0]` - the interface number, including the mask
|
|
||||||
`list_ref[1]` - for touch event, tuple of:
|
- `list_ref[0]` - the interface number, including the mask
|
||||||
|
- `list_ref[1]` - for touch event, tuple of:
|
||||||
(event_type, x_position, y_position)
|
(event_type, x_position, y_position)
|
||||||
- for button event (T1), tuple of:
|
- for button event (T1), tuple of:
|
||||||
(event type, button number)
|
(event type, button number)
|
||||||
- for USB read event, received bytes
|
- for USB read event, received bytes
|
||||||
|
|
||||||
If timeout occurs, False is returned, True otherwise.
|
If timeout occurs, False is returned, True otherwise.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -193,6 +196,7 @@ class WebUSB:
|
|||||||
from . import fatfs, sdcard
|
from . import fatfs, sdcard
|
||||||
POLL_READ: int # wait until interface is readable and return read data
|
POLL_READ: int # wait until interface is readable and return read data
|
||||||
POLL_WRITE: int # wait until interface is writable
|
POLL_WRITE: int # wait until interface is writable
|
||||||
|
|
||||||
TOUCH: int # interface id of the touch events
|
TOUCH: int # interface id of the touch events
|
||||||
TOUCH_START: int # event id of touch start event
|
TOUCH_START: int # event id of touch start event
|
||||||
TOUCH_MOVE: int # event id of touch move event
|
TOUCH_MOVE: int # event id of touch move event
|
||||||
|
@ -11,7 +11,8 @@ EXTMOD_PATH = CORE_DIR / "embed" / "extmod"
|
|||||||
RUSTMOD_PATH = CORE_DIR / "embed" / "rust" / "src"
|
RUSTMOD_PATH = CORE_DIR / "embed" / "rust" / "src"
|
||||||
MOCKS_PATH = CORE_DIR / "mocks" / "generated"
|
MOCKS_PATH = CORE_DIR / "mocks" / "generated"
|
||||||
|
|
||||||
COMMENT_PREFIX = "/// "
|
COMMENT_PREFIX_SHORT = "///"
|
||||||
|
COMMENT_PREFIX = COMMENT_PREFIX_SHORT + " "
|
||||||
|
|
||||||
current_indent = 0
|
current_indent = 0
|
||||||
current_class = None
|
current_class = None
|
||||||
@ -61,8 +62,10 @@ def split_to_parts(line, mod_desc=None):
|
|||||||
yield (current_package, current_indent * " " + "@overload\n")
|
yield (current_package, current_indent * " " + "@overload\n")
|
||||||
current_method_is_overload = False
|
current_method_is_overload = False
|
||||||
|
|
||||||
|
if not line.strip():
|
||||||
|
yield (current_package, "\n")
|
||||||
|
else:
|
||||||
line = current_indent * " " + line
|
line = current_indent * " " + line
|
||||||
|
|
||||||
yield (current_package, line)
|
yield (current_package, line)
|
||||||
|
|
||||||
|
|
||||||
@ -105,10 +108,10 @@ def build_module(mod_file, dest):
|
|||||||
mod_desc = str(mod_file.relative_to(CORE_DIR / "embed"))
|
mod_desc = str(mod_file.relative_to(CORE_DIR / "embed"))
|
||||||
|
|
||||||
for l in open(mod_file):
|
for l in open(mod_file):
|
||||||
if not l.startswith(COMMENT_PREFIX):
|
if not l.startswith(COMMENT_PREFIX_SHORT):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
l = l[len(COMMENT_PREFIX) :] # .strip()
|
l = l[len(COMMENT_PREFIX) :] # .strip()
|
||||||
|
|
||||||
store_to_file(dest, split_to_parts(l, mod_desc))
|
store_to_file(dest, split_to_parts(l, mod_desc))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user