summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Wiegley <doug@parkside.io>2019-02-19 23:47:33 -0700
committerSlawek Kaplonski <skaplons@redhat.com>2019-02-21 13:22:26 +0000
commit7e208c30140cfe06fa4f123589985e57c246223d (patch)
tree641e0904cec33c568f6341e3d9d215b0518c00b8
parentf74731d136975fb417b8144850d2b5cd8f89f8e0 (diff)
downloadneutron-7e208c30140cfe06fa4f123589985e57c246223d.tar.gz
Bump pylint version to one that supports python3.7
The listed revision no longer supports python2, but afaik, we are always running under python3 for those tests anyway. Change-Id: Iba94d73eeb65fb21f5d098afe0fbe4348dbea850
-rw-r--r--.pylintrc9
-rw-r--r--lower-constraints.txt4
-rw-r--r--neutron/agent/l3/dvr_local_router.py2
-rw-r--r--neutron/agent/l3/router_info.py2
-rw-r--r--neutron/db/db_base_plugin_v2.py2
-rw-r--r--neutron/extensions/quotasv2_detail.py2
-rw-r--r--neutron/objects/rbac_db.py32
-rw-r--r--test-requirements.txt6
8 files changed, 36 insertions, 23 deletions
diff --git a/.pylintrc b/.pylintrc
index 0b730e1b0b..dd5c11f8d4 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -85,7 +85,14 @@ disable=
too-many-nested-blocks,
too-many-public-methods,
too-many-return-statements,
- too-many-statements
+ too-many-statements,
+# new for python3 version of pylint
+ chained-comparison,
+ consider-using-dict-comprehension,
+ consider-using-in,
+ consider-using-set-comprehension,
+ unnecessary-pass,
+ useless-object-inheritance
[BASIC]
# Variable names can be 1 to 31 characters long, with lowercase and underscores
diff --git a/lower-constraints.txt b/lower-constraints.txt
index e8eb693b96..345e2d2ef8 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -2,7 +2,7 @@ alabaster==0.7.10
alembic==0.8.10
amqp==2.1.1
appdirs==1.3.0
-astroid==1.6.5
+astroid==2.1.0
Babel==2.3.4
bandit==1.1.0
bashate==0.5.1
@@ -103,7 +103,7 @@ pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
-pylint==1.9.2
+pylint==2.2.0
PyMySQL==0.7.6
pyparsing==2.1.0
pyperclip==1.5.27
diff --git a/neutron/agent/l3/dvr_local_router.py b/neutron/agent/l3/dvr_local_router.py
index d900069767..8010ecdcdb 100644
--- a/neutron/agent/l3/dvr_local_router.py
+++ b/neutron/agent/l3/dvr_local_router.py
@@ -108,6 +108,8 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
def floating_ip_added_dist(self, fip, fip_cidr):
"""Add floating IP to respective namespace based on agent mode."""
if fip.get(lib_constants.DVR_SNAT_BOUND):
+ # TODO(dougwig) - remove this disable when fixing bug #1816874
+ # pylint: disable=assignment-from-no-return
floating_ip_status = self.add_centralized_floatingip(fip, fip_cidr)
return floating_ip_status
if not self._check_if_floatingip_bound_to_host(fip):
diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py
index 3de59b19da..05a241c1cb 100644
--- a/neutron/agent/l3/router_info.py
+++ b/neutron/agent/l3/router_info.py
@@ -377,6 +377,8 @@ class RouterInfo(object):
fip.get('host') == self.host):
LOG.debug("Floating IP is migrating from centralized "
"to distributed: %s", fip)
+ # TODO(dougwig) - remove this disable when fixing bug #1816874
+ # pylint: disable=assignment-from-no-return
fip_statuses[fip['id']] = self.migrate_centralized_floating_ip(
fip, interface_name, device)
elif fip_statuses[fip['id']] == fip['status']:
diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py
index 0ca6ca7d9c..1d2b4b80be 100644
--- a/neutron/db/db_base_plugin_v2.py
+++ b/neutron/db/db_base_plugin_v2.py
@@ -417,7 +417,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
item.target_tenant == '*'):
entry = item
break
- setattr(network, 'shared', True if entry else False)
+ setattr(network, 'shared', bool(entry))
self._validate_shared_update(context, id, network, n)
update_shared = n.pop('shared')
if update_shared and not entry:
diff --git a/neutron/extensions/quotasv2_detail.py b/neutron/extensions/quotasv2_detail.py
index e724fbe396..e69a75c076 100644
--- a/neutron/extensions/quotasv2_detail.py
+++ b/neutron/extensions/quotasv2_detail.py
@@ -61,7 +61,7 @@ class Quotasv2_detail(api_extensions.ExtensionDescriptor):
# Ensure new extension is not loaded with old conf driver.
extensions.register_custom_supported_check(
- ALIAS, lambda: True if QUOTA_DRIVER == DB_QUOTA_DRIVER else False,
+ ALIAS, lambda: QUOTA_DRIVER == DB_QUOTA_DRIVER,
plugin_agnostic=True)
@classmethod
diff --git a/neutron/objects/rbac_db.py b/neutron/objects/rbac_db.py
index 15ed0ea594..bfd4d9eb11 100644
--- a/neutron/objects/rbac_db.py
+++ b/neutron/objects/rbac_db.py
@@ -272,21 +272,21 @@ class RbacNeutronMetaclass(type):
"""
@classmethod
- def _get_attribute(mcs, attribute_name, bases):
+ def _get_attribute(cls, attribute_name, bases):
for b in bases:
attribute = getattr(b, attribute_name, None)
if attribute:
return attribute
@classmethod
- def get_attribute(mcs, attribute_name, bases, dct):
+ def get_attribute(cls, attribute_name, bases, dct):
return (dct.get(attribute_name, None) or
- mcs._get_attribute(attribute_name, bases))
+ cls._get_attribute(attribute_name, bases))
@classmethod
- def update_synthetic_fields(mcs, bases, dct):
+ def update_synthetic_fields(cls, bases, dct):
if not dct.get('synthetic_fields', None):
- synthetic_attr = mcs.get_attribute('synthetic_fields', bases, dct)
+ synthetic_attr = cls.get_attribute('synthetic_fields', bases, dct)
dct['synthetic_fields'] = synthetic_attr or []
if 'shared' in dct['synthetic_fields']:
raise exceptions.ObjectActionError(
@@ -315,25 +315,25 @@ class RbacNeutronMetaclass(type):
return func
@classmethod
- def replace_class_methods_with_hooks(mcs, bases, dct):
+ def replace_class_methods_with_hooks(cls, bases, dct):
methods_replacement_map = {'create': _create_hook,
'update': _update_hook,
'to_dict': _to_dict_hook}
for orig_method_name, new_method in methods_replacement_map.items():
- orig_method = mcs.get_attribute(orig_method_name, bases, dct)
- hook_method = mcs.get_replaced_method(orig_method,
+ orig_method = cls.get_attribute(orig_method_name, bases, dct)
+ hook_method = cls.get_replaced_method(orig_method,
new_method)
dct[orig_method_name] = hook_method
- def __new__(mcs, name, bases, dct):
- mcs.validate_existing_attrs(name, dct)
- mcs.update_synthetic_fields(bases, dct)
- mcs.replace_class_methods_with_hooks(bases, dct)
- cls = type(name, (RbacNeutronDbObjectMixin,) + bases, dct)
- cls.add_extra_filter_name('shared')
- mcs.subscribe_to_rbac_events(cls)
+ def __new__(cls, name, bases, dct):
+ cls.validate_existing_attrs(name, dct)
+ cls.update_synthetic_fields(bases, dct)
+ cls.replace_class_methods_with_hooks(bases, dct)
+ klass = type(name, (RbacNeutronDbObjectMixin,) + bases, dct)
+ klass.add_extra_filter_name('shared')
+ cls.subscribe_to_rbac_events(klass)
- return cls
+ return klass
NeutronRbacObject = with_metaclass(RbacNeutronMetaclass, base.NeutronDbObject)
diff --git a/test-requirements.txt b/test-requirements.txt
index 4027fec533..c1f849f4c5 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -18,8 +18,10 @@ oslotest>=3.2.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
ddt>=1.0.1 # MIT
-astroid==1.6.5 # LGPLv2.1
-pylint==1.9.2 # GPLv2
+astroid==1.6.5;python_version<"3.0" # LGPLv2.1
+astroid==2.1.0;python_version>="3.0" # LGPLv2.1
+pylint==1.9.2;python_version<"3.0" # GPLv2
+pylint==2.2.0;python_version>="3.0" # GPLv2
# Needed to run DB commands in virtualenvs
PyMySQL>=0.7.6 # MIT License
bashate>=0.5.1 # Apache-2.0