1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-28 18:38:39 +00:00

refactor(core/python): update and unify type ignore statements

[no changelog]
This commit is contained in:
M1nd3r 2024-11-14 15:12:55 +01:00
parent 834d556b9c
commit f9ccced691
5 changed files with 11 additions and 6 deletions

View File

@ -60,7 +60,7 @@ def exception(name: str, exc: BaseException) -> None:
name,
_DEBUG,
"ui.Result: %s",
exc.value, # type: ignore[Cannot access attribute "value" for class "BaseException"]
exc.value, # type: ignore [Cannot access attribute "value" for class "BaseException"]
)
elif exc.__class__.__name__ == "Cancelled":
_log(name, _DEBUG, "ui.Cancelled")

View File

@ -64,7 +64,7 @@ def raise_if_not_confirmed(
exc: ExceptionType = ActionCancelled,
) -> Awaitable[None]:
action = interact(layout_obj, br_name, br_code, exc)
return action # type: ignore ["UiResult" is incompatible with "None"]
return action # type: ignore [Expression of type "Coroutine[Any, Any, UiResult]" is incompatible with return type "Awaitable[None]"]
async def with_info(

View File

@ -1114,7 +1114,7 @@ def request_passphrase_on_device(max_len: int) -> Awaitable[str]:
ButtonRequestType.PassphraseEntry,
raise_on_cancel=ActionCancelled("Passphrase entry cancelled"),
)
return result # type: ignore ["UiResult" is incompatible with "str"]
return result # type: ignore [Expression of type "Coroutine[Any, Any, str | UiResult]" is incompatible with return type "Awaitable[str]"]
def request_pin_on_device(
@ -1143,7 +1143,7 @@ def request_pin_on_device(
ButtonRequestType.PinEntry,
raise_on_cancel=PinCancelled,
)
return result # type: ignore ["UiResult" is incompatible with "str"]
return result # type: ignore [Expression of type "Coroutine[Any, Any, str | UiResult]" is incompatible with return type "Awaitable[str]"]
async def confirm_reenter_pin(is_wipe_code: bool = False) -> None:

View File

@ -1258,7 +1258,7 @@ def pin_mismatch_popup(is_wipe_code: bool = False) -> Awaitable[None]:
TR.buttons__check_again,
br_code=BR_CODE_OTHER,
)
return layout # type: ignore ["UiResult" is incompatible with "None"]
return layout # type: ignore [Expression of type "Awaitable[UiResult]" is incompatible with return type "Awaitable[None]"]
def wipe_code_same_as_pin_popup() -> Awaitable[None]:

View File

@ -1,4 +1,4 @@
from typing import Awaitable, Sequence
from typing import TYPE_CHECKING
import trezorui2
from trezor import TR
@ -9,6 +9,11 @@ from . import confirm_action, show_success, show_warning
CONFIRMED = trezorui2.CONFIRMED # global_import_cache
if TYPE_CHECKING:
from typing import Awaitable, Sequence
pass
async def show_share_words(
share_words: Sequence[str],