summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2024-01-27 16:15:35 +0100
committerGitHub <noreply@github.com>2024-01-27 16:15:35 +0100
commit2b51980904933f8275e9a60f164a0bc6b2eda070 (patch)
treea60a13182b3f8321d7c218ac182fc8862d05e2de /lib
parent1865e228c4f6bd3cdafe175eb37eaa70147a065d (diff)
downloadspack-2b51980904933f8275e9a60f164a0bc6b2eda070.tar.gz
spack-2b51980904933f8275e9a60f164a0bc6b2eda070.tar.bz2
spack-2b51980904933f8275e9a60f164a0bc6b2eda070.tar.xz
spack-2b51980904933f8275e9a60f164a0bc6b2eda070.zip
Apply black 2024 style to Spack (#42317)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/bootstrap/environment.py2
-rw-r--r--lib/spack/spack/build_systems/intel.py2
-rw-r--r--lib/spack/spack/caches.py12
-rw-r--r--lib/spack/spack/ci_needs_workaround.py4
-rw-r--r--lib/spack/spack/cmd/list.py8
-rw-r--r--lib/spack/spack/concretize.py1
-rw-r--r--lib/spack/spack/fetch_strategy.py3
-rw-r--r--lib/spack/spack/filesystem_view.py6
-rw-r--r--lib/spack/spack/stage.py8
-rw-r--r--lib/spack/spack/test/cmd/url.py10
-rw-r--r--lib/spack/spack/test/cmd_extensions.py6
-rw-r--r--lib/spack/spack/test/compilers/detection.py2
-rw-r--r--lib/spack/spack/test/database.py40
-rw-r--r--lib/spack/spack/test/stage.py18
-rw-r--r--lib/spack/spack/test/util/archive.py4
15 files changed, 49 insertions, 77 deletions
diff --git a/lib/spack/spack/bootstrap/environment.py b/lib/spack/spack/bootstrap/environment.py
index 1f8fbe8097..f1af8990e8 100644
--- a/lib/spack/spack/bootstrap/environment.py
+++ b/lib/spack/spack/bootstrap/environment.py
@@ -146,7 +146,7 @@ def mypy_root_spec() -> str:
def black_root_spec() -> str:
"""Return the root spec used to bootstrap black"""
- return _root_spec("py-black@:23.1.0")
+ return _root_spec("py-black@:24.1.0")
def flake8_root_spec() -> str:
diff --git a/lib/spack/spack/build_systems/intel.py b/lib/spack/spack/build_systems/intel.py
index 0dfe4ede26..1a6e0b7acb 100644
--- a/lib/spack/spack/build_systems/intel.py
+++ b/lib/spack/spack/build_systems/intel.py
@@ -218,7 +218,7 @@ class IntelPackage(Package):
"+inspector": " intel-inspector",
"+itac": " intel-itac intel-ta intel-tc" " intel-trace-analyzer intel-trace-collector",
# Trace Analyzer and Collector
- "+vtune": " intel-vtune"
+ "+vtune": " intel-vtune",
# VTune, ..-profiler since 2020, ..-amplifier before
}.items():
if variant in self.spec:
diff --git a/lib/spack/spack/caches.py b/lib/spack/spack/caches.py
index 81a16ea5d8..19c736748e 100644
--- a/lib/spack/spack/caches.py
+++ b/lib/spack/spack/caches.py
@@ -35,9 +35,9 @@ def _misc_cache():
#: Spack's cache for small data
-MISC_CACHE: Union[
- spack.util.file_cache.FileCache, llnl.util.lang.Singleton
-] = llnl.util.lang.Singleton(_misc_cache)
+MISC_CACHE: Union[spack.util.file_cache.FileCache, llnl.util.lang.Singleton] = (
+ llnl.util.lang.Singleton(_misc_cache)
+)
def fetch_cache_location():
@@ -91,6 +91,6 @@ class MirrorCache:
#: Spack's local cache for downloaded source archives
-FETCH_CACHE: Union[
- spack.fetch_strategy.FsCache, llnl.util.lang.Singleton
-] = llnl.util.lang.Singleton(_fetch_cache)
+FETCH_CACHE: Union[spack.fetch_strategy.FsCache, llnl.util.lang.Singleton] = (
+ llnl.util.lang.Singleton(_fetch_cache)
+)
diff --git a/lib/spack/spack/ci_needs_workaround.py b/lib/spack/spack/ci_needs_workaround.py
index e026b5c4fd..b89de48f8f 100644
--- a/lib/spack/spack/ci_needs_workaround.py
+++ b/lib/spack/spack/ci_needs_workaround.py
@@ -7,9 +7,7 @@ import collections.abc
get_job_name = lambda needs_entry: (
needs_entry.get("job")
if (isinstance(needs_entry, collections.abc.Mapping) and needs_entry.get("artifacts", True))
- else needs_entry
- if isinstance(needs_entry, str)
- else None
+ else needs_entry if isinstance(needs_entry, str) else None
)
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py
index eb34e38841..d20621d324 100644
--- a/lib/spack/spack/cmd/list.py
+++ b/lib/spack/spack/cmd/list.py
@@ -292,9 +292,11 @@ def html(pkg_names, out):
out.write("<dd>\n")
out.write(
", ".join(
- d
- if d not in pkg_names
- else '<a class="reference internal" href="#%s">%s</a>' % (d, d)
+ (
+ d
+ if d not in pkg_names
+ else '<a class="reference internal" href="#%s">%s</a>' % (d, d)
+ )
for d in deps
)
)
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index bfa3c133b7..86e1eb9735 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -826,7 +826,6 @@ class NoValidVersionError(spack.error.SpackError):
class InsufficientArchitectureInfoError(spack.error.SpackError):
-
"""Raised when details on architecture cannot be collected from the
system"""
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 93df10c98f..9393a7c78b 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -697,7 +697,6 @@ class GoFetchStrategy(VCSFetchStrategy):
@fetcher
class GitFetchStrategy(VCSFetchStrategy):
-
"""
Fetch strategy that gets source code from a git repository.
Use like this in a package:
@@ -1089,7 +1088,6 @@ class CvsFetchStrategy(VCSFetchStrategy):
@fetcher
class SvnFetchStrategy(VCSFetchStrategy):
-
"""Fetch strategy that gets source code from a subversion repository.
Use like this in a package:
@@ -1184,7 +1182,6 @@ class SvnFetchStrategy(VCSFetchStrategy):
@fetcher
class HgFetchStrategy(VCSFetchStrategy):
-
"""
Fetch strategy that gets source code from a Mercurial repository.
Use like this in a package:
diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py
index 6d9e85b9c4..f2868320c9 100644
--- a/lib/spack/spack/filesystem_view.py
+++ b/lib/spack/spack/filesystem_view.py
@@ -91,9 +91,9 @@ def view_copy(src: str, dst: str, view, spec: Optional[spack.spec.Spec] = None):
prefix_to_projection[spack.store.STORE.layout.root] = view._root
# This is vestigial code for the *old* location of sbang.
- prefix_to_projection[
- "#!/bin/bash {0}/bin/sbang".format(spack.paths.spack_root)
- ] = sbang.sbang_shebang_line()
+ prefix_to_projection["#!/bin/bash {0}/bin/sbang".format(spack.paths.spack_root)] = (
+ sbang.sbang_shebang_line()
+ )
spack.relocate.relocate_text(files=[dst], prefixes=prefix_to_projection)
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 88ad0549cc..b756255bd6 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -199,9 +199,11 @@ def get_stage_root():
def _mirror_roots():
mirrors = spack.config.get("mirrors")
return [
- sup.substitute_path_variables(root)
- if root.endswith(os.sep)
- else sup.substitute_path_variables(root) + os.sep
+ (
+ sup.substitute_path_variables(root)
+ if root.endswith(os.sep)
+ else sup.substitute_path_variables(root) + os.sep
+ )
for root in mirrors.values()
]
diff --git a/lib/spack/spack/test/cmd/url.py b/lib/spack/spack/test/cmd/url.py
index 4d970ddd97..cea7b34a94 100644
--- a/lib/spack/spack/test/cmd/url.py
+++ b/lib/spack/spack/test/cmd/url.py
@@ -98,13 +98,9 @@ def test_url_list(mock_packages):
def test_url_summary(mock_packages):
"""Test the URL summary command."""
# test url_summary, the internal function that does the work
- (
- total_urls,
- correct_names,
- correct_versions,
- name_count_dict,
- version_count_dict,
- ) = url_summary(None)
+ (total_urls, correct_names, correct_versions, name_count_dict, version_count_dict) = (
+ url_summary(None)
+ )
assert 0 < correct_names <= sum(name_count_dict.values()) <= total_urls
assert 0 < correct_versions <= sum(version_count_dict.values()) <= total_urls
diff --git a/lib/spack/spack/test/cmd_extensions.py b/lib/spack/spack/test/cmd_extensions.py
index 8af8972859..6a4fcc0fad 100644
--- a/lib/spack/spack/test/cmd_extensions.py
+++ b/lib/spack/spack/test/cmd_extensions.py
@@ -103,9 +103,9 @@ def hello_world_with_module_in_root(extension_creator):
@contextlib.contextmanager
def _hwwmir(extension_name=None):
- with extension_creator(
- extension_name
- ) if extension_name else extension_creator() as extension:
+ with (
+ extension_creator(extension_name) if extension_name else extension_creator()
+ ) as extension:
# Note that the namespace of the extension is derived from the
# fixture.
extension.add_command(
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index a30d1b8906..07b5269fb7 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -422,7 +422,7 @@ def test_xl_version_detection(version_str, expected_version):
("pgi", "19.1"),
("pgi", "19.1a"),
("intel", "9.0.0"),
- ("intel", "0.0.0-foobar")
+ ("intel", "0.0.0-foobar"),
# ('oneapi', '2021.1'),
# ('oneapi', '2021.1-foobar')
],
diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py
index 299e908a76..e02f549532 100644
--- a/lib/spack/spack/test/database.py
+++ b/lib/spack/spack/test/database.py
@@ -60,13 +60,9 @@ def test_spec_installed_upstream(
upstream_and_downstream_db, mock_custom_repository, config, monkeypatch
):
"""Test whether Spec.installed_upstream() works."""
- (
- upstream_write_db,
- upstream_db,
- upstream_layout,
- downstream_db,
- downstream_layout,
- ) = upstream_and_downstream_db
+ (upstream_write_db, upstream_db, upstream_layout, downstream_db, downstream_layout) = (
+ upstream_and_downstream_db
+ )
# a known installed spec should say that it's installed
with spack.repo.use_repositories(mock_custom_repository):
@@ -90,13 +86,9 @@ def test_spec_installed_upstream(
@pytest.mark.usefixtures("config")
def test_installed_upstream(upstream_and_downstream_db, tmpdir):
- (
- upstream_write_db,
- upstream_db,
- upstream_layout,
- downstream_db,
- downstream_layout,
- ) = upstream_and_downstream_db
+ (upstream_write_db, upstream_db, upstream_layout, downstream_db, downstream_layout) = (
+ upstream_and_downstream_db
+ )
builder = spack.repo.MockRepositoryBuilder(tmpdir.mkdir("mock.repo"))
builder.add_package("x")
@@ -132,13 +124,9 @@ def test_installed_upstream(upstream_and_downstream_db, tmpdir):
@pytest.mark.usefixtures("config")
def test_removed_upstream_dep(upstream_and_downstream_db, tmpdir):
- (
- upstream_write_db,
- upstream_db,
- upstream_layout,
- downstream_db,
- downstream_layout,
- ) = upstream_and_downstream_db
+ (upstream_write_db, upstream_db, upstream_layout, downstream_db, downstream_layout) = (
+ upstream_and_downstream_db
+ )
builder = spack.repo.MockRepositoryBuilder(tmpdir.mkdir("mock.repo"))
builder.add_package("z")
@@ -168,13 +156,9 @@ def test_add_to_upstream_after_downstream(upstream_and_downstream_db, tmpdir):
DB. When a package is recorded as installed in both, the results should
refer to the downstream DB.
"""
- (
- upstream_write_db,
- upstream_db,
- upstream_layout,
- downstream_db,
- downstream_layout,
- ) = upstream_and_downstream_db
+ (upstream_write_db, upstream_db, upstream_layout, downstream_db, downstream_layout) = (
+ upstream_and_downstream_db
+ )
builder = spack.repo.MockRepositoryBuilder(tmpdir.mkdir("mock.repo"))
builder.add_package("x")
diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py
index f6bd267090..024d195daa 100644
--- a/lib/spack/spack/test/stage.py
+++ b/lib/spack/spack/test/stage.py
@@ -444,12 +444,9 @@ class TestStage:
@pytest.mark.disable_clean_stage_check
def test_composite_stage_with_expand_resource(self, composite_stage_with_expanding_resource):
- (
- composite_stage,
- root_stage,
- resource_stage,
- mock_resource,
- ) = composite_stage_with_expanding_resource
+ (composite_stage, root_stage, resource_stage, mock_resource) = (
+ composite_stage_with_expanding_resource
+ )
composite_stage.create()
composite_stage.fetch()
@@ -474,12 +471,9 @@ class TestStage:
directory.
"""
- (
- composite_stage,
- root_stage,
- resource_stage,
- mock_resource,
- ) = composite_stage_with_expanding_resource
+ (composite_stage, root_stage, resource_stage, mock_resource) = (
+ composite_stage_with_expanding_resource
+ )
resource_stage.resource.placement = None
diff --git a/lib/spack/spack/test/util/archive.py b/lib/spack/spack/test/util/archive.py
index 9688f25924..191de25143 100644
--- a/lib/spack/spack/test/util/archive.py
+++ b/lib/spack/spack/test/util/archive.py
@@ -50,8 +50,8 @@ def test_gzip_compressed_tarball_is_reproducible(tmpdir):
# Expected mode for non-dirs is 644 if not executable, 755 if executable. Better to compute
# that as we don't know the umask of the user running the test.
- expected_mode = (
- lambda name: 0o755 if Path(*name.split("/")).lstat().st_mode & 0o100 else 0o644
+ expected_mode = lambda name: (
+ 0o755 if Path(*name.split("/")).lstat().st_mode & 0o100 else 0o644
)
# Verify the tarball contents