summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-14 07:41:43 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-04-14 07:41:43 -0700
commit3f2c789ffd0d2e05596b15ea6cd644262f96200e (patch)
tree3ada9d38eaf9f5de1cd8e2529e73d163cd19d112 /numpy/ma
parent61c5ac6758d05da6cf49b7247eca850d9db83a7a (diff)
parent0dfe67afd1ee9e4c905bf119673f6e634221f21b (diff)
downloadnumpy-3f2c789ffd0d2e05596b15ea6cd644262f96200e.tar.gz
Merge pull request #3244 from charris/2to3-apply-zip-fixer
2to3: Apply zip fixer.
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/mrecords.py2
-rw-r--r--numpy/ma/tests/test_core.py24
-rw-r--r--numpy/ma/tests/test_mrecords.py6
3 files changed, 16 insertions, 16 deletions
diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py
index e2c014a9c..a2380d813 100644
--- a/numpy/ma/mrecords.py
+++ b/numpy/ma/mrecords.py
@@ -511,7 +511,7 @@ def fromarrays(arraylist, dtype=None, shape=None, formats=None,
dtype=dtype, shape=shape, formats=formats,
names=names, titles=titles, aligned=aligned,
byteorder=byteorder).view(mrecarray)
- _array._mask.flat = zip(*masklist)
+ _array._mask.flat = list(zip(*masklist))
if fill_value is not None:
_array.fill_value = fill_value
return _array
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index aa9b685d1..0846bb6e5 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -140,8 +140,8 @@ class TestMaskedArray(TestCase):
def test_concatenate_flexible(self):
"Tests the concatenation on flexible arrays."
- data = masked_array(zip(np.random.rand(10),
- np.arange(10)),
+ data = masked_array(list(zip(np.random.rand(10),
+ np.arange(10))),
dtype=[('a', float), ('b', int)])
#
test = concatenate([data[:5], data[5:]])
@@ -1500,7 +1500,7 @@ class TestFillingValues(TestCase):
"Test setting fill_value on individual fields"
ndtype = [('a', int), ('b', int)]
# Explicit fill_value
- a = array(zip([1, 2, 3], [4, 5, 6]),
+ a = array(list(zip([1, 2, 3], [4, 5, 6])),
fill_value=(-999, -999), dtype=ndtype)
f = a._fill_value
aa = a['a']
@@ -1510,7 +1510,7 @@ class TestFillingValues(TestCase):
a.fill_value['b'] = -10
assert_equal(tuple(a.fill_value), (10, -10))
# Implicit fill_value
- t = array(zip([1, 2, 3], [4, 5, 6]), dtype=[('a', int), ('b', int)])
+ t = array(list(zip([1, 2, 3], [4, 5, 6])), dtype=[('a', int), ('b', int)])
tt = t['a']
tt.set_fill_value(10)
assert_equal(tt._fill_value, np.array(10))
@@ -2512,9 +2512,9 @@ class TestMaskedArrayMethods(TestCase):
assert_equal(xlist[2], [8, 9, None, 11])
assert_equal(xlist, ctrl)
# ... on structured array w/ masked records
- x = array(zip([1, 2, 3],
+ x = array(list(zip([1, 2, 3],
[1.1, 2.2, 3.3],
- ['one', 'two', 'thr']),
+ ['one', 'two', 'thr'])),
dtype=[('a', int), ('b', float), ('c', '|S8')])
x[-1] = masked
assert_equal(x.tolist(),
@@ -3384,7 +3384,7 @@ class TestMaskedFields(TestCase):
ddtype = [('a', int), ('b', float), ('c', '|S8')]
mdtype = [('a', bool), ('b', bool), ('c', bool)]
mask = [0, 1, 0, 0, 1]
- base = array(zip(ilist, flist, slist), mask=mask, dtype=ddtype)
+ base = array(list(zip(ilist, flist, slist)), mask=mask, dtype=ddtype)
self.data = dict(base=base, mask=mask, ddtype=ddtype, mdtype=mdtype)
def test_set_records_masks(self):
@@ -3461,7 +3461,7 @@ class TestMaskedFields(TestCase):
#
def test_view(self):
"Test view w/ flexible dtype"
- iterator = zip(np.arange(10), np.random.rand(10))
+ iterator = list(zip(np.arange(10), np.random.rand(10)))
data = np.array(iterator)
a = array(iterator, dtype=[('a', float), ('b', float)])
a.mask[0] = (1, 0)
@@ -3481,9 +3481,9 @@ class TestMaskedFields(TestCase):
#
def test_getitem(self):
ndtype = [('a', float), ('b', float)]
- a = array(zip(np.random.rand(10), np.arange(10)), dtype=ndtype)
- a.mask = np.array(zip([0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
- [1, 0, 0, 0, 0, 0, 0, 0, 1, 0]),
+ a = array(list(zip(np.random.rand(10), np.arange(10))), dtype=ndtype)
+ a.mask = np.array(list(zip([0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
+ [1, 0, 0, 0, 0, 0, 0, 0, 1, 0])),
dtype=[('a', bool), ('b', bool)])
# No mask
self.assertTrue(isinstance(a[1], MaskedArray))
@@ -3501,7 +3501,7 @@ class TestMaskedFields(TestCase):
class TestMaskedView(TestCase):
#
def setUp(self):
- iterator = zip(np.arange(10), np.random.rand(10))
+ iterator = list(zip(np.arange(10), np.random.rand(10)))
data = np.array(iterator)
a = array(iterator, dtype=[('a', float), ('b', float)])
a.mask[0] = (1, 0)
diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py
index 515263fb2..340ba98b6 100644
--- a/numpy/ma/tests/test_mrecords.py
+++ b/numpy/ma/tests/test_mrecords.py
@@ -360,10 +360,10 @@ class TestView(TestCase):
def setUp(self):
(a, b) = (np.arange(10), np.random.rand(10))
ndtype = [('a',np.float), ('b',np.float)]
- arr = np.array(zip(a,b), dtype=ndtype)
+ arr = np.array(list(zip(a,b)), dtype=ndtype)
rec = arr.view(np.recarray)
#
- marr = ma.array(zip(a,b), dtype=ndtype, fill_value=(-9., -99.))
+ marr = ma.array(list(zip(a,b)), dtype=ndtype, fill_value=(-9., -99.))
mrec = fromarrays([a,b], dtype=ndtype, fill_value=(-9., -99.))
mrec.mask[3] = (False, True)
self.data = (mrec, a, b, arr)
@@ -380,7 +380,7 @@ class TestView(TestCase):
ntype = (np.float, 2)
test = mrec.view(ntype)
self.assertTrue(isinstance(test, ma.MaskedArray))
- assert_equal(test, np.array(zip(a,b), dtype=np.float))
+ assert_equal(test, np.array(list(zip(a,b)), dtype=np.float))
self.assertTrue(test[3,1] is ma.masked)
#
def test_view_flexible_type(self):