style: fix not in and is not (#48831)

These are some changes that `ruff check --fix` would make that the current
`spack style` also agrees with.  Make the changes now so that the `ruff`
change is less disruptive.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
Todd Gamblin 2025-02-03 00:49:38 -08:00 committed by GitHub
parent 742eaa32b7
commit 608ed967e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 12 additions and 12 deletions

View File

@ -57,7 +57,7 @@ def validate(configuration_file):
# Set the default value of the concretization strategy to unify and # Set the default value of the concretization strategy to unify and
# warn if the user explicitly set another value # warn if the user explicitly set another value
env_dict.setdefault("concretizer", {"unify": True}) env_dict.setdefault("concretizer", {"unify": True})
if not env_dict["concretizer"]["unify"] is True: if env_dict["concretizer"]["unify"] is not True:
warnings.warn( warnings.warn(
'"concretizer:unify" is not set to "true", which means the ' '"concretizer:unify" is not set to "true", which means the '
"generated image may contain different variants of the same " "generated image may contain different variants of the same "

View File

@ -814,7 +814,7 @@ def get_depflags(self, pkg: "spack.package_base.PackageBase") -> int:
# Include build dependencies if pkg is going to be built from sources, or # Include build dependencies if pkg is going to be built from sources, or
# if build deps are explicitly requested. # if build deps are explicitly requested.
if include_build_deps or not ( if include_build_deps or not (
cache_only or pkg.spec.installed and not pkg.spec.dag_hash() in self.overwrite cache_only or pkg.spec.installed and pkg.spec.dag_hash() not in self.overwrite
): ):
depflag |= dt.BUILD depflag |= dt.BUILD
if self.run_tests(pkg): if self.run_tests(pkg):

View File

@ -64,7 +64,7 @@ def from_local_path(path: str):
@staticmethod @staticmethod
def from_url(url: str): def from_url(url: str):
"""Create an anonymous mirror by URL. This method validates the URL.""" """Create an anonymous mirror by URL. This method validates the URL."""
if not urllib.parse.urlparse(url).scheme in supported_url_schemes: if urllib.parse.urlparse(url).scheme not in supported_url_schemes:
raise ValueError( raise ValueError(
f'"{url}" is not a valid mirror URL. ' f'"{url}" is not a valid mirror URL. '
f"Scheme must be one of {supported_url_schemes}." f"Scheme must be one of {supported_url_schemes}."

View File

@ -182,7 +182,7 @@ def test_requirement_adds_version_satisfies(
# Sanity check: early version of T does not include U # Sanity check: early version of T does not include U
s0 = spack.concretize.concretize_one("t@2.0") s0 = spack.concretize.concretize_one("t@2.0")
assert not ("u" in s0) assert "u" not in s0
conf_str = """\ conf_str = """\
packages: packages:

View File

@ -32,7 +32,7 @@ def edit(self, spec, prefix):
# Dictionary mapping: compiler-name : ACE config-label # Dictionary mapping: compiler-name : ACE config-label
supported = {"intel": "_icc", "gcc": ""} supported = {"intel": "_icc", "gcc": ""}
if not (self.compiler.name in supported): if self.compiler.name not in supported:
raise Exception( raise Exception(
"compiler " + self.compiler.name + " not supported in ace spack-package" "compiler " + self.compiler.name + " not supported in ace spack-package"
) )

View File

@ -360,7 +360,7 @@ def cmake_args(self):
args.append("-DAMReX_GPU_BACKEND=SYCL") args.append("-DAMReX_GPU_BACKEND=SYCL")
# SYCL GPU backend only supported with Intel's oneAPI or DPC++ compilers # SYCL GPU backend only supported with Intel's oneAPI or DPC++ compilers
sycl_compatible_compilers = ["icpx"] sycl_compatible_compilers = ["icpx"]
if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): if os.path.basename(self.compiler.cxx) not in sycl_compatible_compilers:
raise InstallError( raise InstallError(
"AMReX's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler." "AMReX's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler."
) )

View File

@ -276,7 +276,7 @@ def charmarch(self):
# build-target=LIBS backend={0}'.format(b)) # build-target=LIBS backend={0}'.format(b))
def install(self, spec, prefix): def install(self, spec, prefix):
if not ("backend=mpi" in self.spec) or not ("backend=netlrts" in self.spec): if "backend=mpi" not in self.spec or "backend=netlrts" not in self.spec:
if self.spec.satisfies("+pthreads"): if self.spec.satisfies("+pthreads"):
raise InstallError( raise InstallError(
"The pthreads option is only available on the Netlrts and MPI network layers." "The pthreads option is only available on the Netlrts and MPI network layers."

View File

@ -30,7 +30,7 @@ def dav_sdk_depends_on(spec, when=None, propagate=None):
# Map the propagated variants to the dependency variant. Some packages may need # Map the propagated variants to the dependency variant. Some packages may need
# overrides to propagate a dependency as something else, e.g., {"visit": "libsim"}. # overrides to propagate a dependency as something else, e.g., {"visit": "libsim"}.
# Most call-sites will just use a list. # Most call-sites will just use a list.
if not type(propagate) is dict: if type(propagate) is not dict:
propagate = dict([(v, v) for v in propagate]) propagate = dict([(v, v) for v in propagate])
# Determine the base variant # Determine the base variant

View File

@ -30,7 +30,7 @@ def dav_sdk_depends_on(spec, when=None, propagate=None):
# Map the propagated variants to the dependency variant. Some packages may need # Map the propagated variants to the dependency variant. Some packages may need
# overrides to propagate a dependency as something else, e.g., {"visit": "libsim"}. # overrides to propagate a dependency as something else, e.g., {"visit": "libsim"}.
# Most call-sites will just use a list. # Most call-sites will just use a list.
if not type(propagate) is dict: if type(propagate) is not dict:
propagate = dict([(v, v) for v in propagate]) propagate = dict([(v, v) for v in propagate])
# Determine the base variant # Determine the base variant

View File

@ -226,7 +226,7 @@ def cmake_args(self):
if self.spec.satisfies("+sycl"): if self.spec.satisfies("+sycl"):
sycl_compatible_compilers = ["icpx"] sycl_compatible_compilers = ["icpx"]
if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): if os.path.basename(self.compiler.cxx) not in sycl_compatible_compilers:
raise InstallError("ginkgo +sycl requires icpx compiler.") raise InstallError("ginkgo +sycl requires icpx compiler.")
return args return args

View File

@ -322,7 +322,7 @@ def configure_args(self):
if spec.satisfies("+sycl"): if spec.satisfies("+sycl"):
configure_args.append("--with-sycl") configure_args.append("--with-sycl")
sycl_compatible_compilers = ["icpx"] sycl_compatible_compilers = ["icpx"]
if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): if os.path.basename(self.compiler.cxx) not in sycl_compatible_compilers:
raise InstallError( raise InstallError(
"Hypre's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler." "Hypre's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler."
) )

View File

@ -582,7 +582,7 @@ def configure_options(self):
if "+sycl" in spec: if "+sycl" in spec:
sycl_compatible_compilers = ["icpx"] sycl_compatible_compilers = ["icpx"]
if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): if os.path.basename(self.compiler.cxx) not in sycl_compatible_compilers:
raise InstallError("PETSc's SYCL GPU Backend requires oneAPI CXX (icpx) compiler.") raise InstallError("PETSc's SYCL GPU Backend requires oneAPI CXX (icpx) compiler.")
options.append("--with-sycl=1") options.append("--with-sycl=1")
options.append("--with-syclc=" + self.compiler.cxx) options.append("--with-syclc=" + self.compiler.cxx)