chore(core): update type annotation for `button_request` in `trezorui_api` [no changelog]
What changed, and why it matters
This commit only changes a type annotation in documentation and generated mock files. It replaces `tuple[int, str]` with `tuple[ButtonRequestType, str]` for a function that returns button request information. No actual code behavior changes, and there is no security relevance.
No action needed. This is a non-functional type annotation cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit updates the Python-style type annotation for button_request() in the Rust UI API module comments and the corresponding generated .pyi stub. It imports ButtonRequestType and uses it instead of int. This is a purely cosmetic/documentation change with no runtime effect.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rscore/mocks/generated/trezorui_api.pyiInspect captured patch +4 / −2
diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs
index 19cf2ea1..d4a88cf2 100644
--- a/core/embed/rust/src/ui/api/firmware_micropython.rs
+++ b/core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -1303,6 +1303,7 @@ pub extern "C" fn upy_backlight_fade(_level: Obj) -> Obj {
#[no_mangle]
pub static mp_module_trezorui_api: Module = obj_module! {
/// from trezor import utils
+ /// from trezor.enums import ButtonRequestType
///
/// PropertyType = tuple[str | None, str | bytes | None, bool | None]
/// T = TypeVar("T")
@@ -1379,7 +1380,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// def page_count(self) -> int:
/// """Return the number of pages in the layout object."""
///
- /// def button_request(self) -> tuple[int, str] | None:
+ /// def button_request(self) -> tuple[ButtonRequestType, str] | None:
/// """Return (code, type) of button request made during the last event or timer pass."""
///
/// def get_transition_out(self) -> AttachType:
diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi
index 02c86976..a83d68e7 100644
--- a/core/mocks/generated/trezorui_api.pyi
+++ b/core/mocks/generated/trezorui_api.pyi
@@ -1,5 +1,6 @@
from typing import *
from trezor import utils
+from trezor.enums import ButtonRequestType
PropertyType = tuple[str | None, str | bytes | None, bool | None]
T = TypeVar("T")
@@ -58,7 +59,7 @@ class LayoutObj(Generic[T]):
"""Paint bounds of individual components on screen."""
def page_count(self) -> int:
"""Return the number of pages in the layout object."""
- def button_request(self) -> tuple[int, str] | None:
+ def button_request(self) -> tuple[ButtonRequestType, str] | None:
"""Return (code, type) of button request made during the last event or timer pass."""
def get_transition_out(self) -> AttachType:
"""Return the transition type."""
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.