]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Python 3: do not use itertools.izip
authorCyril Roelandt <cyril@redhat.com>
Tue, 23 Jun 2015 15:28:34 +0000 (15:28 +0000)
committerCyril Roelandt <cyril@redhat.com>
Tue, 23 Jun 2015 22:20:22 +0000 (00:20 +0200)
This no longer exists in Python 3. Use the zip function instead.

Blueprint: neutron-python3
Change-Id: Id7d33ec3d27a27f17040d28bead10f2eb3b831bb

neutron/scheduler/l3_agent_scheduler.py
neutron/tests/unit/extensions/test_external_net.py

index e23501d4ff88c4b83a0307e1cff1cf167567d5c0..4d20ba7b888ab294c857a7e2a765ba3dadc5a96b 100644 (file)
@@ -14,7 +14,6 @@
 #    under the License.
 
 import abc
-import itertools
 import random
 
 from oslo_config import cfg
@@ -328,8 +327,7 @@ class L3Scheduler(object):
                                  chosen_agents):
         port_bindings = plugin.get_ha_router_port_bindings(context,
                                                            [router_id])
-        for port_binding, agent in itertools.izip(port_bindings,
-                                                  chosen_agents):
+        for port_binding, agent in zip(port_bindings, chosen_agents):
             port_binding.l3_agent_id = agent.id
             self.bind_router(context, router_id, agent)
 
index 0f68cae38f70ef8da4e5dfd87c45fdad858912d4..bd4d5730230c8cf0ac29bff4c1663811cc5abe6c 100644 (file)
@@ -13,8 +13,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import itertools
-
 import mock
 from oslo_log import log as logging
 import testtools
@@ -53,9 +51,8 @@ class ExtNetDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
         """Override the routine for allowing the router:external attribute."""
         # attributes containing a colon should be passed with
         # a double underscore
-        new_args = dict(itertools.izip(map(lambda x: x.replace('__', ':'),
-                                           kwargs),
-                                       kwargs.values()))
+        new_args = dict(zip(map(lambda x: x.replace('__', ':'), kwargs),
+                            kwargs.values()))
         arg_list = new_args.pop('arg_list', ()) + (external_net.EXTERNAL,)
         return super(ExtNetDBTestCase, self)._create_network(
             fmt, name, admin_state_up, arg_list=arg_list, **new_args)