compat with mypy 1.14 (#48626)

* OSError.errno apparently is int | None, but already part of __str__ anyway so drop

* fix disambiguate_spec_from_hashes

* List[Spec].sort() complains, ignore it

* fix typing of KnownCompiler, and use it in asp.py
This commit is contained in:
Harmen Stoppels 2025-01-18 21:16:05 +01:00 committed by GitHub
parent d0217cf04e
commit 962498095d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View File

@ -1740,8 +1740,7 @@ def find(
def _log_file_access_issue(e: OSError, path: str) -> None:
errno_name = errno.errorcode.get(e.errno, "UNKNOWN")
tty.debug(f"find must skip {path}: {errno_name} {e}")
tty.debug(f"find must skip {path}: {e}")
def _file_id(s: os.stat_result) -> Tuple[int, int]:

View File

@ -297,7 +297,7 @@ def disambiguate_spec(
def disambiguate_spec_from_hashes(
spec: spack.spec.Spec,
hashes: List[str],
hashes: Optional[List[str]],
local: bool = False,
installed: Union[bool, InstallRecordStatus] = True,
first: bool = False,

View File

@ -1706,7 +1706,7 @@ def query(
)
results = list(local_results) + list(x for x in upstream_results if x not in local_results)
results.sort()
results.sort() # type: ignore[call-overload]
return results
def query_one(

View File

@ -750,7 +750,7 @@ class KnownCompiler(NamedTuple):
spec: spack.spec.Spec
os: str
target: str
target: Optional[str]
available: bool
compiler_obj: Optional[spack.compiler.Compiler]
@ -1133,7 +1133,7 @@ def __init__(self, tests: bool = False):
set
)
self.possible_compilers: List = []
self.possible_compilers: List[KnownCompiler] = []
self.possible_oses: Set = set()
self.variant_values_from_specs: Set = set()
self.version_constraints: Set = set()