diff --git a/core/src/apps/bitcoin/common.py b/core/src/apps/bitcoin/common.py index 4ca01391d..472d7b782 100644 --- a/core/src/apps/bitcoin/common.py +++ b/core/src/apps/bitcoin/common.py @@ -14,7 +14,7 @@ if TYPE_CHECKING: from apps.common.coininfo import CoinInfo from trezor.messages import TxInput else: - IntEnum = object # type: ignore + IntEnum = object BITCOIN_NAMES = ("Bitcoin", "Regtest", "Testnet") diff --git a/core/src/apps/bitcoin/sign_tx/matchcheck.py b/core/src/apps/bitcoin/sign_tx/matchcheck.py index d5d19da88..39fa3554f 100644 --- a/core/src/apps/bitcoin/sign_tx/matchcheck.py +++ b/core/src/apps/bitcoin/sign_tx/matchcheck.py @@ -14,8 +14,8 @@ if TYPE_CHECKING: T = TypeVar("T") else: # typechecker cheat: Generic[T] will be `object` which is a valid parent type - Generic = [object] # type: ignore - T = 0 # type: ignore + Generic = [object] + T = 0 class MatchChecker(Generic[T]): diff --git a/core/src/apps/cardano/helpers/hash_builder_collection.py b/core/src/apps/cardano/helpers/hash_builder_collection.py index 1dae0b87c..a30122aca 100644 --- a/core/src/apps/cardano/helpers/hash_builder_collection.py +++ b/core/src/apps/cardano/helpers/hash_builder_collection.py @@ -10,10 +10,10 @@ if TYPE_CHECKING: K = TypeVar("K") V = TypeVar("V") else: - T = 0 # type: ignore - K = 0 # type: ignore - V = 0 # type: ignore - Generic = {T: object, (K, V): object} # type: ignore + T = 0 + K = 0 + V = 0 + Generic = {T: object, (K, V): object} class HashBuilderCollection: diff --git a/core/src/apps/common/cbor.py b/core/src/apps/common/cbor.py index 954e759e7..78d3d84c2 100644 --- a/core/src/apps/common/cbor.py +++ b/core/src/apps/common/cbor.py @@ -19,8 +19,8 @@ if TYPE_CHECKING: CborSequence = Union[list[Value], Tuple[Value, ...]] else: # typechecker cheat: Generic[K, V] will be `object` which is a valid parent type - Generic = {(0, 0): object} # type: ignore - K = V = 0 # type: ignore + Generic = {(0, 0): object} + K = V = 0 _CBOR_TYPE_MASK = const(0xE0) _CBOR_INFO_BITS = const(0x1F) diff --git a/core/src/apps/workflow_handlers.py b/core/src/apps/workflow_handlers.py index 987866afc..a728866ba 100644 --- a/core/src/apps/workflow_handlers.py +++ b/core/src/apps/workflow_handlers.py @@ -187,6 +187,6 @@ def find_registered_handler(iface: WireInterface, msg_type: int) -> Handler | No modname = find_message_handler_module(msg_type) handler_name = modname[modname.rfind(".") + 1 :] module = __import__(modname, None, None, (handler_name,), 0) - return getattr(module, handler_name) # type: ignore + return getattr(module, handler_name) except ValueError: return None diff --git a/core/src/trezor/crypto/bech32.py b/core/src/trezor/crypto/bech32.py index caaf40ff7..35c1d198a 100644 --- a/core/src/trezor/crypto/bech32.py +++ b/core/src/trezor/crypto/bech32.py @@ -34,7 +34,7 @@ if TYPE_CHECKING: OptionalTuple2 = Union[tuple[None, None], tuple[A, B]] OptionalTuple3 = Union[tuple[None, None, None], tuple[A, B, C]] else: - IntEnum = object # type: ignore + IntEnum = object class Encoding(IntEnum): diff --git a/core/src/trezor/ui/components/common/text.py b/core/src/trezor/ui/components/common/text.py index 7329c4ab2..c32041ce3 100644 --- a/core/src/trezor/ui/components/common/text.py +++ b/core/src/trezor/ui/components/common/text.py @@ -342,7 +342,7 @@ if __debug__: return getattr(self.orig_display, key) def __enter__(self) -> None: - ui.display = self # type: ignore + ui.display = self def __exit__(self, exc: Any, exc_type: Any, tb: Any) -> None: ui.display = self.orig_display diff --git a/core/src/trezor/ui/components/tt/confirm.py b/core/src/trezor/ui/components/tt/confirm.py index 6e4a4a3cf..bd3b082a5 100644 --- a/core/src/trezor/ui/components/tt/confirm.py +++ b/core/src/trezor/ui/components/tt/confirm.py @@ -141,13 +141,13 @@ class InfoConfirm(ui.Layout): self.content = content self.confirm = Button(ui.grid(14), confirm, confirm_style) - self.confirm.on_click = self.on_confirm # type: ignore + self.confirm.on_click = self.on_confirm self.info = Button(ui.grid(13), info, info_style) - self.info.on_click = self.on_info # type: ignore + self.info.on_click = self.on_info self.cancel = Button(ui.grid(12), cancel, cancel_style) - self.cancel.on_click = self.on_cancel # type: ignore + self.cancel.on_click = self.on_cancel def dispatch(self, event: int, x: int, y: int) -> None: self.content.dispatch(event, x, y) @@ -195,22 +195,22 @@ class HoldToConfirm(ui.Layout): self.content = content self.loader = Loader(loader_style) - self.loader.on_start = self._on_loader_start # type: ignore + self.loader.on_start = self._on_loader_start if cancel: self.confirm = Button(ui.grid(17, n_x=4, cells_x=3), confirm, confirm_style) else: self.confirm = Button(ui.grid(4, n_x=1), confirm, confirm_style) - self.confirm.on_press_start = self._on_press_start # type: ignore - self.confirm.on_press_end = self._on_press_end # type: ignore - self.confirm.on_click = self._on_click # type: ignore + self.confirm.on_press_start = self._on_press_start + self.confirm.on_press_end = self._on_press_end + self.confirm.on_click = self._on_click self.cancel = None if cancel: self.cancel = Button( ui.grid(16, n_x=4), res.load(ui.ICON_CANCEL), ButtonAbort ) - self.cancel.on_click = self.on_cancel # type: ignore + self.cancel.on_click = self.on_cancel def _on_press_start(self) -> None: self.loader.start() diff --git a/core/src/trezor/ui/components/tt/info.py b/core/src/trezor/ui/components/tt/info.py index 01465c0a6..13444abc8 100644 --- a/core/src/trezor/ui/components/tt/info.py +++ b/core/src/trezor/ui/components/tt/info.py @@ -43,7 +43,7 @@ class InfoConfirm(ui.Layout): self.panel_area = panel_area confirm_area = ui.grid(4, n_x=1) self.confirm = Button(confirm_area, confirm, style.button) - self.confirm.on_click = self.on_confirm # type: ignore + self.confirm.on_click = self.on_confirm def dispatch(self, event: int, x: int, y: int) -> None: if event == ui.RENDER: diff --git a/core/src/trezor/ui/components/tt/keyboard_bip39.py b/core/src/trezor/ui/components/tt/keyboard_bip39.py index 625e182ae..8aa105f6c 100644 --- a/core/src/trezor/ui/components/tt/keyboard_bip39.py +++ b/core/src/trezor/ui/components/tt/keyboard_bip39.py @@ -106,10 +106,10 @@ class Bip39Keyboard(ui.Layout): icon_back = res.load(ui.ICON_BACK) self.back = Button(ui.grid(0, n_x=3, n_y=4), icon_back, ButtonClear) - self.back.on_click = self.on_back_click # type: ignore + self.back.on_click = self.on_back_click self.input = InputButton(ui.grid(1, n_x=3, n_y=4, cells_x=2), "", "") - self.input.on_click = self.on_input_click # type: ignore + self.input.on_click = self.on_input_click self.keys = [ KeyButton(ui.grid(i + 3, n_y=4), k, self) diff --git a/core/src/trezor/ui/components/tt/keyboard_slip39.py b/core/src/trezor/ui/components/tt/keyboard_slip39.py index 5b101b399..49ad76050 100644 --- a/core/src/trezor/ui/components/tt/keyboard_slip39.py +++ b/core/src/trezor/ui/components/tt/keyboard_slip39.py @@ -109,10 +109,10 @@ class Slip39Keyboard(ui.Layout): icon_back = res.load(ui.ICON_BACK) self.back = Button(ui.grid(0, n_x=3, n_y=4), icon_back, ButtonClear) - self.back.on_click = self.on_back_click # type: ignore + self.back.on_click = self.on_back_click self.input = InputButton(ui.grid(1, n_x=3, n_y=4, cells_x=2), self) - self.input.on_click = self.on_input_click # type: ignore + self.input.on_click = self.on_input_click self.keys = [ KeyButton(ui.grid(i + 3, n_y=4), k, self, i + 1) diff --git a/core/src/trezor/ui/components/tt/num_input.py b/core/src/trezor/ui/components/tt/num_input.py index 05f979fd3..f519535ac 100644 --- a/core/src/trezor/ui/components/tt/num_input.py +++ b/core/src/trezor/ui/components/tt/num_input.py @@ -12,9 +12,9 @@ class NumInput(ui.Component): self.min_count = min_count self.minus = Button(ui.grid(3), "-") - self.minus.on_click = self.on_minus # type: ignore + self.minus.on_click = self.on_minus self.plus = Button(ui.grid(5), "+") - self.plus.on_click = self.on_plus # type: ignore + self.plus.on_click = self.on_plus self.text = Label(ui.grid(4), "", LABEL_CENTER, ui.BOLD) self.edit(count) diff --git a/core/src/trezor/ui/components/tt/passphrase.py b/core/src/trezor/ui/components/tt/passphrase.py index ed8dc9c5e..5726e5587 100644 --- a/core/src/trezor/ui/components/tt/passphrase.py +++ b/core/src/trezor/ui/components/tt/passphrase.py @@ -140,11 +140,11 @@ class PassphraseKeyboard(ui.Layout): self.input = Input(ui.grid(0, n_x=1, n_y=6), "") self.back = Button(ui.grid(12), res.load(ui.ICON_BACK), ButtonClear) - self.back.on_click = self.on_back_click # type: ignore + self.back.on_click = self.on_back_click self.back.disable() self.done = Button(ui.grid(14), res.load(ui.ICON_CONFIRM), ButtonConfirm) - self.done.on_click = self.on_confirm # type: ignore + self.done.on_click = self.on_confirm self.keys = key_buttons(KEYBOARD_KEYS[self.page], self) self.pending_button: KeyButton | None = None diff --git a/core/src/trezor/ui/components/tt/pin.py b/core/src/trezor/ui/components/tt/pin.py index 6592b5342..1fdc97bfc 100644 --- a/core/src/trezor/ui/components/tt/pin.py +++ b/core/src/trezor/ui/components/tt/pin.py @@ -115,19 +115,19 @@ class PinDialog(ui.Layout): icon_confirm = res.load(ui.ICON_CONFIRM) self.confirm_button = Button(ui.grid(14), icon_confirm, ButtonConfirm) - self.confirm_button.on_click = self.on_confirm # type: ignore + self.confirm_button.on_click = self.on_confirm self.confirm_button.disable() icon_back = res.load(ui.ICON_BACK) self.reset_button = Button(ui.grid(12), icon_back, ButtonClear) - self.reset_button.on_click = self.on_reset # type: ignore + self.reset_button.on_click = self.on_reset if allow_cancel: icon_lock = res.load( ui.ICON_CANCEL if config.is_unlocked() else ui.ICON_LOCK ) self.cancel_button = Button(ui.grid(12), icon_lock, ButtonCancel) - self.cancel_button.on_click = self.on_cancel # type: ignore + self.cancel_button.on_click = self.on_cancel else: self.cancel_button = Button(ui.grid(12), "") self.cancel_button.disable() diff --git a/core/src/trezor/ui/components/tt/reset.py b/core/src/trezor/ui/components/tt/reset.py index 928873c43..8105090ed 100644 --- a/core/src/trezor/ui/components/tt/reset.py +++ b/core/src/trezor/ui/components/tt/reset.py @@ -31,7 +31,7 @@ class Slip39NumInput(ui.Component): super().__init__() self.step = step self.input = NumInput(count, min_count=min_count, max_count=max_count) - self.input.on_change = self.on_change # type: ignore + self.input.on_change = self.on_change self.group_id = group_id def dispatch(self, event: int, x: int, y: int) -> None: @@ -126,7 +126,7 @@ class MnemonicWordSelect(ui.Layout): for i, word in enumerate(words): area = ui.grid(i + 2, n_x=1) btn = Button(area, word) - btn.on_click = self.select(word) # type: ignore + btn.on_click = self.select(word) self.buttons.append(btn) if share_index is None: self.text: ui.Component = Text("Check seed") diff --git a/core/src/trezor/ui/components/tt/scroll.py b/core/src/trezor/ui/components/tt/scroll.py index 71f227ceb..f49f0f0a6 100644 --- a/core/src/trezor/ui/components/tt/scroll.py +++ b/core/src/trezor/ui/components/tt/scroll.py @@ -73,7 +73,7 @@ class Paginated(ui.Layout): area = ui.grid(16, n_x=4) icon = res.load(ui.ICON_BACK) self.back_button = Button(area, icon, ButtonDefault) - self.back_button.on_click = self.on_back_click # type: ignore + self.back_button.on_click = self.on_back_click def dispatch(self, event: int, x: int, y: int) -> None: pages = self.pages @@ -169,7 +169,7 @@ class AskPaginated(ui.Component): super().__init__() self.content = content self.button = Button(ui.grid(3, n_x=1), button_text, ButtonDefault) - self.button.on_click = self.on_show_paginated_click # type: ignore + self.button.on_click = self.on_show_paginated_click def dispatch(self, event: int, x: int, y: int) -> None: self.content.dispatch(event, x, y) @@ -218,10 +218,10 @@ class PageWithButtons(ui.Component): right_style = ButtonConfirm self.left = Button(ui.grid(8, n_x=2), left, left_style) - self.left.on_click = self.on_left # type: ignore + self.left.on_click = self.on_left self.right = Button(ui.grid(9, n_x=2), right, right_style) - self.right.on_click = self.on_right # type: ignore + self.right.on_click = self.on_right def dispatch(self, event: int, x: int, y: int) -> None: self.content.dispatch(event, x, y) diff --git a/core/src/trezor/ui/components/tt/word_select.py b/core/src/trezor/ui/components/tt/word_select.py index a12e67dd8..319d61e0c 100644 --- a/core/src/trezor/ui/components/tt/word_select.py +++ b/core/src/trezor/ui/components/tt/word_select.py @@ -15,15 +15,15 @@ class WordSelector(ui.Layout): super().__init__() self.content = content self.w12 = Button(ui.grid(6, n_y=4), "12") - self.w12.on_click = self.on_w12 # type: ignore + self.w12.on_click = self.on_w12 self.w18 = Button(ui.grid(7, n_y=4), "18") - self.w18.on_click = self.on_w18 # type: ignore + self.w18.on_click = self.on_w18 self.w20 = Button(ui.grid(8, n_y=4), "20") - self.w20.on_click = self.on_w20 # type: ignore + self.w20.on_click = self.on_w20 self.w24 = Button(ui.grid(9, n_y=4), "24") - self.w24.on_click = self.on_w24 # type: ignore + self.w24.on_click = self.on_w24 self.w33 = Button(ui.grid(10, n_y=4), "33") - self.w33.on_click = self.on_w33 # type: ignore + self.w33.on_click = self.on_w33 def dispatch(self, event: int, x: int, y: int) -> None: self.content.dispatch(event, x, y) diff --git a/core/src/trezor/ui/layouts/tt/reset.py b/core/src/trezor/ui/layouts/tt/reset.py index 2d58ff10a..519212e2e 100644 --- a/core/src/trezor/ui/layouts/tt/reset.py +++ b/core/src/trezor/ui/layouts/tt/reset.py @@ -83,7 +83,7 @@ async def show_share_words( words = [w for _, w in word_pages[paginated.page]] debug.reset_current_words.publish(words) - paginated.on_change = export_displayed_words # type: ignore + paginated.on_change = export_displayed_words export_displayed_words() # make sure we display correct data