From 4c009539c74ccf7f149da33b4512937dd7b02941 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Wed, 13 Nov 2024 19:38:31 +0100 Subject: [PATCH] docs(core): fix docs indentation and correct a few typos [no changelog] --- common/protob/messages-debug.proto | 2 +- .../modtrezorcrypto/modtrezorcrypto-aesgcm.h | 12 ++++---- .../extmod/modtrezorio/modtrezorio-fatfs.h | 6 ++-- .../extmod/modtrezorutils/modtrezorutils.c | 2 +- core/embed/rust/src/ui/model_tr/layout.rs | 26 ++++++++-------- core/embed/rust/src/ui/model_tt/layout.rs | 4 +-- .../mocks/generated/trezorcrypto/__init__.pyi | 12 ++++---- core/mocks/generated/trezorio/fatfs.pyi | 6 ++-- core/mocks/generated/trezorui2.pyi | 30 +++++++++---------- core/mocks/generated/trezorutils.pyi | 2 +- core/src/apps/webauthn/fido2.py | 2 +- core/src/main.py | 2 +- 12 files changed, 53 insertions(+), 53 deletions(-) diff --git a/common/protob/messages-debug.proto b/common/protob/messages-debug.proto index 5f4497dca..08f0f30e5 100644 --- a/common/protob/messages-debug.proto +++ b/common/protob/messages-debug.proto @@ -121,7 +121,7 @@ message DebugLinkState { optional string pin = 2; // current PIN, blank if PIN is not set/enabled optional string matrix = 3; // current PIN matrix 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 string reset_word = 7; // word on device display during ResetDevice workflow optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow diff --git a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-aesgcm.h b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-aesgcm.h index b7edf784b..80dfaa809 100644 --- a/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-aesgcm.h +++ b/core/embed/extmod/modtrezorcrypto/modtrezorcrypto-aesgcm.h @@ -111,9 +111,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_AesGcm_encrypt_obj, mod_trezorcrypto_AesGcm_encrypt); /// 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, mp_obj_t data) { 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); /// 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, mp_obj_t data) { mp_obj_AesGcm_t *o = MP_OBJ_TO_PTR(self); diff --git a/core/embed/extmod/modtrezorio/modtrezorio-fatfs.h b/core/embed/extmod/modtrezorio/modtrezorio-fatfs.h index 689f88123..a515e4198 100644 --- a/core/embed/extmod/modtrezorio/modtrezorio-fatfs.h +++ b/core/embed/extmod/modtrezorio/modtrezorio-fatfs.h @@ -519,9 +519,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorio_fatfs_unmount_obj, mod_trezorio_fatfs_unmount); /// 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() { return mp_obj_new_bool(_fatfs_instance_is_mounted()); } diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index 8ab5b5e2c..5a864093c 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -409,7 +409,7 @@ STATIC mp_obj_tuple_t mod_trezorutils_version_obj = { /// UI_LAYOUT: str /// """UI layout identifier ("tt" for model T, "tr" for models One and R).""" /// 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[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorutils)}, diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 47900eb51..e7cb66936 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -2002,7 +2002,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// prefill_word: str, /// can_go_back: bool, /// ) -> LayoutObj[str]: - /// """SLIP39 word input keyboard.""" + /// """SLIP39 word input keyboard.""" Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(), /// def select_word( @@ -2011,8 +2011,8 @@ pub static mp_module_trezorui2: Module = obj_module! { /// description: str, /// words: Iterable[str], /// ) -> LayoutObj[int]: - /// """Select mnemonic word from three possibilities - seed check after backup. The - /// iterable must be of exact size. Returns index in range `0..3`.""" + /// """Select mnemonic word from three possibilities - seed check after backup. The + /// 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(), /// def show_share_words( @@ -2030,7 +2030,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// max_count: int, /// description: Callable[[int], str] | None = None, # unused on TR /// ) -> 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(), /// def show_checklist( @@ -2040,8 +2040,8 @@ pub static mp_module_trezorui2: Module = obj_module! { /// active: int, /// button: str, /// ) -> LayoutObj[UiResult]: - /// """Checklist of backup steps. Active index is highlighted, previous items have check - /// mark next to them.""" + /// """Checklist of backup steps. Active index is highlighted, previous items have check + /// mark next to them.""" Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(), /// def confirm_recovery( @@ -2053,7 +2053,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// info_button: bool, # unused on TR /// show_instructions: bool, /// ) -> LayoutObj[UiResult]: - /// """Device recovery homescreen.""" + /// """Device recovery homescreen.""" Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(), /// def select_word_count( @@ -2068,7 +2068,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// *, /// lines: Iterable[str], /// ) -> 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(), /// def show_progress( @@ -2077,9 +2077,9 @@ pub static mp_module_trezorui2: Module = obj_module! { /// indeterminate: bool = False, /// title: str | None = None, /// ) -> LayoutObj[UiResult]: - /// """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 - /// make sure the initial description has at least that amount of lines.""" + /// """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 + /// 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(), /// def show_progress_coinjoin( @@ -2089,8 +2089,8 @@ pub static mp_module_trezorui2: Module = obj_module! { /// time_ms: int = 0, /// skip_first_paint: bool = False, /// ) -> LayoutObj[UiResult]: - /// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when - /// time_ms timeout is passed.""" + /// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when + /// time_ms timeout is passed.""" Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(), /// def show_homescreen( diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index 1c79507fb..2b5d3aa40 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -1731,8 +1731,8 @@ pub static mp_module_trezorui2: Module = obj_module! { /// """Calls drop on contents of the root component.""" /// /// class UiResult: - /// """Result of a UI operation.""" - /// pass + /// """Result of an UI operation.""" + /// pass /// /// mock:global Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(), diff --git a/core/mocks/generated/trezorcrypto/__init__.pyi b/core/mocks/generated/trezorcrypto/__init__.pyi index a7e0d95f3..7792fbe08 100644 --- a/core/mocks/generated/trezorcrypto/__init__.pyi +++ b/core/mocks/generated/trezorcrypto/__init__.pyi @@ -55,9 +55,9 @@ class aesgcm: """ 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: """ @@ -65,9 +65,9 @@ class aesgcm: """ 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: """ diff --git a/core/mocks/generated/trezorio/fatfs.pyi b/core/mocks/generated/trezorio/fatfs.pyi index 9042d94b2..b15019107 100644 --- a/core/mocks/generated/trezorio/fatfs.pyi +++ b/core/mocks/generated/trezorio/fatfs.pyi @@ -160,9 +160,9 @@ def unmount() -> None: # extmod/modtrezorio/modtrezorio-fatfs.h def is_mounted() -> bool: - """ - Check if the filesystem is mounted. - """ + """ + Check if the filesystem is mounted. + """ # extmod/modtrezorio/modtrezorio-fatfs.h diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index b81d4d91e..1101c7752 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -918,7 +918,7 @@ def request_slip39( prefill_word: str, can_go_back: bool, ) -> LayoutObj[str]: - """SLIP39 word input keyboard.""" + """SLIP39 word input keyboard.""" # rust/src/ui/model_tr/layout.rs @@ -928,8 +928,8 @@ def select_word( description: str, words: Iterable[str], ) -> LayoutObj[int]: - """Select mnemonic word from three possibilities - seed check after backup. The - iterable must be of exact size. Returns index in range `0..3`.""" + """Select mnemonic word from three possibilities - seed check after backup. The + iterable must be of exact size. Returns index in range `0..3`.""" # rust/src/ui/model_tr/layout.rs @@ -949,7 +949,7 @@ def request_number( max_count: int, description: Callable[[int], str] | None = None, # unused on TR ) -> 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 @@ -960,8 +960,8 @@ def show_checklist( active: int, button: str, ) -> LayoutObj[UiResult]: - """Checklist of backup steps. Active index is highlighted, previous items have check - mark next to them.""" + """Checklist of backup steps. Active index is highlighted, previous items have check + mark next to them.""" # rust/src/ui/model_tr/layout.rs @@ -974,7 +974,7 @@ def confirm_recovery( info_button: bool, # unused on TR show_instructions: bool, ) -> LayoutObj[UiResult]: - """Device recovery homescreen.""" + """Device recovery homescreen.""" # rust/src/ui/model_tr/layout.rs @@ -991,7 +991,7 @@ def show_group_share_success( *, lines: Iterable[str], ) -> LayoutObj[int]: - """Shown after successfully finishing a group.""" + """Shown after successfully finishing a group.""" # rust/src/ui/model_tr/layout.rs @@ -1001,9 +1001,9 @@ def show_progress( indeterminate: bool = False, title: str | None = None, ) -> LayoutObj[UiResult]: - """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 - make sure the initial description has at least that amount of lines.""" + """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 + make sure the initial description has at least that amount of lines.""" # rust/src/ui/model_tr/layout.rs @@ -1014,8 +1014,8 @@ def show_progress_coinjoin( time_ms: int = 0, skip_first_paint: bool = False, ) -> LayoutObj[UiResult]: - """Show progress loader for coinjoin. Returns CANCELLED after a specified time when - time_ms timeout is passed.""" + """Show progress loader for coinjoin. Returns CANCELLED after a specified time when + time_ms timeout is passed.""" # rust/src/ui/model_tr/layout.rs @@ -1144,8 +1144,8 @@ class LayoutObj(Generic[T]): # rust/src/ui/model_tt/layout.rs class UiResult: - """Result of a UI operation.""" - pass + """Result of an UI operation.""" + pass CONFIRMED: UiResult CANCELLED: UiResult INFO: UiResult diff --git a/core/mocks/generated/trezorutils.pyi b/core/mocks/generated/trezorutils.pyi index 0607b5c91..d28a5866c 100644 --- a/core/mocks/generated/trezorutils.pyi +++ b/core/mocks/generated/trezorutils.pyi @@ -151,4 +151,4 @@ BITCOIN_ONLY: bool UI_LAYOUT: str """UI layout identifier ("tt" for model T, "tr" for models One and R).""" USE_THP: bool -"""Whether the firmware supports Trezor-Host Protocol (version 3).""" +"""Whether the firmware supports Trezor-Host Protocol (version 2).""" diff --git a/core/src/apps/webauthn/fido2.py b/core/src/apps/webauthn/fido2.py index 7e4eb641a..5a1bedd4a 100644 --- a/core/src/apps/webauthn/fido2.py +++ b/core/src/apps/webauthn/fido2.py @@ -375,7 +375,7 @@ async def _read_cmd(iface: HID) -> Cmd | None: desc_cont = frame_cont() read = loop.wait(iface.iface_num() | io.POLL_READ) - # wait for incoming comand indefinitely + # wait for incoming command indefinitely buf = await read while True: ifrm = overlay_struct(bytearray(buf), desc_init) diff --git a/core/src/main.py b/core/src/main.py index f0c9a54b0..87eba676b 100644 --- a/core/src/main.py +++ b/core/src/main.py @@ -29,7 +29,7 @@ if __debug__: # trezor.pin imports trezor.utils # 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 # === Prepare the USB interfaces first. Do not connect to the host yet.