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