summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml28
-rw-r--r--numpy/add_newdocs.py18
-rw-r--r--numpy/core/arrayprint.py8
-rw-r--r--numpy/core/fromnumeric.py83
-rw-r--r--numpy/core/numeric.py8
-rw-r--r--numpy/core/numerictypes.py2
-rw-r--r--numpy/core/records.py8
-rw-r--r--numpy/core/shape_base.py2
-rw-r--r--numpy/distutils/npy_pkg_config.py2
-rw-r--r--numpy/distutils/system_info.py30
-rw-r--r--numpy/doc/glossary.py6
-rw-r--r--numpy/doc/misc.py2
-rw-r--r--numpy/doc/subclassing.py36
-rw-r--r--numpy/f2py/auxfuncs.py4
-rw-r--r--numpy/fft/fftpack.py18
-rw-r--r--numpy/lib/arrayterator.py4
-rw-r--r--numpy/lib/financial.py4
-rw-r--r--numpy/lib/function_base.py8
-rw-r--r--numpy/lib/index_tricks.py4
-rw-r--r--numpy/lib/polynomial.py16
-rw-r--r--numpy/lib/tests/test_format.py2
-rw-r--r--numpy/lib/twodim_base.py2
-rw-r--r--numpy/lib/type_check.py2
-rw-r--r--numpy/linalg/lapack_lite/clapack_scrub.py4
-rw-r--r--numpy/linalg/linalg.py2
-rw-r--r--numpy/ma/core.py62
-rw-r--r--numpy/ma/extras.py14
-rw-r--r--numpy/ma/tests/test_old_ma.py58
-rw-r--r--numpy/matrixlib/defmatrix.py2
-rw-r--r--numpy/testing/decorators.py2
-rw-r--r--numpy/testing/noseclasses.py12
-rw-r--r--numpy/testing/utils.py2
-rw-r--r--tools/swig/test/testFortran.py10
-rw-r--r--tools/win32build/misc/x86analysis.py9
34 files changed, 191 insertions, 283 deletions
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 000000000..026db34ea
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,28 @@
+skip_tags: true
+clone_depth: 1
+
+os: Visual Studio 2015
+
+environment:
+ PYTHON_ARCH: "x86_64"
+ matrix:
+ - PY_MAJOR_VER: 2
+ - PY_MAJOR_VER: 3
+
+matrix:
+ #fast_finish: true
+ allow_failures:
+ - PY_MAJOR_VER: 2
+ - PY_MAJOR_VER: 3
+
+build_script:
+ - ps: Start-FileDownload "https://repo.continuum.io/miniconda/Miniconda$env:PY_MAJOR_VER-latest-Windows-$env:PYTHON_ARCH.exe" C:\Miniconda.exe; echo "Finished downloading miniconda"
+ - cmd: C:\Miniconda.exe /S /D=C:\Py
+ - SET PATH=C:\Py;C:\Py\Scripts;C:\Py\Library\bin;%PATH%
+ - conda config --set always_yes yes
+ - conda update conda
+ - conda install cython nose
+ - pip install . -vvv
+
+test_script:
+ - python runtests.py -v -n
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 01ef24a5b..7eef07c4a 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -49,7 +49,7 @@ add_newdoc('numpy.core', 'flatiter',
>>> type(fl)
<type 'numpy.flatiter'>
>>> for item in fl:
- ... print item
+ ... print(item)
...
0
1
@@ -1548,7 +1548,7 @@ add_newdoc('numpy.core.multiarray', 'lexsort',
>>> a = [1,5,1,4,3,4,4] # First column
>>> b = [9,4,0,4,0,2,1] # Second column
>>> ind = np.lexsort((b,a)) # Sort by a, then by b
- >>> print ind
+ >>> print(ind)
[2 0 4 6 5 3 1]
>>> [(a[i],b[i]) for i in ind]
@@ -4773,7 +4773,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('view',
>>> y = x.view(dtype=np.int16, type=np.matrix)
>>> y
matrix([[513]], dtype=int16)
- >>> print type(y)
+ >>> print(type(y))
<class 'numpy.matrixlib.defmatrix.matrix'>
Creating a view on a structured array so it can be used in calculations
@@ -4789,7 +4789,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('view',
Making changes to the view changes the underlying array
>>> xv[0,1] = 20
- >>> print x
+ >>> print(x)
[(1, 20) (3, 4)]
Using a view to convert an array to a recarray:
@@ -4915,7 +4915,7 @@ add_newdoc('numpy.core.umath', 'geterrobj',
[10000, 0, None]
>>> def err_handler(type, flag):
- ... print "Floating point error (%s), with flag %s" % (type, flag)
+ ... print("Floating point error (%s), with flag %s" % (type, flag))
...
>>> old_bufsize = np.setbufsize(20000)
>>> old_err = np.seterr(divide='raise')
@@ -4979,7 +4979,7 @@ add_newdoc('numpy.core.umath', 'seterrobj',
[10000, 0, None]
>>> def err_handler(type, flag):
- ... print "Floating point error (%s), with flag %s" % (type, flag)
+ ... print("Floating point error (%s), with flag %s" % (type, flag))
...
>>> new_errobj = [20000, 12, err_handler]
>>> np.seterrobj(new_errobj)
@@ -5064,7 +5064,7 @@ add_newdoc('numpy.core.multiarray', 'digitize',
>>> inds
array([1, 4, 3, 2])
>>> for n in range(x.size):
- ... print bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]]
+ ... print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]])
...
0.0 <= 0.2 < 1.0
4.0 <= 6.4 < 10.0
@@ -5473,7 +5473,7 @@ add_newdoc('numpy.core', 'ufunc', ('identity',
1
>>> np.power.identity
1
- >>> print np.exp.identity
+ >>> print(np.exp.identity)
None
"""))
@@ -6181,7 +6181,7 @@ add_newdoc('numpy.core.multiarray', 'dtype', ('fields',
Examples
--------
>>> dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))])
- >>> print dt.fields
+ >>> print(dt.fields)
{'grades': (dtype(('float64',(2,))), 16), 'name': (dtype('|S16'), 0)}
"""))
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index a28b5a89e..fefcb6493 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -114,13 +114,13 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None,
Floating point precision can be set:
>>> np.set_printoptions(precision=4)
- >>> print np.array([1.123456789])
+ >>> print(np.array([1.123456789]))
[ 1.1235]
Long arrays can be summarised:
>>> np.set_printoptions(threshold=5)
- >>> print np.arange(10)
+ >>> print(np.arange(10))
[0 1 2 ..., 7 8 9]
Small results can be suppressed:
@@ -420,8 +420,8 @@ def array2string(a, max_line_width=None, precision=None,
Examples
--------
>>> x = np.array([1e-16,1,2,3])
- >>> print np.array2string(x, precision=2, separator=',',
- ... suppress_small=True)
+ >>> print(np.array2string(x, precision=2, separator=',',
+ ... suppress_small=True))
[ 0., 1., 2., 3.]
>>> x = np.arange(3.)
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 197513294..362c29cb8 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1434,20 +1434,20 @@ def ravel(a, order='C'):
It is equivalent to ``reshape(-1, order=order)``.
>>> x = np.array([[1, 2, 3], [4, 5, 6]])
- >>> print np.ravel(x)
+ >>> print(np.ravel(x))
[1 2 3 4 5 6]
- >>> print x.reshape(-1)
+ >>> print(x.reshape(-1))
[1 2 3 4 5 6]
- >>> print np.ravel(x, order='F')
+ >>> print(np.ravel(x, order='F'))
[1 4 2 5 3 6]
When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering:
- >>> print np.ravel(x.T)
+ >>> print(np.ravel(x.T))
[1 4 2 5 3 6]
- >>> print np.ravel(x.T, order='A')
+ >>> print(np.ravel(x.T, order='A'))
[1 2 3 4 5 6]
When ``order`` is 'K', it will preserve orderings that are neither 'C'
@@ -1739,31 +1739,30 @@ def sum(a, axis=None, dtype=None, out=None, keepdims=False):
a : array_like
Elements to sum.
axis : None or int or tuple of ints, optional
- Axis or axes along which a sum is performed.
- The default (`axis` = `None`) is perform a sum over all
- the dimensions of the input array. `axis` may be negative, in
- which case it counts from the last to the first axis.
+ Axis or axes along which a sum is performed. The default,
+ axis=None, will sum all of the elements of the input array. If
+ axis is negative it counts from the last to the first axis.
.. versionadded:: 1.7.0
- If this is a tuple of ints, a sum is performed on multiple
- axes, instead of a single axis or all the axes as before.
+ If axis is a tuple of ints, a sum is performed on all of the axes
+ specified in the tuple instead of a single axis or all the axes as
+ before.
dtype : dtype, optional
- The type of the returned array and of the accumulator in which
- the elements are summed. By default, the dtype of `a` is used.
- An exception is when `a` has an integer type with less precision
- than the default platform integer. In that case, the default
- platform integer is used instead.
+ The type of the returned array and of the accumulator in which the
+ elements are summed. The dtype of `a` is used by default unless `a`
+ has an integer dtype of less precision than the default platform
+ integer. In that case, if `a` is signed then the platform integer
+ is used while if `a` is unsigned then an unsigned integer of the
+ same precision as the platform integer is used.
out : ndarray, optional
- Array into which the output is placed. By default, a new array is
- created. If `out` is given, it must be of the appropriate shape
- (the shape of `a` with `axis` removed, i.e.,
- ``numpy.delete(a.shape, axis)``). Its type is preserved. See
- `doc.ufuncs` (Section "Output arguments") for more details.
+ Alternative output array in which to place the result. It must have
+ the same shape as the expected output, but the type of the output
+ values will be cast if necessary.
keepdims : bool, optional
- If this is set to True, the axes which are reduced are left
- in the result as dimensions with size one. With this option,
- the result will broadcast correctly against the original `arr`.
+ If this is set to True, the axes which are reduced are left in the
+ result as dimensions with size one. With this option, the result
+ will broadcast correctly against the input array.
Returns
-------
@@ -2392,29 +2391,31 @@ def prod(a, axis=None, dtype=None, out=None, keepdims=False):
a : array_like
Input data.
axis : None or int or tuple of ints, optional
- Axis or axes along which a product is performed.
- The default (`axis` = `None`) is perform a product over all
- the dimensions of the input array. `axis` may be negative, in
- which case it counts from the last to the first axis.
+ Axis or axes along which a product is performed. The default,
+ axis=None, will calculate the product of all the elements in the
+ input array. If axis is negative it counts from the last to the
+ first axis.
.. versionadded:: 1.7.0
- If this is a tuple of ints, a product is performed on multiple
- axes, instead of a single axis or all the axes as before.
- dtype : data-type, optional
- The data-type of the returned array, as well as of the accumulator
- in which the elements are multiplied. By default, if `a` is of
- integer type, `dtype` is the default platform integer. (Note: if
- the type of `a` is unsigned, then so is `dtype`.) Otherwise,
- the dtype is the same as that of `a`.
+ If axis is a tuple of ints, a product is performed on all of the
+ axes specified in the tuple instead of a single axis or all the
+ axes as before.
+ dtype : dtype, optional
+ The type of the returned array, as well as of the accumulator in
+ which the elements are multiplied. The dtype of `a` is used by
+ default unless `a` has an integer dtype of less precision than the
+ default platform integer. In that case, if `a` is signed then the
+ platform integer is used while if `a` is unsigned then an unsigned
+ integer of the same precision as the platform integer is used.
out : ndarray, optional
Alternative output array in which to place the result. It must have
- the same shape as the expected output, but the type of the
- output values will be cast if necessary.
+ the same shape as the expected output, but the type of the output
+ values will be cast if necessary.
keepdims : bool, optional
- If this is set to True, the axes which are reduced are left
- in the result as dimensions with size one. With this option,
- the result will broadcast correctly against the original `arr`.
+ If this is set to True, the axes which are reduced are left in the
+ result as dimensions with size one. With this option, the result
+ will broadcast correctly against the input array.
Returns
-------
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 3b442ea78..4f3d418e6 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -1808,7 +1808,7 @@ def set_string_function(f, repr=True):
>>> a = np.arange(10)
>>> a
HA! - What are you going to do now?
- >>> print a
+ >>> print(a)
[0 1 2 3 4 5 6 7 8 9]
We can reset the function to the default:
@@ -2710,7 +2710,7 @@ def seterrcall(func):
Callback upon error:
>>> def err_handler(type, flag):
- ... print "Floating point error (%s), with flag %s" % (type, flag)
+ ... print("Floating point error (%s), with flag %s" % (type, flag))
...
>>> saved_handler = np.seterrcall(err_handler)
@@ -2729,7 +2729,7 @@ def seterrcall(func):
>>> class Log(object):
... def write(self, msg):
- ... print "LOG: %s" % msg
+ ... print("LOG: %s" % msg)
...
>>> log = Log()
@@ -2787,7 +2787,7 @@ def geterrcall():
>>> oldsettings = np.seterr(all='call')
>>> def err_handler(type, flag):
- ... print "Floating point error (%s), with flag %s" % (type, flag)
+ ... print("Floating point error (%s), with flag %s" % (type, flag))
>>> oldhandler = np.seterrcall(err_handler)
>>> np.array([1, 2, 3]) / 0.0
Floating point error (divide by zero), with flag 1
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py
index 7dc6e0bd8..1b6551e6c 100644
--- a/numpy/core/numerictypes.py
+++ b/numpy/core/numerictypes.py
@@ -822,7 +822,7 @@ def sctype2char(sctype):
Examples
--------
>>> for sctype in [np.int32, np.float, np.complex, np.string_, np.ndarray]:
- ... print np.sctype2char(sctype)
+ ... print(np.sctype2char(sctype))
l
d
D
diff --git a/numpy/core/records.py b/numpy/core/records.py
index b07755384..ca6070cf7 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -567,7 +567,7 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None,
>>> x2=np.array(['a','dd','xyz','12'])
>>> x3=np.array([1.1,2,3,4])
>>> r = np.core.records.fromarrays([x1,x2,x3],names='a,b,c')
- >>> print r[1]
+ >>> print(r[1])
(2, 'dd', 2.0)
>>> x1[1]=34
>>> r.a
@@ -643,7 +643,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None,
>>> r=np.core.records.fromrecords([(456,'dbe',1.2),(2,'de',1.3)],
... names='col1,col2,col3')
- >>> print r[0]
+ >>> print(r[0])
(456, 'dbe', 1.2)
>>> r.col1
array([456, 2])
@@ -651,7 +651,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None,
array(['dbe', 'de'],
dtype='|S3')
>>> import pickle
- >>> print pickle.loads(pickle.dumps(r))
+ >>> print(pickle.loads(pickle.dumps(r)))
[(456, 'dbe', 1.2) (2, 'de', 1.3)]
"""
@@ -736,7 +736,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
>>> fd.seek(0)
>>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10,
... byteorder='<')
- >>> print r[5]
+ >>> print(r[5])
(0.5, 10, 'abcde')
>>> r.shape
(10,)
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index 0dd2e164a..599b48d82 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -150,7 +150,7 @@ def atleast_3d(*arys):
True
>>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]):
- ... print arr, arr.shape
+ ... print(arr, arr.shape)
...
[[[1]
[2]]] (1, 2, 1)
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py
index 1c801fd9c..fe64709ca 100644
--- a/numpy/distutils/npy_pkg_config.py
+++ b/numpy/distutils/npy_pkg_config.py
@@ -366,7 +366,7 @@ def read_config(pkgname, dirs=None):
>>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath')
>>> type(npymath_info)
<class 'numpy.distutils.npy_pkg_config.LibraryInfo'>
- >>> print npymath_info
+ >>> print(npymath_info)
Name: npymath
Description: Portable, core math library implementing C99 standard
Requires:
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 94436243e..dde18dfa5 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -677,11 +677,6 @@ class system_info(object):
exts.append('.dll.a')
if sys.platform == 'darwin':
exts.append('.dylib')
- # Debian and Ubuntu added a g3f suffix to shared library to deal with
- # g77 -> gfortran ABI transition
- # XXX: disabled, it hides more problem than it solves.
- #if sys.platform[:5] == 'linux':
- # exts.append('.so.3gf')
return exts
def check_libs(self, lib_dirs, libs, opt_libs=[]):
@@ -995,13 +990,10 @@ class mkl_info(system_info):
l = 'mkl' # use shared library
if cpu.is_Itanium():
plt = '64'
- #l = 'mkl_ipf'
elif cpu.is_Xeon():
plt = 'intel64'
- #l = 'mkl_intel64'
else:
plt = '32'
- #l = 'mkl_ia32'
if l not in self._lib_mkl:
self._lib_mkl.insert(0, l)
system_info.__init__(
@@ -1243,8 +1235,6 @@ class atlas_3_10_blas_info(atlas_3_10_info):
class atlas_3_10_threads_info(atlas_3_10_info):
dir_env_var = ['PTATLAS', 'ATLAS']
_lib_names = ['tatlas']
- #if sys.platfcorm[:7] == 'freebsd':
- ## I don't think freebsd supports 3.10 at this time - 2014
_lib_atlas = _lib_names
_lib_lapack = _lib_names
@@ -1535,7 +1525,6 @@ class lapack_opt_info(system_info):
('HAVE_CBLAS', None)])
return
- #atlas_info = {} ## uncomment for testing
need_lapack = 0
need_blas = 0
info = {}
@@ -1567,7 +1556,6 @@ class lapack_opt_info(system_info):
if need_blas:
blas_info = get_info('blas')
- #blas_info = {} ## uncomment for testing
if blas_info:
dict_append(info, **blas_info)
else:
@@ -1941,13 +1929,6 @@ class _numpy_info(system_info):
'"\\"%s\\""' % (vrs)),
(self.modulename.upper(), None)]
break
-## try:
-## macros.append(
-## (self.modulename.upper()+'_VERSION_HEX',
-## hex(vstr2hex(module.__version__))),
-## )
-## except Exception as msg:
-## print msg
dict_append(info, define_macros=macros)
include_dirs = self.get_include_dirs()
inc_dir = None
@@ -2322,17 +2303,6 @@ class umfpack_info(system_info):
self.set_info(**info)
return
-## def vstr2hex(version):
-## bits = []
-## n = [24,16,8,4,0]
-## r = 0
-## for s in version.split('.'):
-## r |= int(s) << n[0]
-## del n[0]
-## return r
-
-#--------------------------------------------------------------------
-
def combine_paths(*args, **kws):
""" Return a list of existing paths composed by all combinations of
diff --git a/numpy/doc/glossary.py b/numpy/doc/glossary.py
index 9dacd1cb5..4a3238491 100644
--- a/numpy/doc/glossary.py
+++ b/numpy/doc/glossary.py
@@ -109,7 +109,7 @@ Glossary
>>> def log(f):
... def new_logging_func(*args, **kwargs):
- ... print "Logging call with parameters:", args, kwargs
+ ... print("Logging call with parameters:", args, kwargs)
... return f(*args, **kwargs)
...
... return new_logging_func
@@ -185,7 +185,7 @@ Glossary
It is often used in combintion with ``enumerate``::
>>> keys = ['a','b','c']
>>> for n, k in enumerate(keys):
- ... print "Key %d: %s" % (n, k)
+ ... print("Key %d: %s" % (n, k))
...
Key 0: a
Key 1: b
@@ -315,7 +315,7 @@ Glossary
... color = 'blue'
...
... def paint(self):
- ... print "Painting the city %s!" % self.color
+ ... print("Painting the city %s!" % self.color)
...
>>> p = Paintbrush()
>>> p.color = 'red'
diff --git a/numpy/doc/misc.py b/numpy/doc/misc.py
index 1709ad66d..e30caf0cb 100644
--- a/numpy/doc/misc.py
+++ b/numpy/doc/misc.py
@@ -86,7 +86,7 @@ Examples
>>> np.sqrt(np.array([-1.]))
FloatingPointError: invalid value encountered in sqrt
>>> def errorhandler(errstr, errflag):
- ... print "saw stupid error!"
+ ... print("saw stupid error!")
>>> np.seterrcall(errorhandler)
<function err_handler at 0x...>
>>> j = np.seterr(all='call')
diff --git a/numpy/doc/subclassing.py b/numpy/doc/subclassing.py
index a62fc2d6d..85327feab 100644
--- a/numpy/doc/subclassing.py
+++ b/numpy/doc/subclassing.py
@@ -123,13 +123,13 @@ For example, consider the following Python code:
class C(object):
def __new__(cls, *args):
- print 'Cls in __new__:', cls
- print 'Args in __new__:', args
+ print('Cls in __new__:', cls)
+ print('Args in __new__:', args)
return object.__new__(cls, *args)
def __init__(self, *args):
- print 'type(self) in __init__:', type(self)
- print 'Args in __init__:', args
+ print('type(self) in __init__:', type(self))
+ print('Args in __init__:', args)
meaning that we get:
@@ -159,13 +159,13 @@ of some other class. Consider the following:
class D(C):
def __new__(cls, *args):
- print 'D cls is:', cls
- print 'D args in __new__:', args
+ print('D cls is:', cls)
+ print('D args in __new__:', args)
return C.__new__(C, *args)
def __init__(self, *args):
# we never get here
- print 'In D __init__'
+ print('In D __init__')
meaning that:
@@ -242,18 +242,18 @@ The following code allows us to look at the call sequences and arguments:
class C(np.ndarray):
def __new__(cls, *args, **kwargs):
- print 'In __new__ with class %s' % cls
+ print('In __new__ with class %s' % cls)
return np.ndarray.__new__(cls, *args, **kwargs)
def __init__(self, *args, **kwargs):
# in practice you probably will not need or want an __init__
# method for your subclass
- print 'In __init__ with class %s' % self.__class__
+ print('In __init__ with class %s' % self.__class__)
def __array_finalize__(self, obj):
- print 'In array_finalize:'
- print ' self type is %s' % type(self)
- print ' obj type is %s' % type(obj)
+ print('In array_finalize:')
+ print(' self type is %s' % type(self))
+ print(' obj type is %s' % type(obj))
Now:
@@ -441,16 +441,16 @@ some print statements:
return obj
def __array_finalize__(self, obj):
- print 'In __array_finalize__:'
- print ' self is %s' % repr(self)
- print ' obj is %s' % repr(obj)
+ print('In __array_finalize__:')
+ print(' self is %s' % repr(self))
+ print(' obj is %s' % repr(obj))
if obj is None: return
self.info = getattr(obj, 'info', None)
def __array_wrap__(self, out_arr, context=None):
- print 'In __array_wrap__:'
- print ' self is %s' % repr(self)
- print ' arr is %s' % repr(out_arr)
+ print('In __array_wrap__:')
+ print(' self is %s' % repr(self))
+ print(' arr is %s' % repr(out_arr))
# then just call the parent
return np.ndarray.__array_wrap__(self, out_arr, context)
diff --git a/numpy/f2py/auxfuncs.py b/numpy/f2py/auxfuncs.py
index b64aaa50d..d27b95947 100644
--- a/numpy/f2py/auxfuncs.py
+++ b/numpy/f2py/auxfuncs.py
@@ -430,9 +430,6 @@ def isintent_nothide(var):
def isintent_c(var):
return 'c' in var.get('intent', [])
-# def isintent_f(var):
-# return not isintent_c(var)
-
def isintent_cache(var):
return 'cache' in var.get('intent', [])
@@ -673,7 +670,6 @@ def getcallprotoargument(rout, cb_map={}):
proto_args = ','.join(arg_types + arg_types2)
if not proto_args:
proto_args = 'void'
- # print proto_args
return proto_args
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py
index 4ad4f6802..c3bb732b2 100644
--- a/numpy/fft/fftpack.py
+++ b/numpy/fft/fftpack.py
@@ -203,10 +203,16 @@ def ifft(a, n=None, axis=-1, norm=None):
see `numpy.fft`.
The input should be ordered in the same way as is returned by `fft`,
- i.e., ``a[0]`` should contain the zero frequency term,
- ``a[1:n/2+1]`` should contain the positive-frequency terms, and
- ``a[n/2+1:]`` should contain the negative-frequency terms, in order of
- decreasingly negative frequency. See `numpy.fft` for details.
+ i.e.,
+
+ * ``a[0]`` should contain the zero frequency term,
+ * ``a[1:n//2]`` should contain the positive-frequency terms,
+ * ``a[n//2 + 1:]`` should contain the negative-frequency terms, in
+ increasing order starting from the most negative frequency.
+
+ For an even number of input points, ``A[n//2]`` represents the sum of
+ the values at the positive and negative Nyquist frequencies, as the two
+ are aliased together. See `numpy.fft` for details.
Parameters
----------
@@ -263,9 +269,9 @@ def ifft(a, n=None, axis=-1, norm=None):
>>> n[40:60] = np.exp(1j*np.random.uniform(0, 2*np.pi, (20,)))
>>> s = np.fft.ifft(n)
>>> plt.plot(t, s.real, 'b-', t, s.imag, 'r--')
- [<matplotlib.lines.Line2D object at 0x...>, <matplotlib.lines.Line2D object at 0x...>]
+ ...
>>> plt.legend(('real', 'imaginary'))
- <matplotlib.legend.Legend object at 0x...>
+ ...
>>> plt.show()
"""
diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py
index 80b369bd5..fb52ada86 100644
--- a/numpy/lib/arrayterator.py
+++ b/numpy/lib/arrayterator.py
@@ -80,7 +80,7 @@ class Arrayterator(object):
>>> for subarr in a_itor:
... if not subarr.all():
- ... print subarr, subarr.shape
+ ... print(subarr, subarr.shape)
...
[[[[0 1]]]] (1, 1, 1, 2)
@@ -158,7 +158,7 @@ class Arrayterator(object):
>>> for subarr in a_itor.flat:
... if not subarr:
- ... print subarr, type(subarr)
+ ... print(subarr, type(subarr))
...
0 <type 'numpy.int32'>
diff --git a/numpy/lib/financial.py b/numpy/lib/financial.py
index a7e4e60b6..c42424da1 100644
--- a/numpy/lib/financial.py
+++ b/numpy/lib/financial.py
@@ -247,7 +247,7 @@ def nper(rate, pmt, pv, fv=0, when='end'):
If you only had $150/month to pay towards the loan, how long would it take
to pay-off a loan of $8,000 at 7% annual interest?
- >>> print round(np.nper(0.07/12, -150, 8000), 5)
+ >>> print(round(np.nper(0.07/12, -150, 8000), 5))
64.07335
So, over 64 months would be required to pay off the loan.
@@ -347,7 +347,7 @@ def ipmt(rate, per, nper, pv, fv=0.0, when='end'):
>>> for payment in per:
... index = payment - 1
... principal = principal + ppmt[index]
- ... print fmt.format(payment, ppmt[index], ipmt[index], principal)
+ ... print(fmt.format(payment, ppmt[index], ipmt[index], principal))
1 -200.58 -17.17 2299.42
2 -201.96 -15.79 2097.46
3 -203.35 -14.40 1894.11
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 8335b4fdb..c69185c1c 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -833,7 +833,7 @@ def asarray_chkfinite(a, dtype=None, order=None):
>>> try:
... np.asarray_chkfinite(a)
... except ValueError:
- ... print 'ValueError'
+ ... print('ValueError')
...
ValueError
@@ -2200,13 +2200,13 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
>>> x = [-2.1, -1, 4.3]
>>> y = [3, 1.1, 0.12]
>>> X = np.vstack((x,y))
- >>> print np.cov(X)
+ >>> print(np.cov(X))
[[ 11.71 -4.286 ]
[ -4.286 2.14413333]]
- >>> print np.cov(x, y)
+ >>> print(np.cov(x, y))
[[ 11.71 -4.286 ]
[ -4.286 2.14413333]]
- >>> print np.cov(x)
+ >>> print(np.cov(x))
11.71
"""
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index 8bcc3fb53..a0875a25f 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -491,7 +491,7 @@ class ndenumerate(object):
--------
>>> a = np.array([[1, 2], [3, 4]])
>>> for index, x in np.ndenumerate(a):
- ... print index, x
+ ... print(index, x)
(0, 0) 1
(0, 1) 2
(1, 0) 3
@@ -542,7 +542,7 @@ class ndindex(object):
Examples
--------
>>> for index in np.ndindex(3, 2, 1):
- ... print index
+ ... print(index)
(0, 0, 0)
(0, 1, 0)
(1, 0, 0)
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index 2f677438b..a5d3f5f5f 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -715,12 +715,12 @@ def polyadd(a1, a2):
>>> p1 = np.poly1d([1, 2])
>>> p2 = np.poly1d([9, 5, 4])
- >>> print p1
+ >>> print(p1)
1 x + 2
- >>> print p2
+ >>> print(p2)
2
9 x + 5 x + 4
- >>> print np.polyadd(p1, p2)
+ >>> print(np.polyadd(p1, p2))
2
9 x + 6 x + 6
@@ -826,13 +826,13 @@ def polymul(a1, a2):
>>> p1 = np.poly1d([1, 2, 3])
>>> p2 = np.poly1d([9, 5, 1])
- >>> print p1
+ >>> print(p1)
2
1 x + 2 x + 3
- >>> print p2
+ >>> print(p2)
2
9 x + 5 x + 1
- >>> print np.polymul(p1, p2)
+ >>> print(np.polymul(p1, p2))
4 3 2
9 x + 23 x + 38 x + 17 x + 3
@@ -966,7 +966,7 @@ class poly1d(object):
Construct the polynomial :math:`x^2 + 2x + 3`:
>>> p = np.poly1d([1, 2, 3])
- >>> print np.poly1d(p)
+ >>> print(np.poly1d(p))
2
1 x + 2 x + 3
@@ -1022,7 +1022,7 @@ class poly1d(object):
using the `variable` parameter:
>>> p = np.poly1d([1,2,3], variable='z')
- >>> print p
+ >>> print(p)
2
1 z + 2 z + 3
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py
index 1bf65fa61..a091ef5b3 100644
--- a/numpy/lib/tests/test_format.py
+++ b/numpy/lib/tests/test_format.py
@@ -112,7 +112,7 @@ Test the header writing.
>>> for arr in basic_arrays + record_arrays:
... f = BytesIO()
... format.write_array_header_1_0(f, arr) # XXX: arr is not a dict, items gets called on it
- ... print repr(f.getvalue())
+ ... print(repr(f.getvalue()))
...
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)} \n"
"F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()} \n"
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py
index 464ffd914..b2f350bb7 100644
--- a/numpy/lib/twodim_base.py
+++ b/numpy/lib/twodim_base.py
@@ -664,7 +664,7 @@ def histogram2d(x, y, bins=10, range=None, normed=False, weights=None):
Or we fill the histogram H with a determined bin content:
>>> H = np.ones((4, 4)).cumsum().reshape(4, 4)
- >>> print H[::-1] # This shows the bin content in the order as plotted
+ >>> print(H[::-1]) # This shows the bin content in the order as plotted
[[ 13. 14. 15. 16.]
[ 9. 10. 11. 12.]
[ 5. 6. 7. 8.]
diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py
index 2fe4e7d23..1313adff7 100644
--- a/numpy/lib/type_check.py
+++ b/numpy/lib/type_check.py
@@ -501,7 +501,7 @@ def typename(char):
>>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q',
... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q']
>>> for typechar in typechars:
- ... print typechar, ' : ', np.typename(typechar)
+ ... print(typechar, ' : ', np.typename(typechar))
...
S1 : character
? : bool
diff --git a/numpy/linalg/lapack_lite/clapack_scrub.py b/numpy/linalg/lapack_lite/clapack_scrub.py
index 4a517d531..f3d29aa4e 100644
--- a/numpy/linalg/lapack_lite/clapack_scrub.py
+++ b/numpy/linalg/lapack_lite/clapack_scrub.py
@@ -13,10 +13,6 @@ class MyScanner(Scanner):
Scanner.__init__(self, self.lexicon, info, name)
def begin(self, state_name):
-# if self.state_name == '':
-# print '<default>'
-# else:
-# print self.state_name
Scanner.begin(self, state_name)
def sep_seq(sequence, sep):
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 2e969727b..9dc879d31 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -1853,7 +1853,7 @@ def lstsq(a, b, rcond=-1):
[ 3., 1.]])
>>> m, c = np.linalg.lstsq(A, y)[0]
- >>> print m, c
+ >>> print(m, c)
1.0 -0.95
Plot the data along with the fitted line:
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 25e542cd6..de716a669 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2147,12 +2147,12 @@ def masked_object(x, value, copy=True, shrink=True):
>>> food = np.array(['green_eggs', 'ham'], dtype=object)
>>> # don't eat spoiled food
>>> eat = ma.masked_object(food, 'green_eggs')
- >>> print eat
+ >>> print(eat)
[-- ham]
>>> # plain ol` ham is boring
>>> fresh_food = np.array(['cheese', 'ham', 'pineapple'], dtype=object)
>>> eat = ma.masked_object(fresh_food, 'green_eggs')
- >>> print eat
+ >>> print(eat)
[cheese ham pineapple]
Note that `mask` is set to ``nomask`` if possible.
@@ -2548,7 +2548,7 @@ class MaskedIterator(object):
>>> type(fl)
<class 'numpy.ma.core.MaskedIterator'>
>>> for item in fl:
- ... print item
+ ... print(item)
...
0
1
@@ -3064,11 +3064,11 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3.1],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1.0 -- 3.1]
[-- 5.0 --]
[7.0 -- 9.0]]
- >>> print x.astype(int32)
+ >>> print(x.astype(int32))
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
@@ -3656,7 +3656,7 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
@@ -4261,11 +4261,11 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
- >>> print x.ravel()
+ >>> print(x.ravel())
[1 -- 3 -- 5 -- 7 -- 9]
"""
@@ -4317,11 +4317,11 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1])
- >>> print x
+ >>> print(x)
[[-- 2]
[3 --]]
>>> x = x.reshape((4,1))
- >>> print x
+ >>> print(x)
[[--]
[2]
[3]
@@ -4382,18 +4382,18 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
>>> x.put([0,4,8],[10,20,30])
- >>> print x
+ >>> print(x)
[[10 -- 3]
[-- 20 --]
[7 -- 30]]
>>> x.put(4,999)
- >>> print x
+ >>> print(x)
[[10 -- 3]
[-- 999 --]
[7 -- 30]]
@@ -4745,17 +4745,17 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
- >>> print x.sum()
+ >>> print(x.sum())
25
- >>> print x.sum(axis=1)
+ >>> print(x.sum(axis=1))
[4 5 16]
- >>> print x.sum(axis=0)
+ >>> print(x.sum(axis=0))
[8 5 12]
- >>> print type(x.sum(axis=0, dtype=np.int64)[0])
+ >>> print(type(x.sum(axis=0, dtype=np.int64)[0]))
<type 'numpy.int64'>
"""
@@ -4823,7 +4823,7 @@ class MaskedArray(ndarray):
Examples
--------
>>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0])
- >>> print marr.cumsum()
+ >>> print(marr.cumsum())
[0 1 3 -- -- -- 9 16 24 33]
"""
@@ -5223,12 +5223,12 @@ class MaskedArray(ndarray):
--------
>>> x = np.ma.array(arange(4), mask=[1,1,0,0])
>>> x.shape = (2,2)
- >>> print x
+ >>> print(x)
[[-- --]
[2 3]]
- >>> print x.argmin(axis=0, fill_value=-1)
+ >>> print(x.argmin(axis=0, fill_value=-1))
[0 0]
- >>> print x.argmin(axis=0, fill_value=9)
+ >>> print(x.argmin(axis=0, fill_value=9))
[1 1]
"""
@@ -5324,19 +5324,19 @@ class MaskedArray(ndarray):
>>> a = ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # Default
>>> a.sort()
- >>> print a
+ >>> print(a)
[1 3 5 -- --]
>>> a = ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # Put missing values in the front
>>> a.sort(endwith=False)
- >>> print a
+ >>> print(a)
[-- -- 1 3 5]
>>> a = ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
>>> # fill_value takes over endwith
>>> a.sort(endwith=False, fill_value=3)
- >>> print a
+ >>> print(a)
[1 -- -- 3 5]
"""
@@ -5452,7 +5452,7 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array(np.arange(6), mask=[0 ,1, 0, 0, 0 ,1]).reshape(3, 2)
- >>> print x
+ >>> print(x)
[[0 --]
[2 3]
[4 --]]
@@ -5462,7 +5462,7 @@ class MaskedArray(ndarray):
masked_array(data = [0 3],
mask = [False False],
fill_value = 999999)
- >>> print x.mini(axis=1)
+ >>> print(x.mini(axis=1))
[0 2 4]
"""
@@ -5741,11 +5741,11 @@ class MaskedArray(ndarray):
Examples
--------
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
- >>> print x
+ >>> print(x)
[[1 -- 3]
[-- 5 --]
[7 -- 9]]
- >>> print x.toflex()
+ >>> print(x.toflex())
[[(1, False) (2, True) (3, False)]
[(4, True) (5, False) (6, True)]
[(7, False) (8, True) (9, False)]]
@@ -6914,14 +6914,14 @@ def where(condition, x=_NoValue, y=_NoValue):
>>> x = np.ma.array(np.arange(9.).reshape(3, 3), mask=[[0, 1, 0],
... [1, 0, 1],
... [0, 1, 0]])
- >>> print x
+ >>> print(x)
[[0.0 -- 2.0]
[-- 4.0 --]
[6.0 -- 8.0]]
>>> np.ma.where(x > 5) # return the indices where x > 5
(array([2, 2]), array([0, 2]))
- >>> print np.ma.where(x > 5, x, -3.1416)
+ >>> print(np.ma.where(x > 5, x, -3.1416))
[[-3.1416 -- -3.1416]
[-- -3.1416 --]
[6.0 -- 8.0]]
diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py
index e1d228e73..9855b4e76 100644
--- a/numpy/ma/extras.py
+++ b/numpy/ma/extras.py
@@ -439,7 +439,7 @@ if apply_over_axes.__doc__ is not None:
>>> a = ma.arange(24).reshape(2,3,4)
>>> a[:,0,1] = ma.masked
>>> a[:,1,:] = ma.masked
- >>> print a
+ >>> print(a)
[[[0 -- 2 3]
[-- -- -- --]
[8 9 10 11]]
@@ -447,14 +447,14 @@ if apply_over_axes.__doc__ is not None:
[[12 -- 14 15]
[-- -- -- --]
[20 21 22 23]]]
- >>> print ma.apply_over_axes(ma.sum, a, [0,2])
+ >>> print(ma.apply_over_axes(ma.sum, a, [0,2]))
[[[46]
[--]
[124]]]
Tuple axis arguments to ufuncs are equivalent:
- >>> print ma.sum(a, axis=(0,2)).reshape((1,-1,1))
+ >>> print(ma.sum(a, axis=(0,2)).reshape((1,-1,1)))
[[[46]
[--]
[124]]]
@@ -502,13 +502,13 @@ def average(a, axis=None, weights=None, returned=False):
1.25
>>> x = np.ma.arange(6.).reshape(3, 2)
- >>> print x
+ >>> print(x)
[[ 0. 1.]
[ 2. 3.]
[ 4. 5.]]
>>> avg, sumweights = np.ma.average(x, axis=0, weights=[1, 2, 3],
... returned=True)
- >>> print avg
+ >>> print(avg)
[2.66666666667 3.66666666667]
"""
@@ -1476,7 +1476,7 @@ def flatnotmasked_edges(a):
array([3, 8])
>>> a[:] = np.ma.masked
- >>> print flatnotmasked_edges(ma)
+ >>> print(flatnotmasked_edges(ma))
None
"""
@@ -1578,7 +1578,7 @@ def flatnotmasked_contiguous(a):
>>> np.ma.flatnotmasked_contiguous(a)
[slice(3, 5, None), slice(6, 9, None)]
>>> a[:] = np.ma.masked
- >>> print np.ma.flatnotmasked_edges(a)
+ >>> print(np.ma.flatnotmasked_edges(a))
None
"""
diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py
index a32f358c0..6ce29cc03 100644
--- a/numpy/ma/tests/test_old_ma.py
+++ b/numpy/ma/tests/test_old_ma.py
@@ -522,11 +522,6 @@ class TestMa(TestCase):
self.assertTrue(str(masked) == '--')
self.assertTrue(xx[1] is masked)
self.assertEqual(filled(xx[1], 0), 0)
- # don't know why these should raise an exception...
- #self.assertRaises(Exception, lambda x,y: x+y, masked, masked)
- #self.assertRaises(Exception, lambda x,y: x+y, masked, 2)
- #self.assertRaises(Exception, lambda x,y: x+y, masked, xx)
- #self.assertRaises(Exception, lambda x,y: x+y, xx, masked)
def test_testAverage1(self):
# Test of average.
@@ -681,9 +676,7 @@ class TestUfuncs(TestCase):
'arccosh',
'arctanh',
'absolute', 'fabs', 'negative',
- # 'nonzero', 'around',
'floor', 'ceil',
- # 'sometrue', 'alltrue',
'logical_not',
'add', 'subtract', 'multiply',
'divide', 'true_divide', 'floor_divide',
@@ -754,7 +747,6 @@ class TestArrayMethods(TestCase):
self.d = (x, X, XX, m, mx, mX, mXX)
- #------------------------------------------------------
def test_trace(self):
(x, X, XX, m, mx, mX, mXX,) = self.d
mXdiag = mX.diagonal()
@@ -825,55 +817,5 @@ def eqmask(m1, m2):
return m1 is nomask
return (m1 == m2).all()
-#def timingTest():
-# for f in [testf, testinplace]:
-# for n in [1000,10000,50000]:
-# t = testta(n, f)
-# t1 = testtb(n, f)
-# t2 = testtc(n, f)
-# print f.test_name
-# print """\
-#n = %7d
-#numpy time (ms) %6.1f
-#MA maskless ratio %6.1f
-#MA masked ratio %6.1f
-#""" % (n, t*1000.0, t1/t, t2/t)
-
-#def testta(n, f):
-# x=np.arange(n) + 1.0
-# tn0 = time.time()
-# z = f(x)
-# return time.time() - tn0
-
-#def testtb(n, f):
-# x=arange(n) + 1.0
-# tn0 = time.time()
-# z = f(x)
-# return time.time() - tn0
-
-#def testtc(n, f):
-# x=arange(n) + 1.0
-# x[0] = masked
-# tn0 = time.time()
-# z = f(x)
-# return time.time() - tn0
-
-#def testf(x):
-# for i in range(25):
-# y = x **2 + 2.0 * x - 1.0
-# w = x **2 + 1.0
-# z = (y / w) ** 2
-# return z
-#testf.test_name = 'Simple arithmetic'
-
-#def testinplace(x):
-# for i in range(25):
-# y = x**2
-# y += 2.0*x
-# y -= 1.0
-# y /= x
-# return y
-#testinplace.test_name = 'Inplace operations'
-
if __name__ == "__main__":
run_module_suite()
diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py
index 170db87c8..134f4d203 100644
--- a/numpy/matrixlib/defmatrix.py
+++ b/numpy/matrixlib/defmatrix.py
@@ -233,7 +233,7 @@ class matrix(N.ndarray):
Examples
--------
>>> a = np.matrix('1 2; 3 4')
- >>> print a
+ >>> print(a)
[[1 2]
[3 4]]
diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py
index df3d297ff..6cde298e1 100644
--- a/numpy/testing/decorators.py
+++ b/numpy/testing/decorators.py
@@ -48,7 +48,7 @@ def slow(t):
@dec.slow
def test_big(self):
- print 'Big, slow test'
+ print('Big, slow test')
"""
diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py
index 197e20bac..ee9d1b4df 100644
--- a/numpy/testing/noseclasses.py
+++ b/numpy/testing/noseclasses.py
@@ -34,33 +34,24 @@ class NumpyDocTestFinder(doctest.DocTestFinder):
module.
"""
if module is None:
- #print '_fm C1' # dbg
return True
elif inspect.isfunction(object):
- #print '_fm C2' # dbg
return module.__dict__ is object.__globals__
elif inspect.isbuiltin(object):
- #print '_fm C2-1' # dbg
return module.__name__ == object.__module__
elif inspect.isclass(object):
- #print '_fm C3' # dbg
return module.__name__ == object.__module__
elif inspect.ismethod(object):
# This one may be a bug in cython that fails to correctly set the
# __module__ attribute of methods, but since the same error is easy
# to make by extension code writers, having this safety in place
# isn't such a bad idea
- #print '_fm C3-1' # dbg
return module.__name__ == object.__self__.__class__.__module__
elif inspect.getmodule(object) is not None:
- #print '_fm C4' # dbg
- #print 'C4 mod',module,'obj',object # dbg
return module is inspect.getmodule(object)
elif hasattr(object, '__module__'):
- #print '_fm C5' # dbg
return module.__name__ == object.__module__
elif isinstance(object, property):
- #print '_fm C6' # dbg
return True # [XX] no way not be sure.
else:
raise ValueError("object must be a class or function")
@@ -95,10 +86,7 @@ class NumpyDocTestFinder(doctest.DocTestFinder):
# Look for tests in a class's contained objects.
if isclass(obj) and self._recurse:
- #print 'RECURSE into class:',obj # dbg
for valname, val in obj.__dict__.items():
- #valname1 = '%s.%s' % (name, valname) # dbg
- #print 'N',name,'VN:',valname,'val:',str(val)[:77] # dbg
# Special handling for staticmethod/classmethod.
if isinstance(val, staticmethod):
val = getattr(obj, valname)
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index e85e2f95f..0c4ebe1b9 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -1293,7 +1293,7 @@ def measure(code_str,times=1,label=None):
--------
>>> etime = np.testing.measure('for i in range(1000): np.sqrt(i**2)',
... times=times)
- >>> print "Time for a single execution : ", etime / times, "s"
+ >>> print("Time for a single execution : ", etime / times, "s")
Time for a single execution : 0.005 s
"""
diff --git a/tools/swig/test/testFortran.py b/tools/swig/test/testFortran.py
index be4134d4e..b7783be90 100644
--- a/tools/swig/test/testFortran.py
+++ b/tools/swig/test/testFortran.py
@@ -24,16 +24,6 @@ class FortranTestCase(unittest.TestCase):
self.typeStr = "double"
self.typeCode = "d"
- # This test used to work before the update to avoid deprecated code. Now it
- # doesn't work. As best I can tell, it never should have worked, so I am
- # commenting it out. --WFS
- # def testSecondElementContiguous(self):
- # "Test Fortran matrix initialized from reshaped default array"
- # print >>sys.stderr, self.typeStr, "... ",
- # second = Fortran.__dict__[self.typeStr + "SecondElement"]
- # matrix = np.arange(9).reshape(3, 3).astype(self.typeCode)
- # self.assertEquals(second(matrix), 3)
-
# Test (type* IN_FARRAY2, int DIM1, int DIM2) typemap
def testSecondElementFortran(self):
"Test Fortran matrix initialized from reshaped NumPy fortranarray"
diff --git a/tools/win32build/misc/x86analysis.py b/tools/win32build/misc/x86analysis.py
index 39b7cca79..870e2c980 100644
--- a/tools/win32build/misc/x86analysis.py
+++ b/tools/win32build/misc/x86analysis.py
@@ -132,8 +132,6 @@ def cntset(seq):
return cnt
def main():
- #parser = optparse.OptionParser()
- #parser.add_option("-f", "--filename
args = sys.argv[1:]
filename = args[0]
analyse(filename)
@@ -146,11 +144,6 @@ def analyse(filename):
sse = has_sse(inst)
sse2 = has_sse2(inst)
sse3 = has_sse3(inst)
- #mmx = has_mmx(inst)
- #ppro = has_ppro(inst)
- #print sse
- #print sse2
- #print sse3
print("SSE3 inst %d" % cntset(sse3))
print("SSE2 inst %d" % cntset(sse2))
print("SSE inst %d" % cntset(sse))
@@ -158,5 +151,3 @@ def analyse(filename):
if __name__ == '__main__':
main()
- #filename = "/usr/lib/sse2/libatlas.a"
- ##filename = "/usr/lib/sse2/libcblas.a"