fix: type errors outside the mypy baseline

Code moved to sitecollection.py and the triage progress added errors
the baseline did not hold. A reused loop name, two lists without a
type, returns without a value, and a regex match read without a test
for None. Two baseline entries no longer occur and are removed.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 18:43:05 +01:00
1 parent 4af681c754
commit 3e25870259
4 files changed
+14 -13

No files matched your search

-2
View File
@@ -405,8 +405,6 @@ scripts/generate_site.py:0: error: Expected iterable as variadic argument [misc
scripts/generate_site.py:0: error: Generator has incompatible item type "int"; expected "bool" [misc]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "Optional[Any]", target has type "str") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "Union[dict[Any, Any], str, None]", variable has type "str") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "dict[Any, Any]", variable has type "int") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "dict[str, set[str]]", variable has type "set[str]") [assignment]
scripts/generate_site.py:0: error: Incompatible types in assignment (expression has type "dict[str, str]", variable has type "dict[str, tuple[str, dict[str, list[Any]]]]") [assignment]
+2
View File
@@ -927,6 +927,8 @@ def ci_install_lines() -> tuple[str, str]:
text = (_REPO / ".github" / "workflows" / "validate.yml").read_text(encoding="utf-8")
main = re.search(r'^\s*run: (pip install pyyaml "jsonschema.*markdown.*)$', text, re.M)
floor = re.search(r"^\s*run: (python3\.8 -m pip install .*)$", text, re.M)
if main is None or floor is None:
raise RuntimeError("validate.yml no longer installs the packages CONTRIBUTING quotes")
return main.group(1), floor.group(1)
+6 -5
View File
@@ -5018,7 +5018,7 @@ def _print_triage(
) -> bool:
"""Profiles ranked by drift, worst first. False when Ctrl-C cut the
scoring short: the ranking then covers the profiles scored."""
ranked = []
ranked: list[tuple] = []
sampled = 0
progress = _Progress(len(reports), "scored", args.offline or len(reports) < 2)
complete = True
@@ -5299,7 +5299,7 @@ def main() -> None:
raise SystemExit(1)
return
reports = []
reports: list[ProfileReport] = []
quiet = args.offline or len(selected) < 2
if not quiet:
print(
@@ -5474,18 +5474,18 @@ def _emit(
triage was cut short."""
if args.as_json:
print(json.dumps([report_to_dict(r) for r in shown], indent=2))
return
return None
if args.markdown:
target = Path(args.report_dir) / f"profile-sync-{date.today().isoformat()}.md"
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(format_markdown(shown), encoding="utf-8")
print(f"written: {target}")
return
return None
if args.fetch_plan:
for report in shown:
for url in fetch_plan(report):
print(url)
return
return None
if args.triage:
return _print_triage(args, selected, shown)
for report in shown:
@@ -5494,6 +5494,7 @@ def _emit(
print()
if args.changed_only:
_print_elided(reports, len(shown), frozenset(report.name for report in shown))
return None
def _print_elided(
+6 -6
View File
@@ -128,11 +128,11 @@ def _engine_sections(manufacturers: dict[str, dict[str, list]]) -> dict[str, dic
# A variant answers its primary's name: scummvm.zip.a93f1c4b.
base = parts[-1].rsplit(".", 1)[0] if console.startswith(".") else parts[-1]
keys = sorted(readers.get(base, ()))
key = keys[0] if len(keys) == 1 else own
reader = keys[0] if len(keys) == 1 else own
found = next((c for c, held in regrouped.items()
if any(h.get("name") == base for h in held)), None)
target = found or (next((c for c in consoles if c == key), None)
or (engine(key) if key else base))
target = found or (next((c for c in consoles if c == reader), None)
or (engine(reader) if reader else base))
if target != console:
record_card_move(mfr, console, str(f.get("sha1", "")), mfr, target)
regrouped.setdefault(target, []).append(f)
@@ -154,9 +154,9 @@ def _engine_sections(manufacturers: dict[str, dict[str, list]]) -> dict[str, dic
*(f for f in others.pop(folder) if str(f.get("sha1", "")) not in held)]
for mfr in GAME_DATA_TOPS:
for console in out.get(mfr, {}):
key = profiles.get(console) and console
if key and engine(key) != console:
SECTION_LABELS[(mfr, console)] = engine(key)
named = console if console in profiles else None
if named and engine(named) != console:
SECTION_LABELS[(mfr, console)] = engine(named)
return {mfr: consoles for mfr, consoles in out.items() if consoles}