builtin: remove spack.variant imports (#50576)

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo
2025-05-21 11:35:06 +02:00
committed by GitHub
parent bfc52d6f50
commit 5879724a2a
12 changed files with 22 additions and 42 deletions

View File

@@ -208,7 +208,7 @@ def variant_type(self) -> VariantType:
else:
return VariantType.SINGLE
def __str__(self):
def __str__(self) -> str:
return (
f"Variant('{self.name}', "
f"default='{self.default}', "
@@ -491,14 +491,14 @@ class DisjointSetsOfValues(collections.abc.Sequence):
*sets (list): mutually exclusive sets of values
"""
_empty_set = set(("none",))
_empty_set = {"none"}
def __init__(self, *sets):
def __init__(self, *sets: Tuple[str, ...]) -> None:
self.sets = [set(_flatten(x)) for x in sets]
# 'none' is a special value and can appear only in a set of
# a single element
if any("none" in s and s != set(("none",)) for s in self.sets):
if any("none" in s and s != {"none"} for s in self.sets):
raise spack.error.SpecError(
"The value 'none' represents the empty set,"
" and must appear alone in a set. Use the "