From 6ce323307dea92da7e19018705e872c5b3edabed Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sat, 1 Dec 2018 22:44:52 +0900 Subject: [PATCH] pylint: fixes several errors openstack_dashboard/hooks.py:16:0: E0611: No name 'command' in module 'distutils' (no-name-in-module) openstack_dashboard/dashboards/project/networks/ports/sg_base.py:52:12: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return) BaseSecurityGroupsAction._get_initial_security_groups() is now marked as abstract method because this method must be implemented in subclasses. BaseSecurityGroupsAction.handle() is now dropped because there is no difference from the parent class (horizon.workflows.Action). openstack_auth/views.py:211:4: E1206: Not enough arguments for logging format string (logging-too-few-args) openstack_auth/views.py:269:8: E1206: Not enough arguments for logging format string (logging-too-few-args) openstack_auth/plugin/base.py:237:20: E1206: Not enough arguments for logging format string (logging-too-few-args) horizon/base.py:166:24: E1133: Non-iterable value self.policy_rules is used in an iterating context (not-an-iterable) horizon/tabs/base.py:489:40: E1133: Non-iterable value self.table_classes is used in an iterating context (not-an-iterable) Change-Id: I0b045d04af251854b5017c9f698e3b40503a0724 --- .pylintrc | 4 ---- horizon/base.py | 2 +- horizon/tabs/base.py | 2 +- openstack_auth/plugin/base.py | 2 +- openstack_auth/views.py | 4 ++-- .../dashboards/project/networks/ports/sg_base.py | 8 +++----- openstack_dashboard/hooks.py | 1 + 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.pylintrc b/.pylintrc index 41f986b43f..dfac7802d7 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,14 +10,10 @@ disable= # "I" Informational noise locally-disabled, # "E" Error for important programming issues (likely bugs) - assignment-from-no-return, import-error, - logging-too-few-args, method-hidden, misplaced-bare-raise, no-member, - no-name-in-module, - not-an-iterable, not-callable, raising-non-exception, redundant-keyword-arg, diff --git a/horizon/base.py b/horizon/base.py index 8776f20ddf..1cf641a30f 100644 --- a/horizon/base.py +++ b/horizon/base.py @@ -107,7 +107,7 @@ class NotRegistered(Exception): @python_2_unicode_compatible class HorizonComponent(object): - policy_rules = None + policy_rules = tuple() def __init__(self): super(HorizonComponent, self).__init__() diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py index 821461f147..9fcf1ec147 100644 --- a/horizon/tabs/base.py +++ b/horizon/tabs/base.py @@ -475,7 +475,7 @@ class TableTab(Tab): need to define a corresponding ``get_{{ table_name }}_data`` method as with :class:`~horizon.tables.MultiTableView`. """ - table_classes = None + table_classes = [] def __init__(self, tab_group, request): super(TableTab, self).__init__(tab_group, request) diff --git a/openstack_auth/plugin/base.py b/openstack_auth/plugin/base.py index a161cf1cc3..634e3f18cc 100644 --- a/openstack_auth/plugin/base.py +++ b/openstack_auth/plugin/base.py @@ -236,6 +236,6 @@ class BasePlugin(object): if len(domains) > 1: LOG.info("More than one valid domain found for user %s," " scoping to %s", - (unscoped_auth_ref.user_id, domain_name)) + unscoped_auth_ref.user_id, domain_name) break return domain_auth, domain_auth_ref diff --git a/openstack_auth/views.py b/openstack_auth/views.py index 04e13043ce..14ac0dfca8 100644 --- a/openstack_auth/views.py +++ b/openstack_auth/views.py @@ -210,7 +210,7 @@ def logout(request, login_url=None, **kwargs): def switch(request, tenant_id, redirect_field_name=auth.REDIRECT_FIELD_NAME): """Switches an authenticated user from one project to another.""" LOG.debug('Switching to tenant %s for user "%s".', - (tenant_id, request.user.username)) + tenant_id, request.user.username) endpoint, __ = utils.fix_auth_url_version_prefix(request.user.endpoint) session = utils.get_session() @@ -268,7 +268,7 @@ def switch_region(request, region_name, if region_name in request.user.available_services_regions: request.session['services_region'] = region_name LOG.debug('Switching services region to %s for user "%s".', - (region_name, request.user.username)) + region_name, request.user.username) redirect_to = request.GET.get(redirect_field_name, '') if not is_safe_url(url=redirect_to, host=request.get_host()): diff --git a/openstack_dashboard/dashboards/project/networks/ports/sg_base.py b/openstack_dashboard/dashboards/project/networks/ports/sg_base.py index abebabca40..b35ff1e8a1 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/sg_base.py +++ b/openstack_dashboard/dashboards/project/networks/ports/sg_base.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import abc + from django.utils.translation import ugettext_lazy as _ from horizon import exceptions @@ -54,12 +56,8 @@ class BaseSecurityGroupsAction(workflows.MembershipAction): exceptions.handle(request, err_msg) self.fields[field_name].initial = sec_groups + @abc.abstractmethod def _get_initial_security_groups(self, context): - # This depends on each cases - pass - - def handle(self, request, data): - # This depends on each cases pass diff --git a/openstack_dashboard/hooks.py b/openstack_dashboard/hooks.py index a5edce834a..ea8911c47d 100644 --- a/openstack_dashboard/hooks.py +++ b/openstack_dashboard/hooks.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +# pylint: disable=no-name-in-module from distutils.command import install