1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 21:48:13 +00:00

docs(core): fix docs indentation and correct a few typos

[no changelog]
This commit is contained in:
M1nd3r 2024-11-13 19:38:31 +01:00 committed by Petr Sedláček
parent ed90f6bd08
commit 4c009539c7
12 changed files with 53 additions and 53 deletions

View File

@ -121,7 +121,7 @@ message DebugLinkState {
optional string pin = 2; // current PIN, blank if PIN is not set/enabled optional string pin = 2; // current PIN, blank if PIN is not set/enabled
optional string matrix = 3; // current PIN matrix optional string matrix = 3; // current PIN matrix
optional bytes mnemonic_secret = 4; // current mnemonic secret optional bytes mnemonic_secret = 4; // current mnemonic secret
optional common.HDNodeType node = 5; // current BIP-32 node optional common.HDNodeType node = 5; // current BIP-32 node
optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase? optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase?
optional string reset_word = 7; // word on device display during ResetDevice workflow optional string reset_word = 7; // word on device display during ResetDevice workflow
optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow

View File

@ -111,9 +111,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_AesGcm_encrypt_obj,
mod_trezorcrypto_AesGcm_encrypt); mod_trezorcrypto_AesGcm_encrypt);
/// def encrypt_in_place(self, data: bytearray | memoryview) -> int: /// def encrypt_in_place(self, data: bytearray | memoryview) -> int:
/// """ /// """
/// Encrypt data chunk in place. Returns the length of the encrypted data. /// Encrypt data chunk in place. Returns the length of the encrypted data.
/// """ /// """
STATIC mp_obj_t mod_trezorcrypto_AesGcm_encrypt_in_place(mp_obj_t self, STATIC mp_obj_t mod_trezorcrypto_AesGcm_encrypt_in_place(mp_obj_t self,
mp_obj_t data) { mp_obj_t data) {
mp_obj_AesGcm_t *o = MP_OBJ_TO_PTR(self); mp_obj_AesGcm_t *o = MP_OBJ_TO_PTR(self);
@ -158,9 +158,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_AesGcm_decrypt_obj,
mod_trezorcrypto_AesGcm_decrypt); mod_trezorcrypto_AesGcm_decrypt);
/// def decrypt_in_place(self, data: bytearray | memoryview) -> int: /// def decrypt_in_place(self, data: bytearray | memoryview) -> int:
/// """ /// """
/// Decrypt data chunk in place. Returns the length of the decrypted data. /// Decrypt data chunk in place. Returns the length of the decrypted data.
/// """ /// """
STATIC mp_obj_t mod_trezorcrypto_AesGcm_decrypt_in_place(mp_obj_t self, STATIC mp_obj_t mod_trezorcrypto_AesGcm_decrypt_in_place(mp_obj_t self,
mp_obj_t data) { mp_obj_t data) {
mp_obj_AesGcm_t *o = MP_OBJ_TO_PTR(self); mp_obj_AesGcm_t *o = MP_OBJ_TO_PTR(self);

View File

@ -519,9 +519,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorio_fatfs_unmount_obj,
mod_trezorio_fatfs_unmount); mod_trezorio_fatfs_unmount);
/// def is_mounted() -> bool: /// def is_mounted() -> bool:
/// """ /// """
/// Check if the filesystem is mounted. /// Check if the filesystem is mounted.
/// """ /// """
STATIC mp_obj_t mod_trezorio_fatfs_is_mounted() { STATIC mp_obj_t mod_trezorio_fatfs_is_mounted() {
return mp_obj_new_bool(_fatfs_instance_is_mounted()); return mp_obj_new_bool(_fatfs_instance_is_mounted());
} }

View File

@ -409,7 +409,7 @@ STATIC mp_obj_tuple_t mod_trezorutils_version_obj = {
/// UI_LAYOUT: str /// UI_LAYOUT: str
/// """UI layout identifier ("tt" for model T, "tr" for models One and R).""" /// """UI layout identifier ("tt" for model T, "tr" for models One and R)."""
/// USE_THP: bool /// USE_THP: bool
/// """Whether the firmware supports Trezor-Host Protocol (version 3).""" /// """Whether the firmware supports Trezor-Host Protocol (version 2)."""
STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorutils)}, {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorutils)},

View File

