Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

2to3: Apply `print` fixer.

Add `print_function` to all `from __future__ import ...` statements
and use the python3 print function syntax everywhere.

Closes #3078.
  • Loading branch information...
commit bb726ca19f434f5055c0efceefe48d89469fcbbe 1 parent 7441fa5
@charris charris authored
Showing with 621 additions and 627 deletions.
  1. +1 −1  doc/cdoc/numpyfilter.py
  2. +1 −1  doc/cython/run_test.py
  3. +1 −1  doc/cython/setup.py
  4. +1 −1  doc/example.py
  5. +3 −3 doc/newdtype_example/example.py
  6. +1 −1  doc/newdtype_example/floatint/__init__.py
  7. +1 −1  doc/newdtype_example/setup.py
  8. +1 −1  doc/numpybook/comparison/ctypes/filter.py
  9. +1 −1  doc/numpybook/comparison/ctypes/interface.py
  10. +1 −1  doc/numpybook/comparison/pyrex/setup.py
  11. +3 −3 doc/numpybook/comparison/timing.py
  12. +1 −1  doc/numpybook/comparison/weave/filter.py
  13. +3 −3 doc/numpybook/comparison/weave/inline.py
  14. +7 −7 doc/numpybook/runcode.py
  15. +1 −1  doc/postprocess.py
  16. +1 −1  doc/pyrex/run_test.py
  17. +1 −1  doc/pyrex/setup.py
  18. +1 −1  doc/source/conf.py
  19. +1 −1  doc/sphinxext/numpydoc/__init__.py
  20. +1 −1  doc/sphinxext/numpydoc/comment_eater.py
  21. +1 −1  doc/sphinxext/numpydoc/compiler_unparse.py
  22. +1 −6 doc/sphinxext/numpydoc/docscrape.py
  23. +1 −1  doc/sphinxext/numpydoc/docscrape_sphinx.py
  24. +1 −1  doc/sphinxext/numpydoc/linkcode.py
  25. +1 −1  doc/sphinxext/numpydoc/numpydoc.py
  26. +1 −1  doc/sphinxext/numpydoc/phantom_import.py
  27. +1 −1  doc/sphinxext/numpydoc/plot_directive.py
  28. +1 −1  doc/sphinxext/numpydoc/tests/test_docscrape.py
  29. +1 −1  doc/sphinxext/numpydoc/tests/test_linkcode.py
  30. +1 −1  doc/sphinxext/numpydoc/tests/test_phantom_import.py
  31. +1 −1  doc/sphinxext/numpydoc/tests/test_plot_directive.py
  32. +1 −1  doc/sphinxext/numpydoc/tests/test_traitsdoc.py
  33. +1 −1  doc/sphinxext/numpydoc/traitsdoc.py
  34. +1 −1  doc/sphinxext/setup.py
  35. +12 −12 doc/summarize.py
  36. +1 −1  doc/swig/test/setup.py
  37. +4 −4 doc/swig/test/testArray.py
  38. +4 −4 doc/swig/test/testFarray.py
  39. +7 −7 doc/swig/test/testFortran.py
  40. +31 −31 doc/swig/test/testMatrix.py
  41. +31 −31 doc/swig/test/testTensor.py
  42. +35 −35 doc/swig/test/testVector.py
  43. +1 −1  numpy/__init__.py
  44. +6 −6 numpy/_import_tools.py
  45. +1 −1  numpy/add_newdocs.py
  46. +1 −1  numpy/build_utils/__init__.py
  47. +1 −1  numpy/build_utils/common.py
  48. +1 −1  numpy/build_utils/waf.py
  49. +1 −1  numpy/compat/__init__.py
  50. +7 −7 numpy/compat/_inspect.py
  51. +1 −1  numpy/compat/py3k.py
  52. +1 −1  numpy/compat/setup.py
  53. +1 −1  numpy/core/__init__.py
  54. +1 −1  numpy/core/_internal.py
  55. +1 −1  numpy/core/_methods.py
  56. +1 −1  numpy/core/arrayprint.py
  57. +1 −1  numpy/core/code_generators/__init__.py
  58. +2 −2 numpy/core/code_generators/cversions.py
  59. +4 −4 numpy/core/code_generators/genapi.py
  60. +1 −1  numpy/core/code_generators/generate_numpy_api.py
  61. +1 −1  numpy/core/code_generators/generate_ufunc_api.py
  62. +1 −1  numpy/core/code_generators/generate_umath.py
  63. +1 −1  numpy/core/code_generators/numpy_api.py
  64. +1 −1  numpy/core/code_generators/ufunc_docstrings.py
  65. +1 −1  numpy/core/defchararray.py
  66. +1 −1  numpy/core/fromnumeric.py
  67. +1 −1  numpy/core/function_base.py
  68. +7 −7 numpy/core/getlimits.py
  69. +1 −1  numpy/core/info.py
  70. +2 −2 numpy/core/machar.py
  71. +1 −1  numpy/core/memmap.py
  72. +1 −1  numpy/core/numeric.py
  73. +1 −1  numpy/core/numerictypes.py
  74. +1 −1  numpy/core/records.py
  75. +2 −2 numpy/core/setup.py
  76. +1 −1  numpy/core/setup_common.py
  77. +1 −1  numpy/core/shape_base.py
  78. +1 −1  numpy/core/src/multiarray/testcalcs.py
  79. +1 −1  numpy/core/tests/test_api.py
  80. +1 −1  numpy/core/tests/test_arrayprint.py
  81. +1 −1  numpy/core/tests/test_blasdot.py
  82. +1 −1  numpy/core/tests/test_datetime.py
  83. +1 −1  numpy/core/tests/test_defchararray.py
  84. +1 −1  numpy/core/tests/test_deprecations.py
  85. +1 −1  numpy/core/tests/test_dtype.py
  86. +1 −1  numpy/core/tests/test_einsum.py
  87. +1 −1  numpy/core/tests/test_errstate.py
  88. +1 −1  numpy/core/tests/test_function_base.py
  89. +1 −1  numpy/core/tests/test_getlimits.py
  90. +1 −1  numpy/core/tests/test_half.py
  91. +1 −1  numpy/core/tests/test_indexerrors.py
  92. +1 −1  numpy/core/tests/test_indexing.py
  93. +1 −1  numpy/core/tests/test_item_selection.py
  94. +1 −1  numpy/core/tests/test_machar.py
  95. +1 −1  numpy/core/tests/test_memmap.py
  96. +1 −1  numpy/core/tests/test_multiarray.py
  97. +1 −1  numpy/core/tests/test_multiarray_assignment.py
  98. +1 −1  numpy/core/tests/test_nditer.py
  99. +1 −1  numpy/core/tests/test_numeric.py
  100. +1 −1  numpy/core/tests/test_numerictypes.py
  101. +4 −4 numpy/core/tests/test_print.py
  102. +1 −1  numpy/core/tests/test_records.py
  103. +1 −1  numpy/core/tests/test_regression.py
  104. +1 −1  numpy/core/tests/test_scalarmath.py
  105. +1 −1  numpy/core/tests/test_scalarprint.py
  106. +1 −1  numpy/core/tests/test_shape_base.py
  107. +1 −1  numpy/core/tests/test_ufunc.py
  108. +1 −1  numpy/core/tests/test_umath.py
  109. +1 −1  numpy/core/tests/test_umath_complex.py
  110. +1 −1  numpy/core/tests/test_unicode.py
  111. +1 −1  numpy/ctypeslib.py
  112. +1 −1  numpy/distutils/__init__.py
  113. +1 −1  numpy/distutils/__version__.py
  114. +1 −1  numpy/distutils/ccompiler.py
  115. +1 −1  numpy/distutils/command/__init__.py
  116. +1 −1  numpy/distutils/command/autodist.py
  117. +1 −1  numpy/distutils/command/bdist_rpm.py
  118. +1 −1  numpy/distutils/command/build.py
  119. +1 −1  numpy/distutils/command/build_clib.py
  120. +1 −1  numpy/distutils/command/build_ext.py
  121. +1 −1  numpy/distutils/command/build_py.py
  122. +1 −1  numpy/distutils/command/build_scripts.py
  123. +1 −1  numpy/distutils/command/build_src.py
  124. +1 −1  numpy/distutils/command/config.py
  125. +1 −1  numpy/distutils/command/config_compiler.py
  126. +1 −1  numpy/distutils/command/develop.py
  127. +1 −1  numpy/distutils/command/egg_info.py
  128. +1 −1  numpy/distutils/command/install.py
  129. +1 −1  numpy/distutils/command/install_clib.py
  130. +1 −1  numpy/distutils/command/install_data.py
  131. +1 −1  numpy/distutils/command/install_headers.py
  132. +1 −1  numpy/distutils/command/sdist.py
  133. +1 −1  numpy/distutils/compat.py
  134. +3 −3 numpy/distutils/conv_template.py
  135. +1 −1  numpy/distutils/core.py
  136. +1 −1  numpy/distutils/cpuinfo.py
  137. +1 −1  numpy/distutils/environment.py
  138. +1 −1  numpy/distutils/exec_command.py
  139. +1 −1  numpy/distutils/extension.py
  140. +1 −1  numpy/distutils/fcompiler/__init__.py
  141. +1 −1  numpy/distutils/fcompiler/absoft.py
  142. +1 −1  numpy/distutils/fcompiler/compaq.py
  143. +1 −1  numpy/distutils/fcompiler/g95.py
  144. +1 −1  numpy/distutils/fcompiler/gnu.py
  145. +1 −1  numpy/distutils/fcompiler/hpux.py
  146. +1 −1  numpy/distutils/fcompiler/ibm.py
  147. +1 −1  numpy/distutils/fcompiler/intel.py
  148. +1 −1  numpy/distutils/fcompiler/lahey.py
  149. +1 −1  numpy/distutils/fcompiler/mips.py
  150. +1 −1  numpy/distutils/fcompiler/nag.py
  151. +1 −1  numpy/distutils/fcompiler/none.py
  152. +2 −2 numpy/distutils/fcompiler/pathf95.py
  153. +3 −3 numpy/distutils/fcompiler/pg.py
  154. +1 −1  numpy/distutils/fcompiler/sun.py
  155. +1 −1  numpy/distutils/fcompiler/vast.py
  156. +5 −6 numpy/distutils/from_template.py
  157. +1 −1  numpy/distutils/info.py
  158. +1 −1  numpy/distutils/intelccompiler.py
  159. +3 −3 numpy/distutils/lib2def.py
  160. +9 −9 numpy/distutils/line_endings.py
  161. +1 −1  numpy/distutils/log.py
  162. +2 −2 numpy/distutils/mingw32ccompiler.py
  163. +7 −7 numpy/distutils/misc_util.py
  164. +6 −6 numpy/distutils/npy_pkg_config.py
  165. +1 −1  numpy/distutils/numpy_distribution.py
  166. +1 −1  numpy/distutils/pathccompiler.py
  167. +1 −1  numpy/distutils/setup.py
  168. +1 −1  numpy/distutils/system_info.py
  169. +1 −1  numpy/distutils/tests/f2py_ext/__init__.py
  170. +1 −1  numpy/distutils/tests/f2py_ext/setup.py
  171. +1 −1  numpy/distutils/tests/f2py_ext/tests/test_fib2.py
  172. +1 −1  numpy/distutils/tests/f2py_f90_ext/__init__.py
  173. +1 −1  numpy/distutils/tests/f2py_f90_ext/setup.py
  174. +1 −1  numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py
  175. +1 −1  numpy/distutils/tests/gen_ext/__init__.py
  176. +1 −1  numpy/distutils/tests/gen_ext/setup.py
  177. +1 −1  numpy/distutils/tests/gen_ext/tests/test_fib3.py
  178. +1 −1  numpy/distutils/tests/pyrex_ext/__init__.py
  179. +1 −1  numpy/distutils/tests/pyrex_ext/setup.py
  180. +1 −1  numpy/distutils/tests/pyrex_ext/tests/test_primes.py
  181. +1 −1  numpy/distutils/tests/setup.py
  182. +1 −1  numpy/distutils/tests/swig_ext/__init__.py
  183. +1 −1  numpy/distutils/tests/swig_ext/setup.py
  184. +1 −1  numpy/distutils/tests/swig_ext/tests/test_example.py
  185. +1 −1  numpy/distutils/tests/swig_ext/tests/test_example2.py
  186. +1 −1  numpy/distutils/tests/test_exec_command.py
  187. +1 −1  numpy/distutils/tests/test_fcompiler_gnu.py
  188. +1 −1  numpy/distutils/tests/test_fcompiler_intel.py
  189. +1 −1  numpy/distutils/tests/test_misc_util.py
  190. +1 −1  numpy/distutils/tests/test_npy_pkg_config.py
  191. +1 −1  numpy/distutils/unixccompiler.py
  192. +1 −1  numpy/doc/__init__.py
  193. +1 −1  numpy/doc/basics.py
  194. +1 −1  numpy/doc/broadcasting.py
  195. +1 −1  numpy/doc/byteswapping.py
  196. +1 −1  numpy/doc/constants.py
  197. +1 −1  numpy/doc/creation.py
  198. +1 −1  numpy/doc/glossary.py
  199. +1 −1  numpy/doc/howtofind.py
  200. +1 −1  numpy/doc/indexing.py
  201. +1 −1  numpy/doc/internals.py
  202. +1 −1  numpy/doc/io.py
  203. +1 −1  numpy/doc/jargon.py
  204. +1 −1  numpy/doc/methods_vs_functions.py
  205. +1 −1  numpy/doc/misc.py
  206. +1 −1  numpy/doc/performance.py
  207. +1 −1  numpy/doc/structured_arrays.py
  208. +1 −1  numpy/doc/subclassing.py
  209. +1 −1  numpy/doc/ufuncs.py
  210. +1 −1  numpy/dual.py
  211. +1 −1  numpy/f2py/__init__.py
  212. +1 −1  numpy/f2py/__version__.py
  213. +1 −1  numpy/f2py/auxfuncs.py
  214. +1 −1  numpy/f2py/capi_maps.py
  215. +1 −1  numpy/f2py/cb_rules.py
  216. +2 −2 numpy/f2py/cfuncs.py
  217. +1 −1  numpy/f2py/common_rules.py
  218. +5 −5 numpy/f2py/crackfortran.py
  219. +68 −68 numpy/f2py/diagnose.py
  220. +7 −7 numpy/f2py/doc/collectinput.py
  221. +1 −1  numpy/f2py/docs/pytest.py
  222. +1 −1  numpy/f2py/docs/usersguide/setup_example.py
  223. +5 −5 numpy/f2py/f2py2e.py
  224. +7 −7 numpy/f2py/f2py_testing.py
  225. +2 −2 numpy/f2py/f90mod_rules.py
  226. +1 −1  numpy/f2py/func2subr.py
  227. +1 −1  numpy/f2py/info.py
  228. +1 −1  numpy/f2py/rules.py
  229. +1 −1  numpy/f2py/setup.py
  230. +1 −1  numpy/f2py/tests/test_array_from_pyobj.py
  231. +1 −1  numpy/f2py/tests/test_assumed_shape.py
  232. +1 −1  numpy/f2py/tests/test_callback.py
  233. +1 −1  numpy/f2py/tests/test_kind.py
  234. +1 −1  numpy/f2py/tests/test_mixed.py
  235. +1 −1  numpy/f2py/tests/test_return_character.py
  236. +1 −1  numpy/f2py/tests/test_return_complex.py
  237. +1 −1  numpy/f2py/tests/test_return_integer.py
  238. +1 −1  numpy/f2py/tests/test_return_logical.py
  239. +1 −1  numpy/f2py/tests/test_return_real.py
  240. +1 −1  numpy/f2py/tests/test_size.py
  241. +1 −1  numpy/f2py/tests/util.py
  242. +2 −2 numpy/f2py/use_rules.py
  243. +1 −1  numpy/fft/__init__.py
  244. +1 −1  numpy/fft/fftpack.py
  245. +1 −1  numpy/fft/helper.py
  246. +1 −1  numpy/fft/info.py
  247. +1 −1  numpy/fft/setup.py
  248. +1 −1  numpy/fft/tests/test_fftpack.py
  249. +1 −1  numpy/fft/tests/test_helper.py
  250. +1 −1  numpy/lib/__init__.py
  251. +1 −1  numpy/lib/_datasource.py
  252. +1 −1  numpy/lib/_iotools.py
  253. +1 −1  numpy/lib/arraypad.py
  254. +1 −1  numpy/lib/arraysetops.py
  255. +1 −1  numpy/lib/arrayterator.py
  256. +1 −1  numpy/lib/financial.py
  257. +1 −1  numpy/lib/format.py
  258. +1 −1  numpy/lib/function_base.py
  259. +1 −1  numpy/lib/index_tricks.py
  260. +1 −1  numpy/lib/info.py
  261. +1 −1  numpy/lib/npyio.py
  262. +1 −1  numpy/lib/polynomial.py
  263. +1 −1  numpy/lib/recfunctions.py
  264. +1 −1  numpy/lib/scimath.py
  265. +1 −1  numpy/lib/setup.py
  266. +1 −1  numpy/lib/shape_base.py
  267. +1 −1  numpy/lib/stride_tricks.py
  268. +1 −1  numpy/lib/tests/test__datasource.py
  269. +1 −1  numpy/lib/tests/test__iotools.py
  270. +1 −1  numpy/lib/tests/test_arraypad.py
  271. +1 −1  numpy/lib/tests/test_arraysetops.py
  272. +1 −1  numpy/lib/tests/test_arrayterator.py
  273. +1 −1  numpy/lib/tests/test_financial.py
  274. +1 −1  numpy/lib/tests/test_format.py
  275. +1 −1  numpy/lib/tests/test_function_base.py
  276. +1 −1  numpy/lib/tests/test_index_tricks.py
  277. +1 −1  numpy/lib/tests/test_io.py
  278. +1 −1  numpy/lib/tests/test_polynomial.py
  279. +1 −1  numpy/lib/tests/test_recfunctions.py
  280. +1 −1  numpy/lib/tests/test_regression.py
  281. +1 −1  numpy/lib/tests/test_shape_base.py
  282. +1 −1  numpy/lib/tests/test_stride_tricks.py
  283. +1 −1  numpy/lib/tests/test_twodim_base.py
  284. +1 −1  numpy/lib/tests/test_type_check.py
  285. +1 −1  numpy/lib/tests/test_ufunclike.py
  286. +1 −1  numpy/lib/tests/test_utils.py
  287. +1 −1  numpy/lib/twodim_base.py
  288. +1 −1  numpy/lib/type_check.py
  289. +1 −1  numpy/lib/ufunclike.py
  290. +10 −10 numpy/lib/user_array.py
  291. +30 −30 numpy/lib/utils.py
  292. +1 −1  numpy/linalg/__init__.py
  293. +1 −1  numpy/linalg/info.py
  294. +2 −2 numpy/linalg/lapack_lite/clapack_scrub.py
  295. +1 −1  numpy/linalg/lapack_lite/fortran.py
  296. +7 −7 numpy/linalg/lapack_lite/make_lite.py
  297. +1 −1  numpy/linalg/linalg.py
  298. +1 −1  numpy/linalg/setup.py
  299. +1 −1  numpy/linalg/tests/test_build.py
  300. +1 −1  numpy/linalg/tests/test_linalg.py
