]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Python 3: use dict.values instead of dict.itervalues
authorCyril Roelandt <cyril@redhat.com>
Mon, 15 Jun 2015 15:07:28 +0000 (15:07 +0000)
committerCyril Roelandt <cyril@redhat.com>
Mon, 15 Jun 2015 15:08:44 +0000 (17:08 +0200)
This works with both Python 2 and 3, and should not have any performance
impact.

Change-Id: I2a14945c60de513b91c6f022ff5dcc503ce2a8ad
Blueprint: neutron-python3

neutron/api/extensions.py
neutron/common/utils.py
neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py
neutron/plugins/ml2/drivers/type_vlan.py
neutron/plugins/sriovnicagent/eswitch_manager.py
neutron/plugins/sriovnicagent/sriov_nic_agent.py
neutron/tests/tempest/common/isolated_creds.py

index f6b4601ba2157a50d936c62c6973ab21bb8bea51..905d8ce81a9eff3a430ecab9690c69e30ded4939 100644 (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:
index 53308908b3068964a9422ff25009c585e85fd941..f4b286015a4de86b5116409ec1082c9aafc947d0 100644 (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})
index 2cf116619e2bfb81a106275db02971a72a90b2b1..aba3dee0bc074a4e10ab0496201f6b14ccda98f5 100644 (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:
index 451e80187ae8dbd481c81ccd8a5e93e3de2bb31b..a8280a460534d82d96ee0b082b017ebefeaf67af 100644 (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 "
index 760a0e52ca48f82f293719ce5864f3121c42e6d7..5d80576a7c05e3c6346f86065cc58e1d375037b5 100644 (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)
index 7bb92c063f98828bf93959e92c66e02651313e34..9e3a928f5e233051012570b3a01b7fe752efa44c 100644 (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 "
index b4de93b627136b73ac365e2cdd5a05e58c568293..5da24a922642b799d04edfc9fee38cd376d9b251 100644 (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: