fix: type the code written today for mypy

Every error outside mypy-baseline.txt is fixed in the code:
- common.py: the CRC32 step reused found, the name the layout branch
  gives a resolution tuple, for its list of matches. It now has its own
  name. bindings_of annotates its systems.
- launchers.py, retropie_launchers.py, install.py: an Optional value
  read before its None check.
- recalbox_launchers.py, rocknix_launchers.py: Launcher calls take
  typed keywords, a partial or named parameters, instead of a
  dict[str, object] spread. end_lineno falls back to lineno.
- retrobat_launchers.py: the StageRomKey match no longer reuses the
  str key, and record values are checked before they are iterated.
- batocera_launchers.py: the value of an assignment is read on an
  Assign or AnnAssign only, and the launcher list is annotated.
- emuelec_launchers.py, emuelec_scraper.py, rocknix_scraper.py: import
  fallbacks no importer reaches are dropped, a reused name renamed.
- batocera_targets_scraper.py: a submodule answer without a commit is
  refused.
The baseline loses the 30 entries these fixes resolved and gains
none.
This commit is contained in:
Abdessamad Derraz committed 2026-11-10 04:41:44 +01:00
1 parent b6129310e5
commit 13e60386be
16 files changed
+83 -119

No files matched your search

+6 -6
View File
@@ -1686,20 +1686,20 @@ def resolve_local_file(
and not sha256_candidates
):
by_crc32 = db.get("indexes", {}).get("by_crc32", {})
found: list[tuple[str, str]] = []
crc_matches: list[tuple[str, str]] = []
for crc in crc_candidates:
match = by_crc32.get(crc)
if match and match in files_db:
path = files_db[match]["path"]
status = _record_match_status(match)
if status and os.path.exists(path):
found.append((path, status))
crc_matches.append((path, status))
# A primary copy over a .variants/ one, as everywhere else.
for path, status in found:
for path, status in crc_matches:
if "/.variants/" not in path:
return path, status
if found:
return found[0]
if crc_matches:
return crc_matches[0]
# 2. MD5 direct lookup (skip for zipped_file: md5 is inner ROM, not container)
# Guard: only accept if the found file's name matches the requested name
@@ -3074,7 +3074,7 @@ def platform_layouts(
family.setdefault(system, set()).update(entry_launch_systems(f, index) - own)
def bindings_of(entry: dict) -> dict[str, tuple[str, str]]:
systems = frozenset()
systems: frozenset[str] = frozenset()
if per_system:
own = entry_launch_systems(entry, {})
systems = entry_launch_systems(entry, index)