diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
commit | bb726ca19f434f5055c0efceefe48d89469fcbbe (patch) | |
tree | 889782afaf67fd5acb5f222969251871c0c46e5a /numpy/ma | |
parent | 7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff) | |
download | numpy-bb726ca19f434f5055c0efceefe48d89469fcbbe.tar.gz |
2to3: Apply `print` fixer.
Add `print_function` to all `from __future__ import ...` statements
and use the python3 print function syntax everywhere.
Closes #3078.
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/__init__.py | 2 | ||||
-rw-r--r-- | numpy/ma/bench.py | 42 | ||||
-rw-r--r-- | numpy/ma/core.py | 2 | ||||
-rw-r--r-- | numpy/ma/extras.py | 2 | ||||
-rw-r--r-- | numpy/ma/mrecords.py | 2 | ||||
-rw-r--r-- | numpy/ma/setup.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_extras.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_mrecords.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_old_ma.py | 6 | ||||
-rw-r--r-- | numpy/ma/tests/test_regression.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_subclassing.py | 2 | ||||
-rw-r--r-- | numpy/ma/testutils.py | 2 | ||||
-rw-r--r-- | numpy/ma/timer_comparison.py | 8 | ||||
-rw-r--r-- | numpy/ma/version.py | 2 |
15 files changed, 40 insertions, 40 deletions
diff --git a/numpy/ma/__init__.py b/numpy/ma/__init__.py index 3113e538c..0cb92f667 100644 --- a/numpy/ma/__init__.py +++ b/numpy/ma/__init__.py @@ -36,7 +36,7 @@ may now proceed to calculate the mean of the other values: invalid operation. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/bench.py b/numpy/ma/bench.py index 7500245c3..b8d085130 100644 --- a/numpy/ma/bench.py +++ b/numpy/ma/bench.py @@ -1,6 +1,6 @@ #! python # encoding: utf-8 -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import timeit #import IPython.ipapi @@ -42,7 +42,7 @@ nmzl = numpy.ma.array(zl, mask=maskx) def timer(s, v='', nloop=500, nrep=3): units = ["s", "ms", "µs", "ns"] scaling = [1, 1e3, 1e6, 1e9] - print "%s : %-50s : " % (v,s), + print("%s : %-50s : " % (v,s), end=' ') varnames = ["%ss,nm%ss,%sl,nm%sl" % tuple(x*4) for x in 'xyz'] setup = 'from __main__ import numpy, ma, %s' % ','.join(varnames) Timer = timeit.Timer(stmt=s, setup=setup) @@ -51,10 +51,10 @@ def timer(s, v='', nloop=500, nrep=3): order = min(-int(numpy.floor(numpy.log10(best)) // 3), 3) else: order = 3 - print "%d loops, best of %d: %.*g %s per loop" % (nloop, nrep, + print("%d loops, best of %d: %.*g %s per loop" % (nloop, nrep, 3, best * scaling[order], - units[order]) + units[order])) # ip.magic('timeit -n%i %s' % (nloop,s)) @@ -62,24 +62,24 @@ def timer(s, v='', nloop=500, nrep=3): def compare_functions_1v(func, nloop=500, xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl): funcname = func.__name__ - print "-"*50 - print "%s on small arrays" % funcname + print("-"*50) + print("%s on small arrays" % funcname) module, data = "numpy.ma","nmxs" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) # - print "%s on large arrays" % funcname + print("%s on large arrays" % funcname) module, data = "numpy.ma","nmxl" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) return def compare_methods(methodname, args, vars='x', nloop=500, test=True, xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl): - print "-"*50 - print "%s on small arrays" % methodname + print("-"*50) + print("%s on small arrays" % methodname) data, ver = "nm%ss" % vars, 'numpy.ma' timer("%(data)s.%(methodname)s(%(args)s)" % locals(), v=ver, nloop=nloop) # - print "%s on large arrays" % methodname + print("%s on large arrays" % methodname) data, ver = "nm%sl" % vars, 'numpy.ma' timer("%(data)s.%(methodname)s(%(args)s)" % locals(), v=ver, nloop=nloop) return @@ -90,12 +90,12 @@ def compare_functions_2v(func, nloop=500, test=True, xl=xl, nmxl=nmxl, yl=yl, nmyl=nmyl): funcname = func.__name__ - print "-"*50 - print "%s on small arrays" % funcname + print("-"*50) + print("%s on small arrays" % funcname) module, data = "numpy.ma","nmxs,nmys" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) # - print "%s on large arrays" % funcname + print("%s on large arrays" % funcname) module, data = "numpy.ma","nmxl,nmyl" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) return @@ -149,18 +149,18 @@ if __name__ == '__main__': compare_methods('__setitem__','0, 17', nloop=1000, test=False) compare_methods('__setitem__','(0,0), 17', nloop=1000, test=False) #.................................................................... - print "-"*50 - print "__setitem__ on small arrays" + print("-"*50) + print("__setitem__ on small arrays") timer('nmxs.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ',nloop=10000) - print "-"*50 - print "__setitem__ on large arrays" + print("-"*50) + print("__setitem__ on large arrays") timer('nmxl.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ',nloop=10000) #.................................................................... - print "-"*50 - print "where on small arrays" + print("-"*50) + print("where on small arrays") timer('numpy.ma.where(nmxs>2,nmxs,nmys)', 'numpy.ma ',nloop=1000) - print "-"*50 - print "where on large arrays" + print("-"*50) + print("where on large arrays") timer('numpy.ma.where(nmxl>2,nmxl,nmyl)', 'numpy.ma ',nloop=100) diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 64cfafe7c..dbabc37ac 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -20,7 +20,7 @@ Released for unlimited redistribution. """ # pylint: disable-msg=E1002 -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import sys import warnings diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index a22152729..a809db53c 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -8,7 +8,7 @@ A collection of utilities for `numpy.ma`. :version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py index ae31986bc..942b4fe81 100644 --- a/numpy/ma/mrecords.py +++ b/numpy/ma/mrecords.py @@ -8,7 +8,7 @@ and the masking of individual fields. :author: Pierre Gerard-Marchant """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function #!!!: * We should make sure that no field is called '_mask','mask','_fieldmask', #!!!: or whatever restricted keywords. diff --git a/numpy/ma/setup.py b/numpy/ma/setup.py index 2191d23f4..2175628d6 100644 --- a/numpy/ma/setup.py +++ b/numpy/ma/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 7eb4bbed2..d2f1bb6b9 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -4,7 +4,7 @@ :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant" diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index c32e689c3..b6643fc4d 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -7,7 +7,7 @@ Adapted from the original test_ma by Pierre Gerard-Marchant :version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py index 3b9296a04..515263fb2 100644 --- a/numpy/ma/tests/test_mrecords.py +++ b/numpy/ma/tests/test_mrecords.py @@ -5,7 +5,7 @@ :contact: pierregm_at_uga_dot_edu """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import sys import warnings diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py index 41f7779d9..64d3ec683 100644 --- a/numpy/ma/tests/test_old_ma.py +++ b/numpy/ma/tests/test_old_ma.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import numpy import types @@ -15,10 +15,10 @@ pi = numpy.pi def eq(v, w, msg=''): result = allclose(v, w) if not result: - print """Not eq:%s + print("""Not eq:%s %s ---- -%s""" % (msg, str(v), str(w)) +%s""" % (msg, str(v), str(w))) return result class TestMa(TestCase): diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index e5fea0c52..917c53969 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function from numpy.testing import * import numpy as np diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py index 6b8ff0769..ab0caf96b 100644 --- a/numpy/ma/tests/test_subclassing.py +++ b/numpy/ma/tests/test_subclassing.py @@ -6,7 +6,7 @@ :version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index 882db2b89..feff3e879 100644 --- a/numpy/ma/testutils.py +++ b/numpy/ma/testutils.py @@ -5,7 +5,7 @@ :version: $Id: testutils.py 3529 2007-11-13 08:01:14Z jarrod.millman $ """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = "1.0" diff --git a/numpy/ma/timer_comparison.py b/numpy/ma/timer_comparison.py index 549448689..80a93c53b 100644 --- a/numpy/ma/timer_comparison.py +++ b/numpy/ma/timer_comparison.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import timeit @@ -452,9 +452,9 @@ if __name__ == '__main__': cur = np.sort(cur) # alt = np.sort(alt) # tmp = np.sort(tmp) - print "#%i" % i +50*'.' - print eval("moduletester.test_%i.__doc__" % i) + print("#%i" % i +50*'.') + print(eval("moduletester.test_%i.__doc__" % i)) # print "core_ini : %.3f - %.3f" % (new[0], new[1]) - print "core_current : %.3f - %.3f" % (cur[0], cur[1]) + print("core_current : %.3f - %.3f" % (cur[0], cur[1])) # print "core_alt : %.3f - %.3f" % (alt[0], alt[1]) # print "core_tmp : %.3f - %.3f" % (tmp[0], tmp[1]) diff --git a/numpy/ma/version.py b/numpy/ma/version.py index cf9a95572..a2c5c42a8 100644 --- a/numpy/ma/version.py +++ b/numpy/ma/version.py @@ -1,7 +1,7 @@ """Version number """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function version = '1.00' release = False |