Browse Source

Fix new pylint errors

Pylint 2.6.0 added two new checkers [1] that make pep8 validation to
fail:

- raise-missing-from (W0707)
- super-with-arguments (R1725)

[1] http://pylint.pycqa.org/en/latest/technical_reference/features.html

Change-Id: I50e798178a546132fba608ec4350d19a24986326
changes/84/748284/2
Carlos Goncalves 11 months ago
parent
commit
b38f83120c
  1. 6
      octavia_lib/api/drivers/driver_lib.py
  2. 24
      octavia_lib/api/drivers/exceptions.py
  3. 2
      octavia_lib/tests/unit/api/drivers/test_data_models.py
  4. 2
      octavia_lib/tests/unit/api/drivers/test_driver_lib.py
  5. 2
      octavia_lib/tests/unit/api/drivers/test_exceptions.py
  6. 2
      octavia_lib/tests/unit/api/drivers/test_provider_base.py
  7. 2
      octavia_lib/tests/unit/base.py

6
octavia_lib/api/drivers/driver_lib.py

@ -54,7 +54,7 @@ class DriverLibrary():
self._check_for_socket_ready(stats_socket)
self._check_for_socket_ready(get_socket)
super(DriverLibrary, self).__init__(**kwargs)
super().__init__(**kwargs)
def _recv(self, sock):
size_str = b''
@ -158,8 +158,8 @@ class DriverLibrary():
constants.ID: id})
except driver_exceptions.DriverAgentTimeout:
raise
except Exception:
raise driver_exceptions.DriverError()
except Exception as e:
raise driver_exceptions.DriverError() from e
def get_loadbalancer(self, loadbalancer_id):
"""Get a load balancer object.

24
octavia_lib/api/drivers/exceptions.py

@ -38,8 +38,7 @@ class DriverError(Exception):
self.user_fault_string)
self.operator_fault_string = kwargs.pop('operator_fault_string',
self.operator_fault_string)
super(DriverError, self).__init__(self.user_fault_string,
*args, **kwargs)
super().__init__(self.user_fault_string, *args, **kwargs)
class NotImplementedError(Exception):
@ -60,8 +59,7 @@ class NotImplementedError(Exception):
self.user_fault_string)
self.operator_fault_string = kwargs.pop('operator_fault_string',
self.operator_fault_string)
super(NotImplementedError, self).__init__(self.user_fault_string,
*args, **kwargs)
super().__init__(self.user_fault_string, *args, **kwargs)
class UnsupportedOptionError(Exception):
@ -90,8 +88,7 @@ class UnsupportedOptionError(Exception):
self.user_fault_string)
self.operator_fault_string = kwargs.pop('operator_fault_string',
self.operator_fault_string)
super(UnsupportedOptionError, self).__init__(self.user_fault_string,
*args, **kwargs)
super().__init__(self.user_fault_string, *args, **kwargs)
class UpdateStatusError(Exception):
@ -119,8 +116,7 @@ class UpdateStatusError(Exception):
self.status_object_id = kwargs.pop('status_object_id', None)
self.status_record = kwargs.pop('status_record', None)
super(UpdateStatusError, self).__init__(self.fault_string,
*args, **kwargs)
super().__init__(self.fault_string, *args, **kwargs)
class UpdateStatisticsError(Exception):
@ -149,8 +145,7 @@ class UpdateStatisticsError(Exception):
self.stats_object_id = kwargs.pop('stats_object_id', None)
self.stats_record = kwargs.pop('stats_record', None)
super(UpdateStatisticsError, self).__init__(self.fault_string,
*args, **kwargs)
super().__init__(self.fault_string, *args, **kwargs)
class DriverAgentNotFound(Exception):
@ -165,8 +160,7 @@ class DriverAgentNotFound(Exception):
def __init__(self, *args, **kwargs):
self.fault_string = kwargs.pop('fault_string', self.fault_string)
super(DriverAgentNotFound, self).__init__(self.fault_string,
*args, **kwargs)
super().__init__(self.fault_string, *args, **kwargs)
class DriverAgentTimeout(Exception):
@ -182,8 +176,7 @@ class DriverAgentTimeout(Exception):
def __init__(self, *args, **kwargs):
self.fault_string = kwargs.pop('fault_string', self.fault_string)
super(DriverAgentTimeout, self).__init__(self.fault_string,
*args, **kwargs)
super().__init__(self.fault_string, *args, **kwargs)
class NotFound(Exception):
@ -209,5 +202,4 @@ class NotFound(Exception):
self.user_fault_string)
self.operator_fault_string = kwargs.pop('operator_fault_string',
self.operator_fault_string)
super(NotFound, self).__init__(self.user_fault_string,
*args, **kwargs)
super().__init__(self.user_fault_string, *args, **kwargs)

2
octavia_lib/tests/unit/api/drivers/test_data_models.py

@ -24,7 +24,7 @@ from octavia_lib.tests.unit import base
class TestProviderDataModels(base.TestCase):
def setUp(self):
super(TestProviderDataModels, self).setUp()
super().setUp()
self.loadbalancer_id = uuidutils.generate_uuid()
self.project_id = uuidutils.generate_uuid()

2
octavia_lib/tests/unit/api/drivers/test_driver_lib.py

@ -26,7 +26,7 @@ class TestDriverLib(base.TestCase):
def setUp(self, mock_check_ready):
self.driver_lib = driver_lib.DriverLibrary()
super(TestDriverLib, self).setUp()
super().setUp()
@mock.patch('octavia_lib.api.drivers.driver_lib.DriverLibrary.'
'_check_for_socket_ready.retry.sleep')

2
octavia_lib/tests/unit/api/drivers/test_exceptions.py

@ -19,7 +19,7 @@ from octavia_lib.tests.unit import base
class TestProviderExceptions(base.TestCase):
def setUp(self):
super(TestProviderExceptions, self).setUp()
super().setUp()
self.user_fault_string = 'Bad driver'
self.operator_fault_string = 'Fix bad driver.'
self.fault_object = 'MCP'

2
octavia_lib/tests/unit/api/drivers/test_provider_base.py

@ -24,7 +24,7 @@ class TestProviderBase(base.TestCase):
NotImplementedError.
"""
def setUp(self):
super(TestProviderBase, self).setUp()
super().setUp()
self.driver = driver_base.ProviderDriver()
def test_create_vip_port(self):

2
octavia_lib/tests/unit/base.py

@ -23,5 +23,5 @@ class TestCase(base.BaseTestCase):
"""Test case base class for all unit tests."""
def setUp(self):
super(TestCase, self).setUp()
super().setUp()
self.addCleanup(mock.patch.stopall)
Loading…
Cancel
Save