Python 3: use dict.values instead of dict.itervalues

This works with both Python 2 and 3, and should not have any performance
impact.

Change-Id: I2a14945c60de513b91c6f022ff5dcc503ce2a8ad
Blueprint: neutron-python3
This commit is contained in:
Cyril Roelandt 2015-06-15 15:07:28 +00:00
parent b1ad6101ca
commit a8619e9bd1
7 changed files with 9 additions and 9 deletions

View File

@ -411,7 +411,7 @@ class ExtensionManager(object):
resources = []
resources.append(ResourceExtension('extensions',
ExtensionController(self)))
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
resources.extend(ext.get_resources())
except AttributeError:
@ -423,7 +423,7 @@ class ExtensionManager(object):
def get_actions(self):
"""Returns a list of ActionExtension objects."""
actions = []
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
actions.extend(ext.get_actions())
except AttributeError:
@ -435,7 +435,7 @@ class ExtensionManager(object):
def get_request_extensions(self):
"""Returns a list of RequestExtension objects."""
request_exts = []
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
request_exts.extend(ext.get_request_extensions())
except AttributeError:

View File

@ -210,7 +210,7 @@ def parse_mappings(mapping_list, unique_values=True):
if key in mappings:
raise ValueError(_("Key %(key)s in mapping: '%(mapping)s' not "
"unique") % {'key': key, 'mapping': mapping})
if unique_values and value in mappings.itervalues():
if unique_values and value in mappings.values():
raise ValueError(_("Value %(value)s in mapping: '%(mapping)s' "
"not unique") % {'value': value,
'mapping': mapping})

View File

@ -436,7 +436,7 @@ class LinuxBridgeManager(object):
self.delete_vxlan(interface)
continue
for physical_interface in self.interface_mappings.itervalues():
for physical_interface in self.interface_mappings.values():
if (interface.startswith(physical_interface)):
ips, gateway = self.get_interface_details(bridge_name)
if ips:

View File

@ -146,7 +146,7 @@ class VlanTypeDriver(helpers.SegmentTypeDriver):
# remove from table unallocated vlans for any unconfigured
# physical networks
for allocs in allocations.itervalues():
for allocs in allocations.values():
for alloc in allocs:
if not alloc.allocated:
LOG.debug("Removing vlan %(vlan_id)s on physical "

View File

@ -130,7 +130,7 @@ class EmbSwitch(object):
"""
vf_list = []
assigned_macs = []
for vf_index in self.pci_slot_map.itervalues():
for vf_index in self.pci_slot_map.values():
if not PciOsWrapper.is_assigned_vf(self.dev_name, vf_index):
continue
vf_list.append(vf_index)

View File

@ -308,7 +308,7 @@ class SriovNicAgentConfigParser(object):
Validate that network_device in excluded_device
exists in device mappings
"""
dev_net_set = set(self.device_mappings.itervalues())
dev_net_set = set(self.device_mappings.values())
for dev_name in self.exclude_devices.iterkeys():
if dev_name not in dev_net_set:
raise ValueError(_("Device name %(dev_name)s is missing from "

View File

@ -369,7 +369,7 @@ class IsolatedCreds(cred_provider.CredentialProvider):
if not self.isolated_creds:
return
self._clear_isolated_net_resources()
for creds in self.isolated_creds.itervalues():
for creds in self.isolated_creds.values():
try:
self._delete_user(creds.user_id)
except lib_exc.NotFound: