From 0fd23ee5466d5dd0a69c918bc7a206e697a4eecc Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 13 May 2020 00:24:08 -0700 Subject: [PATCH] Fix pep8 job New flake8 came out with new & improved rules. Ignore E741; it would be too much churn. Fix the rest. Change-Id: I9125c8c53423232309a75cbcc5b695b378864c1b --- swift/cli/ringbuilder.py | 2 +- test/unit/common/ring/test_builder.py | 2 +- test/unit/common/test_db.py | 2 +- tox.ini | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/swift/cli/ringbuilder.py b/swift/cli/ringbuilder.py index b6985a9f68..5ee04e04a4 100644 --- a/swift/cli/ringbuilder.py +++ b/swift/cli/ringbuilder.py @@ -1658,7 +1658,7 @@ def main(arguments=None): print(msg) exit(EXIT_ERROR) except (exceptions.FileNotFoundError, exceptions.PermissionError) as e: - if len(argv) < 3 or argv[2] not in('create', 'write_builder'): + if len(argv) < 3 or argv[2] not in ('create', 'write_builder'): print(e) exit(EXIT_ERROR) except Exception as e: diff --git a/test/unit/common/ring/test_builder.py b/test/unit/common/ring/test_builder.py index cd69b68373..b9421b3043 100644 --- a/test/unit/common/ring/test_builder.py +++ b/test/unit/common/ring/test_builder.py @@ -2113,7 +2113,7 @@ class TestRingBuilder(unittest.TestCase): orig_rb = ring.RingBuilder(8, 3, 1) copy_rb = ring.RingBuilder(8, 3, 1) copy_rb.copy_from(orig_rb) - for rb in(orig_rb, copy_rb): + for rb in (orig_rb, copy_rb): with self.assertRaises(AttributeError) as cm: rb.id self.assertIn('id attribute has not been initialised', diff --git a/test/unit/common/test_db.py b/test/unit/common/test_db.py index ab9ed64a72..eac9f23944 100644 --- a/test/unit/common/test_db.py +++ b/test/unit/common/test_db.py @@ -1289,7 +1289,7 @@ class TestDatabaseBroker(unittest.TestCase): for c in range(MAX_META_COUNT): key = 'X-Account-Meta-F{0}'.format(c) metadata[key] = ('B', normalize_timestamp(1)) - key = 'X-Account-Meta-Foo'.format(c) + key = 'X-Account-Meta-Foo' metadata[key] = ('', normalize_timestamp(1)) self.assertIsNone(DatabaseBroker.validate_metadata(metadata)) diff --git a/tox.ini b/tox.ini index 21e044fb14..9d95fecb75 100644 --- a/tox.ini +++ b/tox.ini @@ -143,10 +143,11 @@ commands = bandit -c bandit.yaml -r swift -n 5 # changes to enable: # E402: module level import not at top of file # E731 do not assign a lambda expression, use a def +# E741 ambiguous variable name # Swift team needs to decide if they want to enable either of these: # W503: line break before binary operator # W504: line break after binary operator -ignore = H101,H202,H301,H306,H404,H405,H501,W503,W504,E402,E731 +ignore = H101,H202,H301,H306,H404,H405,H501,W503,W504,E402,E731,E741 exclude = .venv,.tox,dist,*egg filename = *.py,bin/* show-source = True