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
This commit is contained in:
Akihiro Motoki 2018-12-02 06:38:37 +09:00
parent c9536342c2
commit 9578949638
4 changed files with 27 additions and 27 deletions

View File

@ -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

View File

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

View File

@ -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

View File

@ -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 '