Update to pylint 2.6.0+
Pylint 2.6.0 added two new checkers [1] that made pep8 validation fail: - raise-missing-from (W0707) - super-with-arguments (R1725) Pylint 2.7.0 added one new checker [1] that made pep8 validation fail: - use-a-generator (R1729) [1] http://pylint.pycqa.org/en/latest/technical_reference/features.html Change-Id: I40a45e70156f4306021ade0029b244f4c06440a2
This commit is contained in:
parent
b882a7f69d
commit
ffc3160984
|
@ -28,7 +28,7 @@ CONF = cfg.CONF
|
|||
NEUTRON_VERSION = '2.0'
|
||||
|
||||
|
||||
class KeystoneSession(object):
|
||||
class KeystoneSession():
|
||||
|
||||
def __init__(self, section=constants.SERVICE_AUTH):
|
||||
self._session = None
|
||||
|
|
|
@ -45,7 +45,7 @@ ovn_conf.register_opts()
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OvnProviderHelper(object):
|
||||
class OvnProviderHelper():
|
||||
|
||||
def __init__(self):
|
||||
self.requests = queue.Queue()
|
||||
|
@ -85,8 +85,8 @@ class OvnProviderHelper(object):
|
|||
@staticmethod
|
||||
def _is_lb_empty(external_ids):
|
||||
"""Check if there is no pool or listener defined."""
|
||||
return not any([k.startswith('listener') or k.startswith('pool')
|
||||
for k in external_ids])
|
||||
return not any(k.startswith('listener') or k.startswith('pool')
|
||||
for k in external_ids)
|
||||
|
||||
@staticmethod
|
||||
def _delete_disabled_from_status(status):
|
||||
|
|
|
@ -38,7 +38,7 @@ class OvnNbTransaction(idl_trans.Transaction):
|
|||
# NOTE(lucasagomes): The bump_nb_cfg parameter is only used by
|
||||
# the agents health status check
|
||||
self.bump_nb_cfg = kwargs.pop('bump_nb_cfg', False)
|
||||
super(OvnNbTransaction, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def pre_commit(self, txn):
|
||||
if not self.bump_nb_cfg:
|
||||
|
@ -54,7 +54,7 @@ class Backend(ovs_idl.Backend):
|
|||
|
||||
def __init__(self, connection):
|
||||
self.ovsdb_connection = connection
|
||||
super(Backend, self).__init__(connection)
|
||||
super().__init__(connection)
|
||||
|
||||
def start_connection(self, connection):
|
||||
try:
|
||||
|
@ -63,7 +63,7 @@ class Backend(ovs_idl.Backend):
|
|||
connection_exception = OvsdbConnectionUnavailable(
|
||||
db_schema=self.schema, error=e)
|
||||
LOG.exception(connection_exception)
|
||||
raise connection_exception
|
||||
raise connection_exception from e
|
||||
|
||||
@property
|
||||
def idl(self):
|
||||
|
@ -100,10 +100,10 @@ class Backend(ovs_idl.Backend):
|
|||
def check_for_row_by_value_and_retry(self, table, column, match):
|
||||
try:
|
||||
idlutils.row_by_value(self.idl, table, column, match)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
msg = (_("%(match)s does not exist in %(column)s of %(table)s")
|
||||
% {'match': match, 'column': column, 'table': table})
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
|
||||
class OvsdbConnectionUnavailable(n_exc.ServiceUnavailable):
|
||||
|
@ -115,7 +115,7 @@ class OvsdbConnectionUnavailable(n_exc.ServiceUnavailable):
|
|||
|
||||
class OvsdbNbOvnIdl(nb_impl_idl.OvnNbApiIdlImpl, Backend):
|
||||
def __init__(self, connection):
|
||||
super(OvsdbNbOvnIdl, self).__init__(connection)
|
||||
super().__init__(connection)
|
||||
self.idl._session.reconnect.set_probe_interval(
|
||||
config.get_ovn_ovsdb_probe_interval())
|
||||
|
||||
|
@ -137,7 +137,7 @@ class OvsdbNbOvnIdl(nb_impl_idl.OvnNbApiIdlImpl, Backend):
|
|||
to handle revision conflicts correctly.
|
||||
"""
|
||||
try:
|
||||
with super(OvsdbNbOvnIdl, self).transaction(*args, **kwargs) as t:
|
||||
with super().transaction(*args, **kwargs) as t:
|
||||
yield t
|
||||
except ovn_exc.RevisionConflict as e:
|
||||
LOG.info('Transaction aborted. Reason: %s', e)
|
||||
|
@ -155,7 +155,7 @@ class OvnNbIdlForLb(ovsdb_monitor.OvnIdl):
|
|||
helper = self._get_ovsdb_helper(self.conn_string)
|
||||
for table in OvnNbIdlForLb.TABLES:
|
||||
helper.register_table(table)
|
||||
super(OvnNbIdlForLb, self).__init__(
|
||||
super().__init__(
|
||||
driver=None, remote=self.conn_string, schema=helper)
|
||||
self.event_lock_name = event_lock_name
|
||||
if self.event_lock_name:
|
||||
|
|
|
@ -39,7 +39,7 @@ class BaseOvnIdl(connection.OvsdbIdl):
|
|||
class OvnIdl(BaseOvnIdl):
|
||||
|
||||
def __init__(self, driver, remote, schema):
|
||||
super(OvnIdl, self).__init__(remote, schema)
|
||||
super().__init__(remote, schema)
|
||||
self.driver = driver
|
||||
self.notify_handler = OvnDbNotifyHandler(driver)
|
||||
# ovsdb lock name to acquire.
|
||||
|
@ -75,7 +75,7 @@ class OvnIdl(BaseOvnIdl):
|
|||
|
||||
class OvnDbNotifyHandler(event.RowEventHandler):
|
||||
def __init__(self, driver):
|
||||
super(OvnDbNotifyHandler, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = driver
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class TestOvnOctaviaBase(base.TestOVNFunctionalBase,
|
|||
base.BaseLoggingTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnOctaviaBase, self).setUp()
|
||||
super().setUp()
|
||||
idl_ovn.OvnNbApiIdlImpl.ovsdb_connection = None
|
||||
# TODO(mjozefcz): Use octavia listeners to provide needed
|
||||
# sockets and modify tests in order to verify if fake
|
||||
|
|
|
@ -29,7 +29,7 @@ from ovn_octavia_provider.tests.functional import base as ovn_base
|
|||
class TestOvnOctaviaProviderAgent(ovn_base.TestOvnOctaviaBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnOctaviaProviderAgent, self).setUp()
|
||||
super().setUp()
|
||||
self._initialize_ovn_da()
|
||||
|
||||
def _initialize_ovn_da(self):
|
||||
|
|
|
@ -29,7 +29,7 @@ LOG = logging.getLogger(__name__)
|
|||
class TestOvnOctaviaProviderIntegration(ovn_base.TestOvnOctaviaBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnOctaviaProviderIntegration, self).setUp()
|
||||
super().setUp()
|
||||
# Add port_forwarding as a configured service plugin (if needed)
|
||||
svc_plugins = set(cfg.CONF.service_plugins)
|
||||
svc_plugins.add("port_forwarding")
|
||||
|
|
|
@ -21,7 +21,7 @@ from oslo_utils import uuidutils
|
|||
class TestOvnOctaviaBase(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnOctaviaBase, self).setUp()
|
||||
super().setUp()
|
||||
self.listener_id = uuidutils.generate_uuid()
|
||||
self.loadbalancer_id = uuidutils.generate_uuid()
|
||||
self.pool_id = uuidutils.generate_uuid()
|
||||
|
|
|
@ -50,7 +50,7 @@ class TestKeystoneSession(base.BaseTestCase):
|
|||
|
||||
class TestNeutronAuth(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestNeutronAuth, self).setUp()
|
||||
super().setUp()
|
||||
self.mock_client = mock.patch(
|
||||
'neutronclient.neutron.client.Client').start()
|
||||
self.client_args = {
|
||||
|
|
|
@ -37,7 +37,7 @@ class FakeResource(dict):
|
|||
A dictionary with all methods
|
||||
"""
|
||||
info = info or {}
|
||||
super(FakeResource, self).__init__(info)
|
||||
super().__init__(info)
|
||||
methods = methods or {}
|
||||
|
||||
self.__name__ = type(self).__name__
|
||||
|
@ -82,7 +82,7 @@ class FakeResource(dict):
|
|||
return self._info
|
||||
|
||||
def update(self, info):
|
||||
super(FakeResource, self).update(info)
|
||||
super().update(info)
|
||||
self._add_details(info)
|
||||
|
||||
|
||||
|
@ -129,7 +129,7 @@ class FakeOvsdbRow(FakeResource):
|
|||
methods=copy.deepcopy(ovsdb_row_methods))
|
||||
|
||||
|
||||
class FakeSubnet(object):
|
||||
class FakeSubnet():
|
||||
"""Fake one or more subnets."""
|
||||
|
||||
@staticmethod
|
||||
|
@ -169,7 +169,7 @@ class FakeSubnet(object):
|
|||
loaded=True)
|
||||
|
||||
|
||||
class FakeOVNPort(object):
|
||||
class FakeOVNPort():
|
||||
"""Fake one or more ports."""
|
||||
|
||||
@staticmethod
|
||||
|
@ -225,7 +225,7 @@ class FakeOVNPort(object):
|
|||
'port_security': port_security})
|
||||
|
||||
|
||||
class FakeOVNRouter(object):
|
||||
class FakeOVNRouter():
|
||||
|
||||
@staticmethod
|
||||
def create_one_router(attrs=None):
|
||||
|
@ -245,7 +245,7 @@ class FakeOVNRouter(object):
|
|||
return type('Logical_Router', (object, ), router_attrs)
|
||||
|
||||
|
||||
class FakePort(object):
|
||||
class FakePort():
|
||||
"""Fake one or more ports."""
|
||||
|
||||
@staticmethod
|
||||
|
@ -297,7 +297,7 @@ class FakeLB(data_models.LoadBalancer):
|
|||
def __init__(self, *args, **kwargs):
|
||||
self.external_ids = kwargs.pop('ext_ids')
|
||||
self.uuid = kwargs.pop('uuid')
|
||||
super(FakeLB, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __hash__(self):
|
||||
# Required for Python3, not for Python2
|
||||
|
|
|
@ -31,7 +31,7 @@ schema_files = {
|
|||
class TestOvnNbIdlForLb(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnNbIdlForLb, self).setUp()
|
||||
super().setUp()
|
||||
# TODO(haleyb) - figure out why every test in this class generates
|
||||
# this warning, think it's in relation to reading this schema file:
|
||||
# sys:1: ResourceWarning: unclosed file <_io.FileIO name=1 mode='wb'
|
||||
|
|
|
@ -28,7 +28,7 @@ from ovn_octavia_provider.tests.unit import base as ovn_base
|
|||
class TestOvnProviderDriver(ovn_base.TestOvnOctaviaBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnProviderDriver, self).setUp()
|
||||
super().setUp()
|
||||
self.driver = ovn_driver.OvnProviderDriver()
|
||||
add_req_thread = mock.patch.object(ovn_helper.OvnProviderHelper,
|
||||
'add_request')
|
||||
|
|
|
@ -31,7 +31,7 @@ from ovn_octavia_provider.tests.unit import fakes
|
|||
class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvnProviderHelper, self).setUp()
|
||||
super().setUp()
|
||||
self.helper = ovn_helper.OvnProviderHelper()
|
||||
self.real_helper_find_ovn_lb_with_pool_key = (
|
||||
self.helper._find_ovn_lb_with_pool_key)
|
||||
|
|
|
@ -10,9 +10,7 @@ flake8-import-order==0.12 # LGPLv3
|
|||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
pylint>=2.5.3 # GPLv2
|
||||
isort==4.3.21 # MIT
|
||||
octavia-lib>=2.2.0 # Apache-2.0
|
||||
pylint>=2.6.0 # GPLv2
|
||||
testresources>=2.0.0 # Apache-2.0/BSD
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
WebTest>=2.0.27 # MIT
|
||||
|
|
Loading…
Reference in New Issue