summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2022-07-23 20:19:29 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2022-07-31 13:29:20 -0700
commit156af2a60ab61bb8c03fbe23a52d8ee25c504b23 (patch)
treeab083a8843d0e9e55629f3a07924bb20f9cf2ec7 /lib
parent3fa090f49030b36eb1e4038280504ce3cc1e1de0 (diff)
downloadspack-156af2a60ab61bb8c03fbe23a52d8ee25c504b23.tar.gz
spack-156af2a60ab61bb8c03fbe23a52d8ee25c504b23.tar.bz2
spack-156af2a60ab61bb8c03fbe23a52d8ee25c504b23.tar.xz
spack-156af2a60ab61bb8c03fbe23a52d8ee25c504b23.zip
black: clean up noqa comments from most of the code
Many noqa's in the code are no longer necessary now that the column limit is 99 characters. Others can easily be eliminated, and still more can just be made more specific if they do not have to do with line length. The only E501's still in the code are in the tests for `spack.util.path` and the tests for `spack style`.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/autotools.py2
-rw-r--r--lib/spack/spack/cmd/create.py2
-rw-r--r--lib/spack/spack/cmd/deprecate.py4
-rw-r--r--lib/spack/spack/cmd/python.py2
-rw-r--r--lib/spack/spack/compilers/arm.py2
-rw-r--r--lib/spack/spack/container/writers/__init__.py4
-rw-r--r--lib/spack/spack/database.py2
-rw-r--r--lib/spack/spack/modules/common.py2
-rw-r--r--lib/spack/spack/package_base.py6
-rw-r--r--lib/spack/spack/package_prefs.py2
-rw-r--r--lib/spack/spack/s3_handler.py3
-rw-r--r--lib/spack/spack/test/compilers/detection.py16
-rw-r--r--lib/spack/spack/test/directory_layout.py6
-rw-r--r--lib/spack/spack/test/llnl/util/file_list.py32
-rw-r--r--lib/spack/spack/test/mirror.py2
-rw-r--r--lib/spack/spack/test/modules/lmod.py4
-rw-r--r--lib/spack/spack/test/modules/tcl.py2
-rw-r--r--lib/spack/spack/test/packages.py32
-rw-r--r--lib/spack/spack/test/spec_yaml.py6
-rw-r--r--lib/spack/spack/test/web.py2
-rw-r--r--lib/spack/spack/url.py4
-rw-r--r--lib/spack/spack/util/compression.py8
-rw-r--r--lib/spack/spack/util/file_cache.py4
-rw-r--r--lib/spack/spack/util/lock.py11
-rw-r--r--lib/spack/spack/util/s3.py4
-rw-r--r--lib/spack/spack/util/unparse/unparser.py2
-rw-r--r--lib/spack/spack/util/web.py8
27 files changed, 103 insertions, 71 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py
index bf972bcf8b..6e2b820c90 100644
--- a/lib/spack/spack/build_systems/autotools.py
+++ b/lib/spack/spack/build_systems/autotools.py
@@ -577,7 +577,7 @@ To resolve this problem, please try the following:
line = '--{0}-{1}'.format(
activation_word, option_value
)
- if activation_value is not None and activation_value(option_value): # NOQA=ignore=E501
+ if activation_value is not None and activation_value(option_value):
line += '={0}'.format(
activation_value(option_value)
)
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index b9d6758af5..b2a8e17a28 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -503,7 +503,7 @@ class OctavePackageTemplate(PackageTemplate):
# octave-octave-splines
if not name.startswith('octave-'):
# Make it more obvious that we are renaming the package
- tty.msg("Changing package name from {0} to octave-{0}".format(name)) # noqa
+ tty.msg("Changing package name from {0} to octave-{0}".format(name))
name = 'octave-{0}'.format(name)
super(OctavePackageTemplate, self).__init__(name, *args, **kwargs)
diff --git a/lib/spack/spack/cmd/deprecate.py b/lib/spack/spack/cmd/deprecate.py
index 67cb24be7e..d9f7bd4b6e 100644
--- a/lib/spack/spack/cmd/deprecate.py
+++ b/lib/spack/spack/cmd/deprecate.py
@@ -60,11 +60,11 @@ def setup_parser(sp):
help='Concretize and install deprecator spec')
install.add_argument('-I', '--no-install-deprecator',
action='store_false', default=False, dest='install',
- help='Deprecator spec must already be installed (default)') # noqa 501
+ help='Deprecator spec must already be installed (default)')
sp.add_argument('-l', '--link-type', type=str,
default='soft', choices=['soft', 'hard'],
- help="Type of filesystem link to use for deprecation (default soft)") # noqa 501
+ help="Type of filesystem link to use for deprecation (default soft)")
sp.add_argument('specs', nargs=argparse.REMAINDER,
help="spec to deprecate and spec to use as deprecator")
diff --git a/lib/spack/spack/cmd/python.py b/lib/spack/spack/cmd/python.py
index ac891dbfd1..e43996fb47 100644
--- a/lib/spack/spack/cmd/python.py
+++ b/lib/spack/spack/cmd/python.py
@@ -93,7 +93,7 @@ def ipython_interpreter(args):
% (spack.spack_version, platform.python_version(),
platform.system(), platform.machine()))
- __name__ = "__main__" # noqa
+ __name__ = "__main__" # noqa: F841
IPython.embed(module="__main__", header=header)
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
index bcafe2ae8c..0d833318b4 100644
--- a/lib/spack/spack/compilers/arm.py
+++ b/lib/spack/spack/compilers/arm.py
@@ -32,7 +32,7 @@ class Arm(spack.compiler.Compiler):
# arm compilers. Output looks like this:
#
# $ arm<c/f>lang --version
- # Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2) # NOQA
+ # Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)
# Target: aarch64--linux-gnu
# Thread model: posix
# InstalledDir:
diff --git a/lib/spack/spack/container/writers/__init__.py b/lib/spack/spack/container/writers/__init__.py
index 9d0f71ccd8..47282763cc 100644
--- a/lib/spack/spack/container/writers/__init__.py
+++ b/lib/spack/spack/container/writers/__init__.py
@@ -304,5 +304,5 @@ class PathContext(tengine.Context):
# Import after function definition all the modules in this package,
# so that registration of writers will happen automatically
-import spack.container.writers.singularity # noqa
-import spack.container.writers.docker # noqa
+import spack.container.writers.singularity # noqa: E402
+import spack.container.writers.docker # noqa: E402
diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
index 6a6daf67f9..c56e07ca0a 100644
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -965,7 +965,7 @@ class Database(object):
'spec': entry.spec,
'directory_layout': layout,
'explicit': entry.explicit,
- 'installation_time': entry.installation_time # noqa: E501
+ 'installation_time': entry.installation_time
}
self._add(**kwargs)
processed_specs.add(entry.spec)
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py
index 951cce41fe..4969c34167 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -784,7 +784,7 @@ class BaseContext(tengine.Context):
for x in env:
# Ensure all the tokens are valid in this context
- msg = 'some tokens cannot be expanded in an environment variable name' # noqa: E501
+ msg = 'some tokens cannot be expanded in an environment variable name'
_check_tokens_are_valid(x.name, message=msg)
# Transform them
x.name = spec.format(x.name, transform=transform)
diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py
index 95aaa6319a..7eeb727745 100644
--- a/lib/spack/spack/package_base.py
+++ b/lib/spack/spack/package_base.py
@@ -348,8 +348,8 @@ class PackageMeta(
if 'phases' in attr_dict:
# Turn the strings in 'phases' into InstallPhase instances
# and add them as private attributes
- _InstallPhase_phases = [PackageMeta.phase_fmt.format(x) for x in attr_dict['phases']] # NOQA: ignore=E501
- for phase_name, callback_name in zip(_InstallPhase_phases, attr_dict['phases']): # NOQA: ignore=E501
+ _InstallPhase_phases = [PackageMeta.phase_fmt.format(x) for x in attr_dict['phases']]
+ for phase_name, callback_name in zip(_InstallPhase_phases, attr_dict['phases']):
attr_dict[phase_name] = InstallPhase(callback_name)
attr_dict['_InstallPhase_phases'] = _InstallPhase_phases
@@ -429,7 +429,7 @@ def on_package_attributes(**attr_dict):
)
if has_all_attributes:
has_the_right_values = all(
- [getattr(instance, key) == value for key, value in attr_dict.items()] # NOQA: ignore=E501
+ [getattr(instance, key) == value for key, value in attr_dict.items()]
)
if has_the_right_values:
func(instance, *args, **kwargs)
diff --git a/lib/spack/spack/package_prefs.py b/lib/spack/spack/package_prefs.py
index 7c5e1231fc..6d08f609fa 100644
--- a/lib/spack/spack/package_prefs.py
+++ b/lib/spack/spack/package_prefs.py
@@ -160,7 +160,7 @@ def spec_externals(spec):
one for each known external installation.
"""
# break circular import.
- from spack.util.module_cmd import path_from_modules # NOQA: ignore=F401
+ from spack.util.module_cmd import path_from_modules # noqa: F401
def _package(maybe_abstract_spec):
pkg_cls = spack.repo.path.get_pkg_class(spec.name)
diff --git a/lib/spack/spack/s3_handler.py b/lib/spack/spack/s3_handler.py
index 932ba4611d..904c7adfd2 100644
--- a/lib/spack/spack/s3_handler.py
+++ b/lib/spack/spack/s3_handler.py
@@ -46,8 +46,7 @@ class WrapStream(BufferedReader):
def _s3_open(url):
parsed = url_util.parse(url)
- s3 = s3_util.create_s3_session(parsed,
- connection=s3_util.get_mirror_connection(parsed)) # noqa: E501
+ s3 = s3_util.create_s3_session(parsed, connection=s3_util.get_mirror_connection(parsed))
bucket = parsed.netloc
key = parsed.path
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index 9f79ed1cb6..a0b81f768f 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -28,17 +28,17 @@ from spack.operating_systems.cray_frontend import CrayFrontend
@pytest.mark.parametrize('version_str,expected_version', [
- ('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)\n' # NOQA
+ ('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)\n'
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
- '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
+ '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n',
'19.0.0.73'),
- ('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n' # NOQA
+ ('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n'
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
- '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
+ '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n',
'19.3.1.75')
])
def test_arm_version_detection(version_str, expected_version):
@@ -62,7 +62,9 @@ def test_cce_version_detection(version_str, expected_version):
('Apple clang version 11.0.0 (clang-1100.0.33.8)\n'
'Target: x86_64-apple-darwin18.7.0\n'
'Thread model: posix\n'
- 'InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin\n', # noqa
+ 'InstalledDir: '
+ '/Applications/Xcode.app/Contents/Developer/Toolchains/'
+ 'XcodeDefault.xctoolchain/usr/bin\n',
'11.0.0'),
('Apple LLVM version 7.0.2 (clang-700.1.81)\n'
'Target: x86_64-apple-darwin15.2.0\n'
@@ -79,7 +81,7 @@ def test_apple_clang_version_detection(
@pytest.mark.regression('10191')
@pytest.mark.parametrize('version_str,expected_version', [
# LLVM Clang
- ('clang version 6.0.1-svn334776-1~exp1~20181018152737.116 (branches/release_60)\n' # noqa
+ ('clang version 6.0.1-svn334776-1~exp1~20181018152737.116 (branches/release_60)\n'
'Target: x86_64-pc-linux-gnu\n'
'Thread model: posix\n'
'InstalledDir: /usr/bin\n', '6.0.1'),
@@ -90,7 +92,7 @@ def test_apple_clang_version_detection(
'Target: x86_64-pc-linux-gnu\n'
'Thread model: posix\n'
'InstalledDir: /usr/bin\n', '8.0.0'),
- ('clang version 9.0.1-+201911131414230800840845a1eea-1~exp1~20191113231141.78\n' # noqa
+ ('clang version 9.0.1-+201911131414230800840845a1eea-1~exp1~20191113231141.78\n'
'Target: x86_64-pc-linux-gnu\n'
'Thread model: posix\n'
'InstalledDir: /usr/bin\n', '9.0.1'),
diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py
index 6918e015c4..9b52a6f179 100644
--- a/lib/spack/spack/test/directory_layout.py
+++ b/lib/spack/spack/test/directory_layout.py
@@ -59,8 +59,10 @@ def test_yaml_directory_layout_parameters(tmpdir, config):
# Test separation of architecture or namespace
spec2 = Spec('libelf').concretized()
- arch_scheme = "{architecture.platform}/{architecture.target}/{architecture.os}/{name}/{version}/{hash:7}" # NOQA: ignore=E501
- ns_scheme = "${ARCHITECTURE}/${NAMESPACE}/${PACKAGE}-${VERSION}-${HASH:7}" # NOQA: ignore=E501
+ arch_scheme = (
+ "{architecture.platform}/{architecture.target}/{architecture.os}/{name}/{version}/{hash:7}"
+ )
+ ns_scheme = "${ARCHITECTURE}/${NAMESPACE}/${PACKAGE}-${VERSION}-${HASH:7}"
arch_ns_scheme_projections = {'all': arch_scheme,
'python': ns_scheme}
layout_arch_ns = DirectoryLayout(
diff --git a/lib/spack/spack/test/llnl/util/file_list.py b/lib/spack/spack/test/llnl/util/file_list.py
index 036cea500a..e3c60aa65e 100644
--- a/lib/spack/spack/test/llnl/util/file_list.py
+++ b/lib/spack/spack/test/llnl/util/file_list.py
@@ -61,14 +61,26 @@ class TestLibraryList(object):
def test_joined_and_str(self, library_list):
s1 = library_list.joined()
- expected = '/dir1/liblapack.a /dir2/libpython3.6.dylib /dir1/libblas.a /dir3/libz.so libmpi.so.20.10.1' # noqa: E501
+ expected = " ".join([
+ "/dir1/liblapack.a",
+ "/dir2/libpython3.6.dylib",
+ "/dir1/libblas.a",
+ "/dir3/libz.so",
+ "libmpi.so.20.10.1",
+ ])
assert s1 == expected
s2 = str(library_list)
assert s1 == s2
s3 = library_list.joined(';')
- expected = '/dir1/liblapack.a;/dir2/libpython3.6.dylib;/dir1/libblas.a;/dir3/libz.so;libmpi.so.20.10.1' # noqa: E501
+ expected = ";".join([
+ "/dir1/liblapack.a",
+ "/dir2/libpython3.6.dylib",
+ "/dir1/libblas.a",
+ "/dir3/libz.so",
+ "libmpi.so.20.10.1",
+ ])
assert s3 == expected
def test_flags(self, library_list):
@@ -135,14 +147,26 @@ class TestHeaderList(object):
def test_joined_and_str(self, header_list):
s1 = header_list.joined()
- expected = '/dir1/Python.h /dir2/date.time.h /dir1/pyconfig.hpp /dir3/core.hh pymem.cuh' # noqa: E501
+ expected = " ".join([
+ "/dir1/Python.h",
+ "/dir2/date.time.h",
+ "/dir1/pyconfig.hpp",
+ "/dir3/core.hh",
+ "pymem.cuh",
+ ])
assert s1 == expected
s2 = str(header_list)
assert s1 == s2
s3 = header_list.joined(';')
- expected = '/dir1/Python.h;/dir2/date.time.h;/dir1/pyconfig.hpp;/dir3/core.hh;pymem.cuh' # noqa: E501
+ expected = ";".join([
+ "/dir1/Python.h",
+ "/dir2/date.time.h",
+ "/dir1/pyconfig.hpp",
+ "/dir3/core.hh",
+ "pymem.cuh",
+ ])
assert s3 == expected
def test_flags(self, header_list):
diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py
index 8611765362..f8e1795c49 100644
--- a/lib/spack/spack/test/mirror.py
+++ b/lib/spack/spack/test/mirror.py
@@ -288,7 +288,7 @@ def test_mirror_with_url_patches(mock_packages, config, monkeypatch):
assert not (set([
'abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234',
- 'abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.gz' # NOQA: ignore=E501
+ 'abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.gz',
]) - files_cached_in_mirror)
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 15717ddf4f..66dc8f90de 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -123,7 +123,7 @@ class TestLmod(object):
content = modulefile_content('mpileaks platform=test target=x86_64')
assert len(
- [x for x in content if x.startswith('prepend_path("CMAKE_PREFIX_PATH"')] # NOQA: ignore=E501
+ [x for x in content if x.startswith('prepend_path("CMAKE_PREFIX_PATH"')]
) == 0
assert len([x for x in content if 'setenv("FOO", "foo")' in x]) == 1
assert len([x for x in content if 'unsetenv("BAR")' in x]) == 1
@@ -133,7 +133,7 @@ class TestLmod(object):
)
assert len(
- [x for x in content if x.startswith('prepend-path("CMAKE_PREFIX_PATH"')] # NOQA: ignore=E501
+ [x for x in content if x.startswith('prepend-path("CMAKE_PREFIX_PATH"')]
) == 0
assert len([x for x in content if 'setenv("FOO", "foo")' in x]) == 0
assert len([x for x in content if 'unsetenv("BAR")' in x]) == 0
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py
index 1e75ed4075..138c12691c 100644
--- a/lib/spack/spack/test/modules/tcl.py
+++ b/lib/spack/spack/test/modules/tcl.py
@@ -361,7 +361,7 @@ class TestTcl(object):
assert 'puts stderr "sentence from package"' in content
- short_description = 'module-whatis "This package updates the context for TCL modulefiles."' # NOQA: ignore=E501
+ short_description = 'module-whatis "This package updates the context for TCL modulefiles."'
assert short_description in content
@pytest.mark.regression('4400')
diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py
index 0c02eae5a6..03c2cd5ca8 100644
--- a/lib/spack/spack/test/packages.py
+++ b/lib/spack/spack/test/packages.py
@@ -55,13 +55,13 @@ class TestPackage(object):
# Below tests target direct imports of spack packages from the
# spack.pkg namespace
def test_import_package(self):
- import spack.pkg.builtin.mock.mpich # type: ignore[import] # noqa
+ import spack.pkg.builtin.mock.mpich # type: ignore[import] # noqa: F401
def test_import_package_as(self):
- import spack.pkg.builtin.mock # noqa
- import spack.pkg.builtin.mock as m # noqa
- import spack.pkg.builtin.mock.mpich as mp # noqa
- from spack.pkg.builtin import mock # noqa
+ import spack.pkg.builtin.mock # noqa: F401
+ import spack.pkg.builtin.mock as m # noqa: F401
+ import spack.pkg.builtin.mock.mpich as mp # noqa: F401
+ from spack.pkg.builtin import mock # noqa: F401
def test_inheritance_of_diretives(self):
pkg_cls = spack.repo.path.get_pkg_class('simple-inheritance')
@@ -99,21 +99,21 @@ class TestPackage(object):
assert deps == set(['extension1'])
def test_import_class_from_package(self):
- from spack.pkg.builtin.mock.mpich import Mpich # noqa
+ from spack.pkg.builtin.mock.mpich import Mpich # noqa: F401
def test_import_module_from_package(self):
- from spack.pkg.builtin.mock import mpich # noqa
+ from spack.pkg.builtin.mock import mpich # noqa: F401
def test_import_namespace_container_modules(self):
- import spack.pkg # noqa
- import spack.pkg as p # noqa
- import spack.pkg.builtin # noqa
- import spack.pkg.builtin as b # noqa
- import spack.pkg.builtin.mock # noqa
- import spack.pkg.builtin.mock as m # noqa
- from spack import pkg # noqa
- from spack.pkg import builtin # noqa
- from spack.pkg.builtin import mock # noqa
+ import spack.pkg # noqa: F401
+ import spack.pkg as p # noqa: F401
+ import spack.pkg.builtin # noqa: F401
+ import spack.pkg.builtin as b # noqa: F401
+ import spack.pkg.builtin.mock # noqa: F401
+ import spack.pkg.builtin.mock as m # noqa: F401
+ from spack import pkg # noqa: F401
+ from spack.pkg import builtin # noqa: F401
+ from spack.pkg.builtin import mock # noqa: F401
@pytest.mark.regression('2737')
diff --git a/lib/spack/spack/test/spec_yaml.py b/lib/spack/spack/test/spec_yaml.py
index 450c88bce8..a13a22aa66 100644
--- a/lib/spack/spack/test/spec_yaml.py
+++ b/lib/spack/spack/test/spec_yaml.py
@@ -290,7 +290,7 @@ def test_hashes_use_no_python_dicts(module):
def __init__(self):
self.nodes = []
- def visit_FunctionDef(self, node): # noqa
+ def visit_FunctionDef(self, node):
if node.name in ("to_node_dict", "to_dict", "to_dict_or_value"):
self.nodes.append(node)
@@ -306,10 +306,10 @@ def test_hashes_use_no_python_dicts(module):
% (self.filename, node.lineno, node.col_offset)
)
- def visit_Dict(self, node): # noqa
+ def visit_Dict(self, node):
self.add_error(node)
- def visit_Call(self, node): # noqa
+ def visit_Call(self, node):
name = None
if isinstance(node.func, ast.Name):
name = node.func.id
diff --git a/lib/spack/spack/test/web.py b/lib/spack/spack/test/web.py
index 7d04d564ce..72f5c88ad4 100644
--- a/lib/spack/spack/test/web.py
+++ b/lib/spack/spack/test/web.py
@@ -270,7 +270,7 @@ def test_gather_s3_information(monkeypatch, capfd):
"access_pair": ("SPA", "CK"),
"endpoint_url": "https://127.0.0.1:8888"}
- session_args, client_args = spack.util.s3.get_mirror_s3_connection_info(mock_connection_data) # noqa: E501
+ session_args, client_args = spack.util.s3.get_mirror_s3_connection_info(mock_connection_data)
# Session args are used to create the S3 Session object
assert "aws_session_token" in session_args
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index 8ad7b196af..f12a0c88ce 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -576,7 +576,7 @@ def parse_version_offset(path):
# e.g. http://gitlab.cosma.dur.ac.uk/swift/swiftsim/repository/archive.tar.gz?ref=v0.3.0
# e.g. http://apps.fz-juelich.de/jsc/sionlib/download.php?version=1.7.1
# e.g. https://software.broadinstitute.org/gatk/download/auth?package=GATK-archive&version=3.8-1-0-gf15c1c3ef
- (r'[?&](?:sha|ref|version)=[a-zA-Z\d+-]*[_-]?v?(\d[\da-zA-Z._-]*)$', suffix), # noqa: E501
+ (r'[?&](?:sha|ref|version)=[a-zA-Z\d+-]*[_-]?v?(\d[\da-zA-Z._-]*)$', suffix),
# e.g. http://slepc.upv.es/download/download.php?filename=slepc-3.6.2.tar.gz
# e.g. http://laws-green.lanl.gov/projects/data/eos/get_file.php?package=eospac&filename=eospac_v6.4.0beta.1_r20171213193219.tgz
@@ -588,7 +588,7 @@ def parse_version_offset(path):
# github.com/repo/name/releases/download/vver/name
# e.g. https://github.com/nextflow-io/nextflow/releases/download/v0.20.1/nextflow
- (r'github\.com/[^/]+/[^/]+/releases/download/[a-zA-Z+._-]*v?(\d[\da-zA-Z._-]*)/', path), # noqa: E501
+ (r'github\.com/[^/]+/[^/]+/releases/download/[a-zA-Z+._-]*v?(\d[\da-zA-Z._-]*)/', path),
# e.g. ftp://ftp.ncbi.nlm.nih.gov/blast/executables/legacy.NOTSUPPORTED/2.2.26/ncbi.tar.gz
(r'(\d[\da-zA-Z._-]*)/[^/]+$', path),
diff --git a/lib/spack/spack/util/compression.py b/lib/spack/spack/util/compression.py
index 5be3fbf338..a6433b4542 100644
--- a/lib/spack/spack/util/compression.py
+++ b/lib/spack/spack/util/compression.py
@@ -25,7 +25,7 @@ is_windows = sys.platform == 'win32'
def bz2_support():
try:
- import bz2 # noqa
+ import bz2 # noqa: F401
return True
except ImportError:
return False
@@ -33,7 +33,7 @@ def bz2_support():
def gzip_support():
try:
- import gzip # noqa
+ import gzip # noqa: F401
return True
except ImportError:
return False
@@ -41,7 +41,7 @@ def gzip_support():
def lzma_support():
try:
- import lzma # noqa # novermin
+ import lzma # noqa: F401 # novm
return True
except ImportError:
return False
@@ -49,7 +49,7 @@ def lzma_support():
def tar_support():
try:
- import tarfile # noqa
+ import tarfile # noqa: F401
return True
except ImportError:
return False
diff --git a/lib/spack/spack/util/file_cache.py b/lib/spack/spack/util/file_cache.py
index 611f428881..eead22980d 100644
--- a/lib/spack/spack/util/file_cache.py
+++ b/lib/spack/spack/util/file_cache.py
@@ -131,7 +131,7 @@ class FileCache(object):
# TODO: the locking code.
class WriteContextManager(object):
- def __enter__(cm): # noqa
+ def __enter__(cm):
cm.orig_filename = self.cache_path(key)
cm.orig_file = None
if os.path.exists(cm.orig_filename):
@@ -142,7 +142,7 @@ class FileCache(object):
return cm.orig_file, cm.tmp_file
- def __exit__(cm, type, value, traceback): # noqa
+ def __exit__(cm, type, value, traceback):
if cm.orig_file:
cm.orig_file.close()
cm.tmp_file.close()
diff --git a/lib/spack/spack/util/lock.py b/lib/spack/spack/util/lock.py
index 75d5c653b6..a0ac0f0d64 100644
--- a/lib/spack/spack/util/lock.py
+++ b/lib/spack/spack/util/lock.py
@@ -10,16 +10,21 @@ import sys
import llnl.util.lock
+# import some llnl.util.lock names as though they're part of spack.util.lock
+from llnl.util.lock import LockError # noqa: F401
+from llnl.util.lock import LockTimeoutError # noqa: F401
+from llnl.util.lock import LockUpgradeError # noqa: F401
+from llnl.util.lock import ReadTransaction # noqa: F401
+from llnl.util.lock import WriteTransaction # noqa: F401
+
import spack.config
import spack.error
import spack.paths
-from llnl.util.lock import * # noqa
-
is_windows = sys.platform == 'win32'
-class Lock(llnl.util.lock.Lock): # type: ignore[no-redef]
+class Lock(llnl.util.lock.Lock):
"""Lock that can be disabled.
This overrides the ``_lock()`` and ``_unlock()`` methods from
diff --git a/lib/spack/spack/util/s3.py b/lib/spack/spack/util/s3.py
index 6f12e27f6a..492cb15585 100644
--- a/lib/spack/spack/util/s3.py
+++ b/lib/spack/spack/util/s3.py
@@ -17,7 +17,7 @@ def get_mirror_connection(url, url_type="push"):
# Check to see if desired file starts with any of the mirror URLs
rebuilt_path = url_util.format(url)
# Gather dict of push URLS point to the value of the whole mirror
- mirror_dict = {x.push_url: x for x in spack.mirror.MirrorCollection().values()} # noqa: E501
+ mirror_dict = {x.push_url: x for x in spack.mirror.MirrorCollection().values()}
# Ensure most specific URLs (longest) are presented first
mirror_url_keys = mirror_dict.keys()
mirror_url_keys = sorted(mirror_url_keys, key=len, reverse=True)
@@ -55,7 +55,7 @@ def get_mirror_s3_connection_info(connection):
if endpoint_url:
s3_client_args['endpoint_url'] = _parse_s3_endpoint_url(endpoint_url)
elif s3_connection_is_dict and connection.get("endpoint_url"):
- s3_client_args["endpoint_url"] = _parse_s3_endpoint_url(connection["endpoint_url"]) # noqa: E501
+ s3_client_args["endpoint_url"] = _parse_s3_endpoint_url(connection["endpoint_url"])
return (s3_connection, s3_client_args)
diff --git a/lib/spack/spack/util/unparse/unparser.py b/lib/spack/spack/util/unparse/unparser.py
index 27197bd699..8dbd9083b9 100644
--- a/lib/spack/spack/util/unparse/unparser.py
+++ b/lib/spack/spack/util/unparse/unparser.py
@@ -670,7 +670,7 @@ class Unparser:
self.write(repr(tree.s))
elif isinstance(tree.s, str):
self.write("b" + repr(tree.s))
- elif isinstance(tree.s, unicode): # noqa
+ elif isinstance(tree.s, unicode): # noqa: F821
self.write(repr(tree.s).lstrip("u"))
else:
assert False, "shouldn't get here"
diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py
index 55ff672aea..73f2c8aca0 100644
--- a/lib/spack/spack/util/web.py
+++ b/lib/spack/spack/util/web.py
@@ -207,7 +207,7 @@ def push_to_url(
remote_path = remote_path[1:]
s3 = s3_util.create_s3_session(remote_url,
- connection=s3_util.get_mirror_connection(remote_url)) # noqa: E501
+ connection=s3_util.get_mirror_connection(remote_url))
s3.upload_file(local_file_path, remote_url.netloc,
remote_path, ExtraArgs=extra_args)
@@ -234,7 +234,7 @@ def url_exists(url):
if url.scheme == 's3':
# Check for URL specific connection information
- s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url)) # noqa: E501
+ s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url))
try:
s3.get_object(Bucket=url.netloc, Key=url.path.lstrip('/'))
@@ -280,7 +280,7 @@ def remove_url(url, recursive=False):
if url.scheme == 's3':
# Try to find a mirror for potential connection information
- s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url)) # noqa: E501
+ s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url))
bucket = url.netloc
if recursive:
# Because list_objects_v2 can only return up to 1000 items
@@ -391,7 +391,7 @@ def list_url(url, recursive=False):
if os.path.isfile(os.path.join(local_path, subpath))]
if url.scheme == 's3':
- s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url)) # noqa: E501
+ s3 = s3_util.create_s3_session(url, connection=s3_util.get_mirror_connection(url))
if recursive:
return list(_iter_s3_prefix(s3, url))