Sorry, we could not display the entire diff because too many files (422) changed.
View
2  doc/cdoc/numpyfilter.py
@@ -6,7 +6,7 @@
Also, add Doxygen /** and /**< syntax automatically where appropriate.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
import re
View
2  doc/cython/run_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from numpyx import test
test()
View
2  doc/cython/setup.py
@@ -5,7 +5,7 @@
http://cython.org.
"""
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
View
2  doc/example.py
@@ -8,7 +8,7 @@
a line by itself, preferably preceeded by a blank line.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import os # standard library imports first
View
6 doc/newdtype_example/example.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import floatint.floatint as ff
import numpy as np
@@ -12,7 +12,7 @@
# Now, the elements will be the scalar type associated
# with the ndarray.
-print g[0]
-print type(g[1])
+print(g[0])
+print(type(g[1]))
# Now, you need to register ufuncs and more arrfuncs to do useful things...
View
2  doc/newdtype_example/floatint/__init__.py
@@ -1,3 +1,3 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
View
2  doc/newdtype_example/setup.py
@@ -1,4 +1,4 @@
-from __future__ import division
+from __future__ import division, print_function
from numpy.distutils.core import setup
View
2  doc/numpybook/comparison/ctypes/filter.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
__all__ = ['filter2d']
View
2  doc/numpybook/comparison/ctypes/interface.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
__all__ = ['add', 'filter2d']
View
2  doc/numpybook/comparison/pyrex/setup.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
View
6 doc/numpybook/comparison/timing.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import timeit
@@ -54,9 +54,9 @@
for kind in ['f2py']:#['ctypes', 'pyrex', 'weave', 'f2py']:
res[kind] = []
sys.path = ['/Users/oliphant/numpybook/%s' % (kind,)] + path
- print sys.path
+ print(sys.path)
for n in N:
- print "%s - %d" % (kind, n)
+ print("%s - %d" % (kind, n))
t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind,n,n)))
mytime = min(t.repeat(3,100))
res[kind].append(mytime)
View
2  doc/numpybook/comparison/weave/filter.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from scipy import weave, zeros_like
View
6 doc/numpybook/comparison/weave/inline.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from scipy import weave
from numpy import rand, zeros_like
@@ -40,8 +40,8 @@ def arr(a):
return b
a = [None]*10
-print example1(a)
-print a
+print(example1(a))
+print(a)
a = rand(512,512)
b = arr(a)
View
14 doc/numpybook/runcode.py
@@ -14,7 +14,7 @@
-n name of code section (default MyCode)
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
import optparse
@@ -25,8 +25,8 @@
newre = re.compile(r"\\begin_inset Note.*PYNEW\s+\\end_inset", re.DOTALL)
def getoutput(tstr, dic):
- print "\n\nRunning..."
- print tstr,
+ print("\n\nRunning...")
+ print(tstr, end=' ')
tempstr = io.StringIO()
sys.stdout = tempstr
code = compile(tstr, '<input>', 'exec')
@@ -44,8 +44,8 @@ def getoutput(tstr, dic):
else:
res = tempstr.getvalue() + '\n' + repr(res)
if res != '':
- print "\nOutput is"
- print res,
+ print("\nOutput is")
+ print(res, end=' ')
return res
# now find the code in the code segment
@@ -90,7 +90,7 @@ def runpycode(lyxstr, name='MyCode'):
num += 1
if num == 0:
- print "Nothing found for %s" % name
+ print("Nothing found for %s" % name)
return lyxstr
start = 0
@@ -141,7 +141,7 @@ def main(args):
fid = file(args[0])
str = fid.read()
fid.close()
- print "Processing %s" % options.name
+ print("Processing %s" % options.name)
newstr = runpycode(str, options.name)
fid = file(args[0],'w')
fid.write(newstr)
View
2  doc/postprocess.py
@@ -6,7 +6,7 @@
MODE is either 'html' or 'tex'.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import re, optparse
View
2  doc/pyrex/run_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from numpyx import test
test()
View
2  doc/pyrex/setup.py
@@ -12,7 +12,7 @@
http://www.scipy.org/Cookbook/ArrayStruct_and_Pyrex
"""
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
View
2  doc/source/conf.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, os, re
View
2  doc/sphinxext/numpydoc/__init__.py
@@ -1,3 +1,3 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from .numpydoc import setup
View
2  doc/sphinxext/numpydoc/comment_eater.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
if sys.version_info[0] >= 3:
View
2  doc/sphinxext/numpydoc/compiler_unparse.py
@@ -10,7 +10,7 @@
fixme: We may want to move to using _ast trees because the compiler for
them is about 6 times faster than compiler.compile.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add
View
7 doc/sphinxext/numpydoc/docscrape.py
@@ -1,9 +1,8 @@
"""Extract reference documentation from the NumPy source tree.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
-import sys
import inspect
import textwrap
import re
@@ -11,10 +10,6 @@
from warnings import warn
import collections
-if sys.version_info[0] >= 3:
- from io import StringIO
-else:
- from io import StringIO
class Reader(object):
"""A line-based string reader.
View
2  doc/sphinxext/numpydoc/docscrape_sphinx.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import re, inspect, textwrap, pydoc
import sphinx
View
2  doc/sphinxext/numpydoc/linkcode.py
@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import warnings
import collections
View
2  doc/sphinxext/numpydoc/numpydoc.py
@@ -15,7 +15,7 @@
.. [1] https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sphinx
import collections
View
2  doc/sphinxext/numpydoc/phantom_import.py
@@ -14,7 +14,7 @@
.. [1] http://code.google.com/p/pydocweb
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import imp, sys, compiler, types, os, inspect, re
View
2  doc/sphinxext/numpydoc/plot_directive.py
@@ -74,7 +74,7 @@
to make them appear side-by-side, or in floats.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, os, glob, shutil, imp, warnings, re, textwrap, traceback
import sphinx
View
2  doc/sphinxext/numpydoc/tests/test_docscrape.py
@@ -1,5 +1,5 @@
# -*- encoding:utf-8 -*-
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, textwrap
View
2  doc/sphinxext/numpydoc/tests/test_linkcode.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.linkcode
View
2  doc/sphinxext/numpydoc/tests/test_phantom_import.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.phantom_import
View
2  doc/sphinxext/numpydoc/tests/test_plot_directive.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.plot_directive
View
2  doc/sphinxext/numpydoc/tests/test_traitsdoc.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.traitsdoc
View
2  doc/sphinxext/numpydoc/traitsdoc.py
@@ -13,7 +13,7 @@
.. [2] http://code.enthought.com/projects/traits/
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import inspect
import os
View
2  doc/sphinxext/setup.py
@@ -1,4 +1,4 @@
-from __future__ import division
+from __future__ import division, print_function
import setuptools
from distutils.core import setup
View
24 doc/summarize.py
@@ -5,7 +5,7 @@
Show a summary about which Numpy functions are documented and which are not.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import os, glob, re, sys, inspect, optparse
import collections
@@ -78,22 +78,22 @@ def main():
for (filename, section, keyword, toctree) in locations:
in_sections.setdefault((filename, section, keyword), []).append(name)
- print "Documented"
- print "==========\n"
+ print("Documented")
+ print("==========\n")
last_filename = None
for (filename, section, keyword), names in sorted(in_sections.items()):
if filename != last_filename:
- print "--- %s\n" % filename
+ print("--- %s\n" % filename)
last_filename = filename
- print " ** ", section
- print format_in_columns(sorted(names), options.cols)
- print "\n"
-
- print ""
- print "Undocumented"
- print "============\n"
- print format_in_columns(sorted(undocumented.keys()), options.cols)
+ print(" ** ", section)
+ print(format_in_columns(sorted(names), options.cols))
+ print("\n")
+
+ print("")
+ print("Undocumented")
+ print("============\n")
+ print(format_in_columns(sorted(undocumented.keys()), options.cols))
def check_numpy():
documented = get_documented(glob.glob(SOURCE_DIR + '/*.rst'))
View
2  doc/swig/test/setup.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division
+from __future__ import division, print_function
# System imports
from distutils.core import *
View
8 doc/swig/test/testArray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -277,8 +277,8 @@ def testView(self):
suite.addTest(unittest.makeSuite(Array2TestCase))
# Execute the test suite
- print "Testing Classes of Module Array"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Array")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
8 doc/swig/test/testFarray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -152,8 +152,8 @@ def testView(self):
suite.addTest(unittest.makeSuite(FarrayTestCase))
# Execute the test suite
- print "Testing Classes of Module Farray"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Farray")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
14 doc/swig/test/testFortran.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,14 +27,14 @@ def __init__(self, methodName="runTests"):
# Test (type* IN_FARRAY2, int DIM1, int DIM2) typemap
def testSecondElementContiguous(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.arange(9).reshape(3, 3).astype(self.typeCode)
self.assertEquals(second(matrix), 3)
def testSecondElementFortran(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray(np.arange(9).reshape(3, 3),
self.typeCode)
@@ -42,7 +42,7 @@ def testSecondElementFortran(self):
def testSecondElementObject(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray([[0,1,2],[3,4,5],[6,7,8]], self.typeCode)
self.assertEquals(second(matrix), 3)
@@ -163,8 +163,8 @@ def __init__(self, methodName="runTest"):
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
62 doc/swig/test/testMatrix.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,7 +27,7 @@ def __init__(self, methodName="runTests"):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDet(self):
"Test det function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7],[6,9]]
self.assertEquals(det(matrix), 30)
@@ -35,7 +35,7 @@ def testDet(self):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetBadList(self):
"Test det function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7], ["e", "pi"]]
self.assertRaises(BadListError, det, matrix)
@@ -43,7 +43,7 @@ def testDetBadList(self):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongDim(self):
"Test det function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [8,7]
self.assertRaises(TypeError, det, matrix)
@@ -51,7 +51,7 @@ def testDetWrongDim(self):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongSize(self):
"Test det function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7,6], [5,4,3], [2,1,0]]
self.assertRaises(TypeError, det, matrix)
@@ -59,14 +59,14 @@ def testDetWrongSize(self):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetNonContainer(self):
"Test det function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
self.assertRaises(TypeError, det, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,5,4],[3,2,1]]
self.assertEquals(max(matrix), 6)
@@ -74,7 +74,7 @@ def testMax(self):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,"five",4], ["three", 2, "one"]]
self.assertRaises(BadListError, max, matrix)
@@ -82,21 +82,21 @@ def testMaxBadList(self):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, 1, 2, 3])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [[9,8],[7,6],[5,4]]
self.assertEquals(min(matrix), 4)
@@ -104,7 +104,7 @@ def testMin(self):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [["nine","eight"], ["seven","six"]]
self.assertRaises(BadListError, min, matrix)
@@ -112,21 +112,21 @@ def testMinBadList(self):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [1,3,5,7,9])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, False)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
scale(matrix,4)
@@ -135,7 +135,7 @@ def testScale(self):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([1,2,2,1],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -143,7 +143,7 @@ def testScaleWrongDim(self):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2],[2,1]],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -151,7 +151,7 @@ def testScaleWrongSize(self):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],'c')
self.assertRaises(TypeError, scale, matrix)
@@ -159,7 +159,7 @@ def testScaleWrongType(self):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = [[1,2,3],[2,1,2],[3,2,1]]
self.assertRaises(TypeError, scale, matrix)
@@ -167,7 +167,7 @@ def testScaleNonArray(self):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7],[8,9]],self.typeCode)
floor(matrix,7)
@@ -176,7 +176,7 @@ def testFloor(self):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongDim(self):
"Test floor function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([6,7,8,9],self.typeCode)
self.assertRaises(TypeError, floor, matrix)
@@ -184,7 +184,7 @@ def testFloorWrongDim(self):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7], [8,9]],'c')
self.assertRaises(TypeError, floor, matrix)
@@ -192,7 +192,7 @@ def testFloorWrongType(self):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = [[6,7], [8,9]]
self.assertRaises(TypeError, floor, matrix)
@@ -200,7 +200,7 @@ def testFloorNonArray(self):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2],[3,4]],self.typeCode)
ceil(matrix,3)
@@ -209,7 +209,7 @@ def testCeil(self):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([1,2,3,4],self.typeCode)
self.assertRaises(TypeError, ceil, matrix)
@@ -217,7 +217,7 @@ def testCeilWrongDim(self):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongType(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2], [3,4]],'c')
self.assertRaises(TypeError, ceil, matrix)
@@ -225,7 +225,7 @@ def testCeilWrongType(self):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = [[1,2], [3,4]]
self.assertRaises(TypeError, ceil, matrix)
@@ -233,7 +233,7 @@ def testCeilNonArray(self):
# Test (type ARGOUT_ARRAY2[ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Matrix.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
@@ -355,8 +355,8 @@ def __init__(self, methodName="runTest"):
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
62 doc/swig/test/testTensor.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -29,7 +29,7 @@ def __init__(self, methodName="runTests"):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNorm(self):
"Test norm function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1], [2,3]],
[[3,2], [1,0]]]
@@ -41,7 +41,7 @@ def testNorm(self):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormBadList(self):
"Test norm function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,"one"],[2,3]],
[[3,"two"],[1,0]]]
@@ -50,7 +50,7 @@ def testNormBadList(self):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongDim(self):
"Test norm function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[0,1,2,3],
[3,2,1,0]]
@@ -59,7 +59,7 @@ def testNormWrongDim(self):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongSize(self):
"Test norm function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1,0], [2,3,2]],
[[3,2,3], [1,0,1]]]
@@ -68,14 +68,14 @@ def testNormWrongSize(self):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormNonContainer(self):
"Test norm function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
self.assertRaises(TypeError, norm, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,2], [3,4]],
[[5,6], [7,8]]]
@@ -84,7 +84,7 @@ def testMax(self):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,"two"], [3,4]],
[[5,"six"], [7,8]]]
@@ -93,21 +93,21 @@ def testMaxBadList(self):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, -1, 2, -3])
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -116,7 +116,7 @@ def testMin(self):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[["nine",8], [7,6]],
[["five",4], [3,2]]]
@@ -125,21 +125,21 @@ def testMinBadList(self):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, True)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [[1,3],[5,7]])
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -152,7 +152,7 @@ def testScale(self):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -162,7 +162,7 @@ def testScaleWrongType(self):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[1,0,1], [0,1,0], [1,0,1],
[0,1,0], [1,0,1], [0,1,0]],self.typeCode)
@@ -171,7 +171,7 @@ def testScaleWrongDim(self):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0], [0,1], [1,0]],
[[0,1], [1,0], [0,1]],
@@ -181,14 +181,14 @@ def testScaleWrongSize(self):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
self.assertRaises(TypeError, scale, True)
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],self.typeCode)
@@ -199,7 +199,7 @@ def testFloor(self):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],'c')
@@ -208,7 +208,7 @@ def testFloorWrongType(self):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongDim(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
self.assertRaises(TypeError, floor, tensor)
@@ -216,14 +216,14 @@ def testFloorWrongDim(self):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
self.assertRaises(TypeError, floor, object)
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],self.typeCode)
@@ -234,7 +234,7 @@ def testCeil(self):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongType(self):
"Test ceil function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],'c')
@@ -243,7 +243,7 @@ def testCeilWrongType(self):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
self.assertRaises(TypeError, ceil, tensor)
@@ -251,7 +251,7 @@ def testCeilWrongDim(self):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -260,7 +260,7 @@ def testCeilNonArray(self):
# Test (type ARGOUT_ARRAY3[ANY][ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Tensor.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[[1,1], [1,1]],
[[1,1], [1,1]]])
@@ -395,8 +395,8 @@ def __init__(self, methodName="runTest"):
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 3D Functions of Module Tensor"
- print "NumPy version", np.__version__
- print
+ print("Testing 3D Functions of Module Tensor")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
70 doc/swig/test/testVector.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,98 +27,98 @@ def __init__(self, methodName="runTest"):
# Test the (type IN_ARRAY1[ANY]) typemap
def testLength(self):
"Test length function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertEquals(length([5, 12, 0]), 13)
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthBadList(self):
"Test length function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(BadListError, length, [5, "twelve", 0])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongSize(self):
"Test length function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [5, 12])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongDim(self):
"Test length function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [[1,2], [3,4]])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthNonContainer(self):
"Test length function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, None)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProd(self):
"Test prod function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertEquals(prod([1,2,3,4]), 24)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdBadList(self):
"Test prod function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(BadListError, prod, [[1,"two"], ["e","pi"]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdWrongDim(self):
"Test prod function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, [[1,2], [8,9]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdNonContainer(self):
"Test prod function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, None)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSum(self):
"Test sum function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertEquals(sum([5,6,7,8]), 26)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumBadList(self):
"Test sum function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(BadListError, sum, [3,4, 5, "pi"])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumWrongDim(self):
"Test sum function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, [[3,4], [5,6]])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumNonContainer(self):
"Test sum function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, True)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverse(self):
"Test reverse function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],self.typeCode)
reverse(vector)
@@ -127,7 +127,7 @@ def testReverse(self):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongDim(self):
"Test reverse function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([[1,2], [3,4]],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -135,7 +135,7 @@ def testReverseWrongDim(self):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongSize(self):
"Test reverse function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([9,8,7,6,5,4],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -143,7 +143,7 @@ def testReverseWrongSize(self):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongType(self):
"Test reverse function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],'c')
self.assertRaises(TypeError, reverse, vector)
@@ -151,14 +151,14 @@ def testReverseWrongType(self):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseNonArray(self):
"Test reverse function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
self.assertRaises(TypeError, reverse, [2,4,6])
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnes(self):
"Test ones function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros(5,self.typeCode)
ones(vector)
@@ -167,7 +167,7 @@ def testOnes(self):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongDim(self):
"Test ones function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),self.typeCode)
self.assertRaises(TypeError, ones, vector)
@@ -175,7 +175,7 @@ def testOnesWrongDim(self):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongType(self):
"Test ones function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),'c')
self.assertRaises(TypeError, ones, vector)
@@ -183,14 +183,14 @@ def testOnesWrongType(self):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesNonArray(self):
"Test ones function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
self.assertRaises(TypeError, ones, [2,4,6,8])
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZeros(self):
"Test zeros function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(5,self.typeCode)
zeros(vector)
@@ -199,7 +199,7 @@ def testZeros(self):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongDim(self):
"Test zeros function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones((5,5),self.typeCode)
self.assertRaises(TypeError, zeros, vector)
@@ -207,7 +207,7 @@ def testZerosWrongDim(self):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongType(self):
"Test zeros function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(6,'c')
self.assertRaises(TypeError, zeros, vector)
@@ -215,14 +215,14 @@ def testZerosWrongType(self):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosNonArray(self):
"Test zeros function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
self.assertRaises(TypeError, zeros, [1,3,5,7,9])
# Test the (type ARGOUT_ARRAY1[ANY]) typemap
def testEOSplit(self):
"Test eoSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
eoSplit = Vector.__dict__[self.typeStr + "EOSplit"]
even, odd = eoSplit([1,2,3])
self.assertEquals((even == [1,0,3]).all(), True)
@@ -231,7 +231,7 @@ def testEOSplit(self):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwos(self):
"Test twos function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
vector = twos(5)
self.assertEquals((vector == [2,2,2,2,2]).all(), True)
@@ -239,14 +239,14 @@ def testTwos(self):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwosNonInt(self):
"Test twos function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
self.assertRaises(TypeError, twos, 5.0)
# Test the (int DIM1, type* ARGOUT_ARRAY1) typemap
def testThrees(self):
"Test threes function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
vector = threes(6)
self.assertEquals((vector == [3,3,3,3,3,3]).all(), True)
@@ -254,7 +254,7 @@ def testThrees(self):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testThreesNonInt(self):
"Test threes function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
self.assertRaises(TypeError, threes, "threes")
@@ -374,8 +374,8 @@ def __init__(self, methodName="runTest"):
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 1D Functions of Module Vector"
- print "NumPy version", np.__version__
- print
+ print("Testing 1D Functions of Module Vector")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
View
2  numpy/__init__.py
@@ -104,7 +104,7 @@
Exceptions to this rule are documented.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
View
12 numpy/_import_tools.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import os
import sys
@@ -262,13 +262,13 @@ def _obj2repr(self,obj):
def log(self,mess):
if self.verbose>1:
- print >> sys.stderr, str(mess)
+ print(str(mess), file=sys.stderr)
def warn(self,mess):
if self.verbose>=0:
- print >> sys.stderr, str(mess)
+ print(str(mess), file=sys.stderr)