Merge "Get rid of keys() usage"
This commit is contained in:
commit
70f331228a
@ -147,7 +147,6 @@ disable=
|
||||
unidiomatic-typecheck,
|
||||
consider-using-enumerate,
|
||||
bad-whitespace,
|
||||
consider-iterating-dictionary,
|
||||
line-too-long,
|
||||
useless-super-delegation,
|
||||
pointless-string-statement,
|
||||
|
@ -484,7 +484,7 @@ class NestedDbQuotaDriver(DbQuotaDriver):
|
||||
ctxt, resources, cur_proj_id)
|
||||
|
||||
# Validate each resource when compared to it's child quotas
|
||||
for resource in cur_project_quotas.keys():
|
||||
for resource in cur_project_quotas:
|
||||
parent_quota = cur_project_quotas[resource]
|
||||
parent_limit = parent_quota['limit']
|
||||
parent_usage = (parent_quota['in_use'] +
|
||||
@ -619,7 +619,7 @@ class NestedDbQuotaDriver(DbQuotaDriver):
|
||||
context, resources, project_id)
|
||||
# All defaults are 0 for child project
|
||||
if quota_utils.get_parent_project_id(context, project_id):
|
||||
for key in defaults.keys():
|
||||
for key in defaults:
|
||||
defaults[key] = 0
|
||||
return defaults
|
||||
|
||||
|
@ -840,7 +840,7 @@ class HostManager(object):
|
||||
for old_pool in old_pools:
|
||||
oldpools[old_pool['pool_name']] = old_pool
|
||||
|
||||
for key in newpools.keys():
|
||||
for key in newpools:
|
||||
if key in oldpools.keys():
|
||||
for k in self.REQUIRED_KEYS:
|
||||
if newpools[key][k] != oldpools[key][k]:
|
||||
|
@ -347,7 +347,7 @@ class TestCase(testtools.TestCase):
|
||||
# Delete attributes that don't start with _ so they don't pin
|
||||
# memory around unnecessarily for the duration of the test
|
||||
# suite
|
||||
for key in [k for k in self.__dict__.keys() if k[0] != '_']:
|
||||
for key in [k for k in self.__dict__ if k[0] != '_']:
|
||||
del self.__dict__[key]
|
||||
|
||||
def override_config(self, name, override, group=None):
|
||||
|
@ -113,7 +113,7 @@ def check_exclusive_options(**kwargs):
|
||||
#
|
||||
# Ex: 'the_key' -> 'the key'
|
||||
if pretty_keys:
|
||||
names = [k.replace('_', ' ') for k in kwargs.keys()]
|
||||
names = [k.replace('_', ' ') for k in kwargs]
|
||||
else:
|
||||
names = kwargs.keys()
|
||||
names = ", ".join(sorted(names))
|
||||
|
@ -1723,7 +1723,7 @@ class SCApi(object):
|
||||
# Return the response in lowercase
|
||||
wwns_lower = [w.lower() for w in wwns]
|
||||
itmap_lower = dict()
|
||||
for key in itmap.keys():
|
||||
for key in itmap:
|
||||
itmap_lower[key.lower()] = [v.lower() for v in itmap[key]]
|
||||
|
||||
return lun, wwns_lower, itmap_lower
|
||||
|
@ -684,7 +684,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
|
||||
self.configuration.lun_write_cache_policy),
|
||||
'OWNINGCONTROLLER': lun_info['OWNINGCONTROLLER'], }
|
||||
|
||||
for item in lun_params.keys():
|
||||
for item in lun_params:
|
||||
if lun_params.get(item) == '--':
|
||||
del lun_params[item]
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ class XIVProxy(proxy.IBMStorageProxy):
|
||||
self.meta['stat']['rpo'] = repl.Replication.get_supported_rpo()
|
||||
self.meta['stat']['replication_count'] = len(self.targets)
|
||||
self.meta['stat']['replication_targets'] = [target for target in
|
||||
self.targets.keys()]
|
||||
self.targets]
|
||||
|
||||
self.meta['stat']['timestamp'] = datetime.datetime.utcnow()
|
||||
|
||||
|
@ -340,7 +340,7 @@ class NaElement(object):
|
||||
|
||||
def add_attrs(self, **attrs):
|
||||
"""Add multiple attributes to the element."""
|
||||
for attr in attrs.keys():
|
||||
for attr in attrs:
|
||||
self._element.set(attr, attrs.get(attr))
|
||||
|
||||
def add_child_elem(self, na_element):
|
||||
@ -405,7 +405,7 @@ class NaElement(object):
|
||||
def create_node_with_children(node, **children):
|
||||
"""Creates and returns named node with children."""
|
||||
parent = NaElement(node)
|
||||
for child in children.keys():
|
||||
for child in children:
|
||||
parent.add_new_child(child, children.get(child, None))
|
||||
return parent
|
||||
|
||||
|
@ -322,7 +322,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
|
||||
else:
|
||||
# Choose the best target group among existing ones
|
||||
tg_name = None
|
||||
for tg in self.volumes.keys():
|
||||
for tg in self.volumes:
|
||||
if len(self.volumes[tg]) < 20:
|
||||
tg_name = tg
|
||||
break
|
||||
|
@ -250,8 +250,8 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
|
||||
'target.')
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
|
||||
for keyFc in dc_fc.keys():
|
||||
for targetuuid in dc_target.keys():
|
||||
for keyFc in dc_fc:
|
||||
for targetuuid in dc_target:
|
||||
if dc_fc[keyFc]['hardware_address'] == \
|
||||
dc_target[targetuuid]['targetAddr']:
|
||||
preferTargets[targetuuid] = dc_target[targetuuid]
|
||||
@ -267,7 +267,7 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
|
||||
szwwpns.append(szwwpn)
|
||||
|
||||
if len(szwwpns):
|
||||
for targetUuid in preferTargets.keys():
|
||||
for targetUuid in preferTargets:
|
||||
targetWwpn = ''
|
||||
targetWwpn = preferTargets.get(targetUuid,
|
||||
{}).get('targetAddr', '')
|
||||
|
@ -592,7 +592,7 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
|
||||
|
||||
self._load_shares_config()
|
||||
|
||||
for share in self.shares.keys():
|
||||
for share in self.shares:
|
||||
try:
|
||||
self._ensure_share_mounted(share)
|
||||
self._mounted_shares.append(share)
|
||||
|
@ -317,7 +317,7 @@ class RemoteFSDriver(driver.BaseVD):
|
||||
self.driver_prefix +
|
||||
'_shares_config'))
|
||||
|
||||
for share in self.shares.keys():
|
||||
for share in self.shares:
|
||||
try:
|
||||
self._ensure_share_mounted(share)
|
||||
mounted_shares.append(share)
|
||||
|
@ -803,7 +803,7 @@ class TintriDriver(driver.ManageableVD,
|
||||
mounted_image_shares = []
|
||||
if self._image_shares_config:
|
||||
self._load_shares_config(self._image_shares_config)
|
||||
for share in self.shares.keys():
|
||||
for share in self.shares:
|
||||
try:
|
||||
self._ensure_share_mounted(share)
|
||||
mounted_image_shares.append(share)
|
||||
|
Loading…
Reference in New Issue
Block a user