From 95789496381f487b688dc46cda9f146f7d2e00da Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sun, 2 Dec 2018 06:38:37 +0900 Subject: [PATCH] pylint: fix too-many-nested-blocks/redefined-argument-from-local openstack_dashboard/dashboards/project/cgroups/workflows.py:313:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks) openstack_auth/plugin/base.py:221:12: R1704: Redefining argument with the local name 'domain_name' (redefined-argument-from-local) horizon/tables/formset.py:59:16: R1704: Redefining argument with the local name 'column' (redefined-argument-from-local) Change-Id: Ifeb192efac83c0b2d5399c51f66c8fb8f8969fc0 --- .pylintrc | 2 - horizon/tables/formset.py | 6 +-- openstack_auth/plugin/base.py | 8 ++-- .../dashboards/project/cgroups/workflows.py | 38 ++++++++++--------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.pylintrc b/.pylintrc index 4467968d55..2ee8a70a66 100644 --- a/.pylintrc +++ b/.pylintrc @@ -65,14 +65,12 @@ disable= interface-not-implemented, no-else-return, no-self-use, - redefined-argument-from-local, too-many-ancestors, too-many-arguments, too-many-branches, too-many-function-args, too-many-instance-attributes, too-many-locals, - too-many-nested-blocks, too-many-return-statements, too-many-statements, useless-object-inheritance diff --git a/horizon/tables/formset.py b/horizon/tables/formset.py index ea36db4283..ff62c1b767 100644 --- a/horizon/tables/formset.py +++ b/horizon/tables/formset.py @@ -56,9 +56,9 @@ class FormsetRow(horizon_tables.Row): # on this, because it sets self.cells to [], but later expects a # OrderedDict. We just fill self.cells with empty Cells. cells = [] - for column in self.table.columns.values(): - cell = self.table._meta.cell_class(None, column, self) - cells.append((column.name or column.auto, cell)) + for col in self.table.columns.values(): + cell = self.table._meta.cell_class(None, col, self) + cells.append((col.name or col.auto, cell)) self.cells = collections.OrderedDict(cells) def render(self): diff --git a/openstack_auth/plugin/base.py b/openstack_auth/plugin/base.py index acbc8df5d5..83d9f3aa38 100644 --- a/openstack_auth/plugin/base.py +++ b/openstack_auth/plugin/base.py @@ -218,22 +218,22 @@ class BasePlugin(object): # for keystone. domain_auth = None domain_auth_ref = None - for domain_name in domains: + for _name in domains: token = unscoped_auth_ref.auth_token domain_auth = utils.get_token_auth_plugin( auth_url, token, - domain_name=domain_name) + domain_name=_name) try: domain_auth_ref = domain_auth.get_access(session) except (keystone_exceptions.ClientException, keystone_exceptions.AuthorizationFailure): LOG.info('Attempted scope to domain %s failed, will attempt ' - 'to scope to another domain.', domain_name) + 'to scope to another domain.', _name) else: 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, _name) break return domain_auth, domain_auth_ref diff --git a/openstack_dashboard/dashboards/project/cgroups/workflows.py b/openstack_dashboard/dashboards/project/cgroups/workflows.py index 8658ccf18d..e912171fd9 100644 --- a/openstack_dashboard/dashboards/project/cgroups/workflows.py +++ b/openstack_dashboard/dashboards/project/cgroups/workflows.py @@ -311,24 +311,26 @@ class CreateCGroupWorkflow(workflows.Workflow): backend_name = None invalid_backend = False for selected_vol_type in selected_vol_types: - if not invalid_backend: - for vol_type in vol_types: - if selected_vol_type == vol_type.id: - if (hasattr(vol_type, "extra_specs") and - 'volume_backend_name' in vol_type.extra_specs): - vol_type_backend = \ - vol_type.extra_specs['volume_backend_name'] - if vol_type_backend is None: - invalid_backend = True - break - if backend_name is None: - backend_name = vol_type_backend - if vol_type_backend != backend_name: - invalid_backend = True - break - else: - invalid_backend = True - break + if invalid_backend: + continue + for vol_type in vol_types: + if selected_vol_type != vol_type.id: + continue + if (hasattr(vol_type, "extra_specs") and + 'volume_backend_name' in vol_type.extra_specs): + vol_type_backend = \ + vol_type.extra_specs['volume_backend_name'] + if vol_type_backend is None: + invalid_backend = True + break + if backend_name is None: + backend_name = vol_type_backend + if vol_type_backend != backend_name: + invalid_backend = True + break + else: + invalid_backend = True + break if invalid_backend: msg = _('All selected volume types must be associated '