summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-06 10:02:23 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-06 10:29:12 -0600
commit77e09f14bdf9eeebbd20ca861cb51da3e570bb72 (patch)
treeb0c49fa552ccad7d2e9a384db72b79f5a758ba83 /numpy/ma
parent7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff)
downloadnumpy-77e09f14bdf9eeebbd20ca861cb51da3e570bb72.tar.gz
MAINT: Cleanup some imports involving reduce.
Because reduce has been available in functools since Python 2.6 we can get rid of the version checks we currently have before we import it. Also removes some reduce related skips in tools/py3tool.py. We were already skipping the reduce fixer so this has no effect other than cleaning up the code.
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py2
-rw-r--r--numpy/ma/tests/test_core.py3
-rw-r--r--numpy/ma/tests/test_old_ma.py8
-rw-r--r--numpy/ma/timer_comparison.py4
4 files changed, 7 insertions, 10 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 64cfafe7c..f085d6796 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -24,6 +24,7 @@ from __future__ import division, absolute_import
import sys
import warnings
+from functools import reduce
import numpy as np
import numpy.core.umath as umath
@@ -35,7 +36,6 @@ from numpy.compat import getargspec, formatargspec
from numpy import expand_dims as n_expand_dims
if sys.version_info[0] >= 3:
- from functools import reduce
import pickle
else:
import cPickle as pickle
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 7eb4bbed2..81114fb2e 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -12,6 +12,7 @@ import types
import warnings
import sys
import pickle
+from functools import reduce
import numpy as np
import numpy.ma.core
@@ -24,8 +25,6 @@ from numpy.testing.utils import WarningManager
pi = np.pi
-if sys.version_info[0] >= 3:
- from functools import reduce
#..............................................................................
class TestMaskedArray(TestCase):
diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py
index 41f7779d9..ba2b3fbf8 100644
--- a/numpy/ma/tests/test_old_ma.py
+++ b/numpy/ma/tests/test_old_ma.py
@@ -1,15 +1,15 @@
from __future__ import division, absolute_import
-import numpy
+import sys
import types
+from functools import reduce
+
+import numpy
from numpy.ma import *
from numpy.core.numerictypes import float32
from numpy.ma.core import umath
from numpy.testing import *
-import sys
-if sys.version_info[0] >= 3:
- from functools import reduce
pi = numpy.pi
def eq(v, w, msg=''):
diff --git a/numpy/ma/timer_comparison.py b/numpy/ma/timer_comparison.py
index 549448689..3662d5b03 100644
--- a/numpy/ma/timer_comparison.py
+++ b/numpy/ma/timer_comparison.py
@@ -1,8 +1,8 @@
from __future__ import division, absolute_import
import timeit
+from functools import reduce
-import sys
import numpy as np
from numpy import float_
import np.core.fromnumeric as fromnumeric
@@ -13,8 +13,6 @@ np.seterr(all='ignore')
pi = np.pi
-if sys.version_info[0] >= 3:
- from functools import reduce
class moduletester(object):
def __init__(self, module):