Skip to content

Commit

Permalink
chore: fix type issues in make check
Browse files Browse the repository at this point in the history
  • Loading branch information
grdddj authored and tsusanka committed Jun 18, 2024
1 parent 0b87837 commit 73a417a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ def explore_firmwares(args: Any) -> None:
_print_in_verbose(f"On x86, ignoring ARM emulator - {fw}", args)
continue

for identifier, model in [
models: List[Tuple[str, Model]] = [
(IDENTIFIER_T1, "1"),
(IDENTIFIER_TT, "2"),
(IDENTIFIER_TR, "R"),
(IDENTIFIER_T3T1, "T3T1"),
]:
]

for identifier, model in models:
if identifier in fw:
version = fw.split(identifier)[-1]
break
Expand Down
2 changes: 1 addition & 1 deletion src/binaries/firmware/bin/download_latest_gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_latest_run_id(workflow_id: int, branch: str) -> int | None:
for run in runs:
# TODO: might also check run["conclusion"] == "success", but it seems to always fail
if run["head_branch"] == branch and run["status"] == "completed":
return run["id"]
return run["id"] # type: ignore
return None


Expand Down
10 changes: 6 additions & 4 deletions src/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from urllib.error import HTTPError

from psutil import Popen
from trezorlib import debuglink, device, messages
from trezorlib import debuglink, device, messages, models
from trezorlib._internal.emulator import CoreEmulator, LegacyEmulator
from trezorlib.debuglink import DebugLink, TrezorClientDebugLink
from trezorlib.exceptions import TrezorFailure
Expand Down Expand Up @@ -139,7 +139,7 @@ def start_from_url(
log(f"Emulator from {url} will be saved under {emu_path}")
try:
urllib.request.urlretrieve(url, emu_path)
except HTTPError as e:
except HTTPError as first_err:
if binaries.IS_ARM and not url.endswith(binaries.ARM_IDENTIFIER):
log(
"ARM detected, trying to download the ARM version of the emulator",
Expand All @@ -154,7 +154,9 @@ def start_from_url(
log(err, "red")
raise RuntimeError(err)
else:
err = f"HTTP error when downloading emulator from {url}, err: {e}"
err = (
f"HTTP error when downloading emulator from {url}, err: {first_err}"
)
log(err, "red")
raise RuntimeError(err)
# Running chmod +x on the newly downloaded emulator and
Expand Down Expand Up @@ -261,7 +263,7 @@ def version_model() -> str:
time.sleep(SLEEP)
with connect_to_debuglink() as debug:
# Need to set model info (both TT and TR are under same category)
debug.model = "T"
debug.model = models.T2T1
dir_to_save = get_new_screenshot_dir()
log(f"Saving screenshots to {dir_to_save}")
debug.start_recording(str(dir_to_save))
Expand Down

0 comments on commit 73a417a

Please sign in to comment.