]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Python 3: Replace reduce and xrange with six.moves
authorAnkit Agrawal <ankit11.agrawal@nttdata.com>
Fri, 15 Jan 2016 09:56:56 +0000 (01:56 -0800)
committerAnkit Agrawal <ankit11.agrawal@nttdata.com>
Fri, 15 Jan 2016 10:34:56 +0000 (02:34 -0800)
commit9cc2b79301d73929c6f673b4314950b8e0013a70
tree58b33ff9430398862b8b598fd45051a281cd3b21
parent8aa62ef2b98d892480722e55a93ba7082c00a2e1
Python 3: Replace reduce and xrange with six.moves

1. Builtin function 'reduce' in Python 2 has been moved to standard
library module in Python 3 [1]. To make code compatible, replaced
reduce(expr) with six.moves.reduce(expr).
2. xrange is renamed to range in Python 3, replaced it with
six.moves.range
3. Added __bool__() method in FeatureState class to make it python 3
compatible because Python 3 calls the __bool__() method instead of
__nonzero__ when evaluating an instance in a boolean context.
4. Added this test case to tests-py3.txt.

[1] http://python3porting.com/stdlib.html#moved-builtins

Closes-Bug: 1530249
Change-Id: I376cd643b9f58358a3e147532dafe77a7325a114
cinder/tests/unit/volume/drivers/netapp/eseries/test_library.py
cinder/volume/drivers/netapp/utils.py
tests-py3.txt