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