@ -2002,7 +2002,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// prefill_word: str, /// prefill_word: str,
/// can_go_back: bool, /// can_go_back: bool,
/// ) -> LayoutObj[str]: /// ) -> LayoutObj[str]:
/// """SLIP39 word input keyboard.""" /// """SLIP39 word input keyboard."""
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(), Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
/// def select_word( /// def select_word(
@ -2011,8 +2011,8 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// description: str, /// description: str,
/// words: Iterable[str], /// words: Iterable[str],
/// ) -> LayoutObj[int]: /// ) -> LayoutObj[int]:
/// """Select mnemonic word from three possibilities - seed check after backup. The /// """Select mnemonic word from three possibilities - seed check after backup. The
/// iterable must be of exact size. Returns index in range `0..3`.""" /// iterable must be of exact size. Returns index in range `0..3`."""
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(), Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
/// def show_share_words( /// def show_share_words(
@ -2030,7 +2030,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// max_count: int, /// max_count: int,
/// description: Callable[[int], str] | None = None, # unused on TR /// description: Callable[[int], str] | None = None, # unused on TR
/// ) -> LayoutObj[tuple[UiResult, int]]: /// ) -> LayoutObj[tuple[UiResult, int]]:
/// """Number input with + and - buttons, description, and info button.""" /// """Number input with + and - buttons, description, and info button."""
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(), Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
/// def show_checklist( /// def show_checklist(
@ -2040,8 +2040,8 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// active: int, /// active: int,
/// button: str, /// button: str,
/// ) -> LayoutObj[UiResult]: /// ) -> LayoutObj[UiResult]:
/// """Checklist of backup steps. Active index is highlighted, previous items have check /// """Checklist of backup steps. Active index is highlighted, previous items have check
/// mark next to them.""" /// mark next to them."""
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(), Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
/// def confirm_recovery( /// def confirm_recovery(
@ -2053,7 +2053,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// info_button: bool, # unused on TR /// info_button: bool, # unused on TR
/// show_instructions: bool, /// show_instructions: bool,
/// ) -> LayoutObj[UiResult]: /// ) -> LayoutObj[UiResult]:
/// """Device recovery homescreen.""" /// """Device recovery homescreen."""
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(), Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
/// def select_word_count( /// def select_word_count(
@ -2068,7 +2068,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// *, /// *,
/// lines: Iterable[str], /// lines: Iterable[str],
/// ) -> LayoutObj[int]: /// ) -> LayoutObj[int]:
/// """Shown after successfully finishing a group.""" /// """Shown after successfully finishing a group."""
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(), Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
/// def show_progress( /// def show_progress(
@ -2077,9 +2077,9 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// indeterminate: bool = False, /// indeterminate: bool = False,
/// title: str | None = None, /// title: str | None = None,
/// ) -> LayoutObj[UiResult]: /// ) -> LayoutObj[UiResult]:
/// """Show progress loader. Please note that the number of lines reserved on screen for /// """Show progress loader. Please note that the number of lines reserved on screen for
/// description is determined at construction time. If you want multiline descriptions /// description is determined at construction time. If you want multiline descriptions
/// make sure the initial description has at least that amount of lines.""" /// make sure the initial description has at least that amount of lines."""
Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(), Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(),
/// def show_progress_coinjoin( /// def show_progress_coinjoin(
@ -2089,8 +2089,8 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// time_ms: int = 0, /// time_ms: int = 0,
/// skip_first_paint: bool = False, /// skip_first_paint: bool = False,
/// ) -> LayoutObj[UiResult]: /// ) -> LayoutObj[UiResult]:
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when /// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
/// time_ms timeout is passed.""" /// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(), Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
/// def show_homescreen( /// def show_homescreen(

View File

@ -1731,8 +1731,8 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// """Calls drop on contents of the root component.""" /// """Calls drop on contents of the root component."""
/// ///
/// class UiResult: /// class UiResult:
/// """Result of a UI operation.""" /// """Result of an UI operation."""
/// pass /// pass
/// ///
/// mock:global /// mock:global
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(), Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),

View File

@ -55,9 +55,9 @@ class aesgcm:
""" """
def encrypt_in_place(self, data: bytearray | memoryview) -> int: def encrypt_in_place(self, data: bytearray | memoryview) -> int:
""" """
Encrypt data chunk in place. Returns the length of the encrypted data. Encrypt data chunk in place. Returns the length of the encrypted data.
""" """
def decrypt(self, data: bytes) -> bytes: def decrypt(self, data: bytes) -> bytes:
""" """
@ -65,9 +65,9 @@ class aesgcm:
""" """
def decrypt_in_place(self, data: bytearray | memoryview) -> int: def decrypt_in_place(self, data: bytearray | memoryview) -> int:
""" """
Decrypt data chunk in place. Returns the length of the decrypted data. Decrypt data chunk in place. Returns the length of the decrypted data.
""" """
def auth(self, data: bytes) -> None: def auth(self, data: bytes) -> None:
""" """

View File

@ -160,9 +160,9 @@ def unmount() -> None:
# extmod/modtrezorio/modtrezorio-fatfs.h # extmod/modtrezorio/modtrezorio-fatfs.h
def is_mounted() -> bool: def is_mounted() -> bool:
""" """
Check if the filesystem is mounted. Check if the filesystem is mounted.
""" """
# extmod/modtrezorio/modtrezorio-fatfs.h # extmod/modtrezorio/modtrezorio-fatfs.h

View File

