Browse Source

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
changes/93/638093/6
Doug Wiegley 3 years ago
committed by Slawek Kaplonski
parent
commit
7e208c3014
  1. 9
      .pylintrc
  2. 4
      lower-constraints.txt
  3. 2
      neutron/agent/l3/dvr_local_router.py
  4. 2
      neutron/agent/l3/router_info.py
  5. 2
      neutron/db/db_base_plugin_v2.py
  6. 2
      neutron/extensions/quotasv2_detail.py
  7. 32
      neutron/objects/rbac_db.py
  8. 6
      test-requirements.txt

9
.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

4
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

2
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):

2
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']:

2
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:

2
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

32
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)

6
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
Loading…
Cancel
Save