From a2220f31500f93cda3eabbafae0626b18b1c097a Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 7 Sep 2019 19:27:51 -0700 Subject: flake8: make entire repository pass `spack flake8 -a` - Fix trailing whitespace missed by the bug described in #12755. - Fix other style issues that have crept in over time (this can happen when flake8 adds new checks with new versions) --- lib/spack/spack/build_systems/python.py | 2 +- lib/spack/spack/cmd/upload_s3.py | 2 +- lib/spack/spack/main.py | 4 +-- lib/spack/spack/schema/env.py | 61 +++++++++++++++++---------------- lib/spack/spack/schema/spec_set.py | 5 +-- lib/spack/spack/test/config.py | 2 +- lib/spack/spack/test/pattern.py | 13 ++++--- lib/spack/spack/test/variant.py | 2 +- 8 files changed, 46 insertions(+), 45 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index 91718f0cae..6dee28e4ed 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -231,7 +231,7 @@ class PythonPackage(PackageBase): if ('py-setuptools' == spec.name or # this is setuptools, or 'py-setuptools' in spec._dependencies and # it's an immediate dep 'build' in spec._dependencies['py-setuptools'].deptypes): - args += ['--single-version-externally-managed', '--root=/'] + args += ['--single-version-externally-managed', '--root=/'] return args diff --git a/lib/spack/spack/cmd/upload_s3.py b/lib/spack/spack/cmd/upload_s3.py index 9894341efe..9013d612f8 100644 --- a/lib/spack/spack/cmd/upload_s3.py +++ b/lib/spack/spack/cmd/upload_s3.py @@ -57,7 +57,7 @@ def setup_parser(subparser): index = subparsers.add_parser('index', help=update_index.__doc__) index.add_argument('-e', '--endpoint-url', - default='https://s3.spack.io', help='URL of mirror') + default='https://s3.spack.io', help='URL of mirror') index.set_defaults(func=update_index) diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index de47076fe6..69f430b5d5 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -247,8 +247,8 @@ class SpackArgumentParser(argparse.ArgumentParser): spack help --all list all commands and options spack help help on a specific command spack help --spec help on the package specification syntax - spack docs open http://spack.rtfd.io/ in a browser""" -.format(help=section_descriptions['help'])) + spack docs open http://spack.rtfd.io/ in a browser +""".format(help=section_descriptions['help'])) # determine help from format above return formatter.format_help() diff --git a/lib/spack/spack/schema/env.py b/lib/spack/spack/schema/env.py index 5e5b9ed64f..2a3afb0aef 100644 --- a/lib/spack/spack/schema/env.py +++ b/lib/spack/spack/schema/env.py @@ -78,7 +78,7 @@ schema = { } }, 'patternProperties': { - r'^(?!when$)\w*': spec_list_schema + r'^(?!when$)\w*': spec_list_schema } } }, @@ -87,35 +87,36 @@ schema = { 'anyOf': [ {'type': 'boolean'}, {'type': 'string'}, - {'type': 'object', - 'patternProperties': { - r'\w+': { - 'required': ['root'], - 'additionalProperties': False, - 'properties': { - 'root': { - 'type': 'string' - }, - 'link': { - 'type': 'string', - 'pattern': '(roots|all)', - }, - 'select': { - 'type': 'array', - 'items': { - 'type': 'string' - } - }, - 'exclude': { - 'type': 'array', - 'items': { - 'type': 'string' - } - }, - 'projections': projections_scheme - } - } - } + { + 'type': 'object', + 'patternProperties': { + r'\w+': { + 'required': ['root'], + 'additionalProperties': False, + 'properties': { + 'root': { + 'type': 'string' + }, + 'link': { + 'type': 'string', + 'pattern': '(roots|all)', + }, + 'select': { + 'type': 'array', + 'items': { + 'type': 'string' + } + }, + 'exclude': { + 'type': 'array', + 'items': { + 'type': 'string' + } + }, + 'projections': projections_scheme + } + } + } } ] } diff --git a/lib/spack/spack/schema/spec_set.py b/lib/spack/spack/schema/spec_set.py index 70ba8de71f..94ff6eec20 100644 --- a/lib/spack/spack/schema/spec_set.py +++ b/lib/spack/spack/schema/spec_set.py @@ -83,8 +83,9 @@ schema = { 'cdash': { 'oneOf': [ {'type': 'string'}, - {'type': 'array', - 'items': {'type': 'string'} + { + 'type': 'array', + 'items': {'type': 'string'} }, ], }, diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index b89dbc5fe5..cf0de70856 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -616,7 +616,7 @@ def test_bad_command_line_scopes(tmpdir, mock_config): def test_add_command_line_scopes(tmpdir, mutable_config): config_yaml = str(tmpdir.join('config.yaml')) with open(config_yaml, 'w') as f: - f.write("""\ + f.write("""\ config: verify_ssl: False dirty: False diff --git a/lib/spack/spack/test/pattern.py b/lib/spack/spack/test/pattern.py index 406915bdf0..5481bfc0ea 100644 --- a/lib/spack/spack/test/pattern.py +++ b/lib/spack/spack/test/pattern.py @@ -27,15 +27,14 @@ def interface(): def implementation(interface): """Returns an implementation of the interface""" class Implementation(interface): + def __init__(self, value): + self.value = value - def __init__(self, value): - self.value = value - - def add(self): - interface.counter += self.value + def add(self): + interface.counter += self.value - def subtract(self): - interface.counter -= self.value + def subtract(self): + interface.counter -= self.value return Implementation diff --git a/lib/spack/spack/test/variant.py b/lib/spack/spack/test/variant.py index 2a937422d3..4a76b4824e 100644 --- a/lib/spack/spack/test/variant.py +++ b/lib/spack/spack/test/variant.py @@ -714,7 +714,7 @@ def test_disjoint_set_initialization(): # Test that no error is thrown when the sets are disjoint d = disjoint_sets(('a',), ('b', 'c'), ('e', 'f')) - assert d.default is 'none' + assert d.default == 'none' assert d.multi is True assert set(x for x in d) == set(['none', 'a', 'b', 'c', 'e', 'f']) -- cgit v1.2.3-60-g2f50