@ -918,7 +918,7 @@ def request_slip39(
prefill_word: str, prefill_word: str,
can_go_back: bool, can_go_back: bool,
) -> LayoutObj[str]: ) -> LayoutObj[str]:
"""SLIP39 word input keyboard.""" """SLIP39 word input keyboard."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -928,8 +928,8 @@ def select_word(
description: str, description: str,
words: Iterable[str], words: Iterable[str],
) -> LayoutObj[int]: ) -> LayoutObj[int]:
"""Select mnemonic word from three possibilities - seed check after backup. The """Select mnemonic word from three possibilities - seed check after backup. The
iterable must be of exact size. Returns index in range `0..3`.""" iterable must be of exact size. Returns index in range `0..3`."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -949,7 +949,7 @@ def request_number(
max_count: int, max_count: int,
description: Callable[[int], str] | None = None, # unused on TR description: Callable[[int], str] | None = None, # unused on TR
) -> LayoutObj[tuple[UiResult, int]]: ) -> LayoutObj[tuple[UiResult, int]]:
"""Number input with + and - buttons, description, and info button.""" """Number input with + and - buttons, description, and info button."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -960,8 +960,8 @@ def show_checklist(
active: int, active: int,
button: str, button: str,
) -> LayoutObj[UiResult]: ) -> LayoutObj[UiResult]:
"""Checklist of backup steps. Active index is highlighted, previous items have check """Checklist of backup steps. Active index is highlighted, previous items have check
mark next to them.""" mark next to them."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -974,7 +974,7 @@ def confirm_recovery(
info_button: bool, # unused on TR info_button: bool, # unused on TR
show_instructions: bool, show_instructions: bool,
) -> LayoutObj[UiResult]: ) -> LayoutObj[UiResult]:
"""Device recovery homescreen.""" """Device recovery homescreen."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -991,7 +991,7 @@ def show_group_share_success(
*, *,
lines: Iterable[str], lines: Iterable[str],
) -> LayoutObj[int]: ) -> LayoutObj[int]:
"""Shown after successfully finishing a group.""" """Shown after successfully finishing a group."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -1001,9 +1001,9 @@ def show_progress(
indeterminate: bool = False, indeterminate: bool = False,
title: str | None = None, title: str | None = None,
) -> LayoutObj[UiResult]: ) -> LayoutObj[UiResult]:
"""Show progress loader. Please note that the number of lines reserved on screen for """Show progress loader. Please note that the number of lines reserved on screen for
description is determined at construction time. If you want multiline descriptions description is determined at construction time. If you want multiline descriptions
make sure the initial description has at least that amount of lines.""" make sure the initial description has at least that amount of lines."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -1014,8 +1014,8 @@ def show_progress_coinjoin(
time_ms: int = 0, time_ms: int = 0,
skip_first_paint: bool = False, skip_first_paint: bool = False,
) -> LayoutObj[UiResult]: ) -> LayoutObj[UiResult]:
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
time_ms timeout is passed.""" time_ms timeout is passed."""
# rust/src/ui/model_tr/layout.rs # rust/src/ui/model_tr/layout.rs
@ -1144,8 +1144,8 @@ class LayoutObj(Generic[T]):
# rust/src/ui/model_tt/layout.rs # rust/src/ui/model_tt/layout.rs
class UiResult: class UiResult:
"""Result of a UI operation.""" """Result of an UI operation."""
pass pass
CONFIRMED: UiResult CONFIRMED: UiResult
CANCELLED: UiResult CANCELLED: UiResult
INFO: UiResult INFO: UiResult

View File

@ -151,4 +151,4 @@ BITCOIN_ONLY: bool
UI_LAYOUT: str UI_LAYOUT: str
"""UI layout identifier ("tt" for model T, "tr" for models One and R).""" """UI layout identifier ("tt" for model T, "tr" for models One and R)."""
USE_THP: bool USE_THP: bool
"""Whether the firmware supports Trezor-Host Protocol (version 3).""" """Whether the firmware supports Trezor-Host Protocol (version 2)."""

View File

@ -375,7 +375,7 @@ async def _read_cmd(iface: HID) -> Cmd | None:
desc_cont = frame_cont() desc_cont = frame_cont()
read = loop.wait(iface.iface_num() | io.POLL_READ) read = loop.wait(iface.iface_num() | io.POLL_READ)
# wait for incoming comand indefinitely # wait for incoming command indefinitely
buf = await read buf = await read
while True: while True:
ifrm = overlay_struct(bytearray(buf), desc_init) ifrm = overlay_struct(bytearray(buf), desc_init)

View File

@ -29,7 +29,7 @@ if __debug__:
# trezor.pin imports trezor.utils # trezor.pin imports trezor.utils
# We need it as an always-active module because trezor.pin.show_pin_timeout is used # We need it as an always-active module because trezor.pin.show_pin_timeout is used
# as a UI callback for storage, which can be invoked at any time # as an UI callback for storage, which can be invoked at any time
import trezor.pin # noqa: F401 import trezor.pin # noqa: F401
# === Prepare the USB interfaces first. Do not connect to the host yet. # === Prepare the USB interfaces first. Do not connect to the host yet.