From d5b544add6ec97f5a1ba2b6b1127e8d64d4bac06 Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Thu, 19 Dec 2019 16:44:58 -0600 Subject: [PATCH] fixing new flask8 errors that show up out of nowhere --- SoftLayer/__init__.py | 2 +- SoftLayer/shell/core.py | 2 +- SoftLayer/testing/xmlrpc.py | 2 +- tests/CLI/helper_tests.py | 26 +++++++++++++------------- tests/managers/hardware_tests.py | 3 +-- tests/managers/vs/vs_capacity_tests.py | 1 - 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/SoftLayer/__init__.py b/SoftLayer/__init__.py index 04ba36aaa..9e14ea38e 100644 --- a/SoftLayer/__init__.py +++ b/SoftLayer/__init__.py @@ -29,7 +29,7 @@ __author__ = 'SoftLayer Technologies, Inc.' __license__ = 'MIT' __copyright__ = 'Copyright 2016 SoftLayer Technologies, Inc.' -__all__ = [ +__all__ = [ # noqa: F405 'BaseClient', 'create_client_from_env', 'Client', diff --git a/SoftLayer/shell/core.py b/SoftLayer/shell/core.py index 8946815e2..3762ed833 100644 --- a/SoftLayer/shell/core.py +++ b/SoftLayer/shell/core.py @@ -81,7 +81,7 @@ def cli(ctx, env): return except ShellExit: return - except Exception as ex: + except Exception: env.vars['last_exit_code'] = 1 traceback.print_exc(file=sys.stderr) diff --git a/SoftLayer/testing/xmlrpc.py b/SoftLayer/testing/xmlrpc.py index 1e3bf5f1d..208c1cb11 100644 --- a/SoftLayer/testing/xmlrpc.py +++ b/SoftLayer/testing/xmlrpc.py @@ -83,7 +83,7 @@ def do_POST(self): allow_none=True, methodresponse=True) self.wfile.write(response_body.encode('utf-8')) - except Exception as ex: + except Exception: self.send_response(500) logging.exception("Error while handling request") diff --git a/tests/CLI/helper_tests.py b/tests/CLI/helper_tests.py index 6da71c7d2..5c6656c21 100644 --- a/tests/CLI/helper_tests.py +++ b/tests/CLI/helper_tests.py @@ -154,29 +154,29 @@ def test_sort(self): class FormattedListTests(testing.TestCase): def test_init(self): - l = formatting.listing([1, 'two'], separator=':') - self.assertEqual([1, 'two'], list(l)) - self.assertEqual(':', l.separator) + listing = formatting.listing([1, 'two'], separator=':') + self.assertEqual([1, 'two'], list(listing)) + self.assertEqual(':', listing.separator) - l = formatting.listing([]) - self.assertEqual(',', l.separator) + listing = formatting.listing([]) + self.assertEqual(',', listing.separator) def test_to_python(self): - l = formatting.listing([1, 'two']) - result = l.to_python() + listing = formatting.listing([1, 'two']) + result = listing.to_python() self.assertEqual([1, 'two'], result) - l = formatting.listing(x for x in [1, 'two']) - result = l.to_python() + listing = formatting.listing(x for x in [1, 'two']) + result = listing.to_python() self.assertEqual([1, 'two'], result) def test_str(self): - l = formatting.listing([1, 'two']) - result = str(l) + listing = formatting.listing([1, 'two']) + result = str(listing) self.assertEqual('1,two', result) - l = formatting.listing((x for x in [1, 'two']), separator=':') - result = str(l) + listing = formatting.listing((x for x in [1, 'two']), separator=':') + result = str(listing) self.assertEqual('1:two', result) diff --git a/tests/managers/hardware_tests.py b/tests/managers/hardware_tests.py index fbbdb2218..5710dd0ae 100644 --- a/tests/managers/hardware_tests.py +++ b/tests/managers/hardware_tests.py @@ -281,8 +281,7 @@ def test_cancel_hardware(self): def test_cancel_hardware_no_billing_item(self): mock = self.set_mock('SoftLayer_Hardware_Server', 'getObject') - mock.return_value = {'id': 987, 'openCancellationTicket': {'id': 1234}, - 'openCancellationTicket': {'id': 1234}} + mock.return_value = {'id': 987, 'openCancellationTicket': {'id': 1234}} ex = self.assertRaises(SoftLayer.SoftLayerError, self.hardware.cancel_hardware, diff --git a/tests/managers/vs/vs_capacity_tests.py b/tests/managers/vs/vs_capacity_tests.py index 5229ebec4..bb7178055 100644 --- a/tests/managers/vs/vs_capacity_tests.py +++ b/tests/managers/vs/vs_capacity_tests.py @@ -132,7 +132,6 @@ def test_create_guest(self): 'maxMemory': None, 'hostname': 'A1538172419', 'domain': 'test.com', - 'localDiskFlag': None, 'hourlyBillingFlag': True, 'supplementalCreateObjectOptions': { 'bootMode': None,