diff --git a/mypy-baseline.txt b/mypy-baseline.txt index 8f879cac1..9a90fe31d 100644 --- a/mypy-baseline.txt +++ b/mypy-baseline.txt @@ -858,19 +858,10 @@ scripts/upstream.py:0: error: "object" has no attribute "get" [attr-defined] scripts/upstream.py:0: error: Incompatible types in assignment (expression has type "str | None", variable has type "str") [assignment] scripts/upstream.py:0: error: Incompatible types in assignment (expression has type "str | None", variable has type "str") [assignment] scripts/upstream.py:0: error: Value of type "object" is not indexable [index] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "add" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "setdefault" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "setdefault" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "update" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "update" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "update" [attr-defined] -scripts/validate_pr.py:0: error: "Collection[Any]" has no attribute "update" [attr-defined] scripts/validate_pr.py:0: error: "_MutuallyExclusiveGroup" has no attribute "append" [attr-defined] scripts/validate_pr.py:0: error: "add" of "set" does not return a value (it only ever returns None) [func-returns-value] -scripts/validate_pr.py:0: error: Argument 1 to "_note_sizes" has incompatible type "Collection[Any]"; expected "dict[str, list[Any]]" [arg-type] scripts/validate_pr.py:0: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "_MutuallyExclusiveGroup") [assignment] scripts/validate_pr.py:0: error: Need type annotation for "checks" (hint: "checks: list[] = ...") [var-annotated] -scripts/validate_pr.py:0: error: Need type annotation for "known" [var-annotated] scripts/validate_schemas.py:0: error: "object" has no attribute "get" [attr-defined] scripts/validate_schemas.py:0: error: "object" has no attribute "get" [attr-defined] scripts/validate_schemas.py:0: error: "object" has no attribute "get" [attr-defined] diff --git a/scripts/validate_pr.py b/scripts/validate_pr.py index 420239f5e..e29bf0271 100644 --- a/scripts/validate_pr.py +++ b/scripts/validate_pr.py @@ -30,6 +30,7 @@ import zipfile from collections.abc import Callable, Iterable from dataclasses import dataclass from pathlib import Path +from typing import Any sys.path.insert(0, os.path.dirname(__file__)) from common import ( @@ -181,7 +182,7 @@ def load_platform_hashes(platforms_dir: str, db: dict | None = None) -> dict: bios/// folders the collection files its system under, read from the other files of that system it holds. """ - known = {"sha1": set(), "md5": set(), "sha256": set(), "crc32": set(), + known: dict[str, Any] = {"sha1": set(), "md5": set(), "sha256": set(), "crc32": set(), "names": set(), "folders": {}, "sizes": {}, "entries": {}, "named": {}, "name_systems": {}, "system_dirs": {}, "system_folders": {}} systems_of: dict[str, set[str]] = {} @@ -778,12 +779,13 @@ def placement( tables = (platform_hashes, profile_hashes or {}) # A name several systems declare does not say which one a file is: # a copy held for one of them is no answer. - within = set() if not systems and len(owners) > 1 else { + dirs: set[str] = set() if not systems and len(owners) > 1 else { d for table in tables for s in owners for d in table.get("system_dirs", {}).get(s, ()) } tail = _directory_tail(db, directory) + within: set[str] | None = dirs if tail: - within = {d for d in within if d.endswith("/" + tail) or d == tail} if owners else None + within = {d for d in dirs if d.endswith("/" + tail) or d == tail} if owners else None home = _variant_home(db, filename, held, within if owners or tail else None) if declared and home and filename and "/" not in filename: # The folder holds a file of that name already.