]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Python 3: Use six.moves.range
authorAdrien Vergé <adrienverge@gmail.com>
Tue, 19 May 2015 09:05:27 +0000 (11:05 +0200)
committerAdrien Vergé <adrienverge@gmail.com>
Tue, 19 May 2015 15:32:17 +0000 (17:32 +0200)
commit5836bbca83845fd78200c083465601d2558cdac2
tree73cdf18f107101d34f27427d412c4e9b1eba2aae
parentd89ee0b995259216cf4fdef6ad1afe315e3f549f
Python 3: Use six.moves.range

The function `xrange` was renamed to `range` in Python 3.

* Remove `xrange` occurences so that Python 3 tests can pass. Use
  `six.moves.range` instead to get the right function in both cases.
* Generalize the use of the efficient `range` (ex-`xrange`) in
  critical sections (when iterating over large lists).
* Simplify code.
* Add a hacking check to prevent future usage of `xrange`.

Change-Id: I080acaaa1d4753619fbbb76dddba6d946d84e73f
Partially implements: blueprint neutron-python3
19 files changed:
HACKING.rst
neutron/db/sqlalchemyutils.py
neutron/hacking/checks.py
neutron/plugins/brocade/vlanbm.py
neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py
neutron/plugins/ml2/drivers/type_gre.py
neutron/plugins/ml2/drivers/type_vlan.py
neutron/plugins/ml2/drivers/type_vxlan.py
neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/functional/agent/linux/test_async_process.py
neutron/tests/functional/agent/linux/test_process_monitor.py
neutron/tests/tempest/common/glance_http.py
neutron/tests/unit/agent/l3/test_agent.py
neutron/tests/unit/api/v2/test_base.py
neutron/tests/unit/hacking/test_checks.py
neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py
neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py
neutron/tests/unit/plugins/oneconvergence/test_nvsd_agent.py
neutron/tests/unit/tests/test_post_mortem_debug.py