From d4b88c1dbd6898fb6fcebc97f36b421999340f71 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Wed, 27 Mar 2013 21:49:08 -0600 Subject: [PATCH] 2to3: Use absolute imports. The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172 --- doc/cdoc/numpyfilter.py | 2 +- doc/cython/run_test.py | 2 +- doc/example.py | 2 +- doc/newdtype_example/example.py | 2 +- doc/newdtype_example/floatint/__init__.py | 2 +- doc/numpybook/comparison/ctypes/filter.py | 2 +- doc/numpybook/comparison/ctypes/interface.py | 2 +- doc/numpybook/comparison/timing.py | 2 +- doc/numpybook/comparison/weave/filter.py | 2 +- doc/numpybook/comparison/weave/inline.py | 2 +- doc/numpybook/runcode.py | 2 +- doc/postprocess.py | 2 +- doc/pyrex/run_test.py | 2 +- doc/source/conf.py | 2 +- doc/sphinxext/numpydoc/comment_eater.py | 2 +- doc/sphinxext/numpydoc/compiler_unparse.py | 2 +- doc/sphinxext/numpydoc/docscrape.py | 2 +- doc/sphinxext/numpydoc/docscrape_sphinx.py | 2 +- doc/sphinxext/numpydoc/linkcode.py | 2 +- doc/sphinxext/numpydoc/numpydoc.py | 2 +- doc/sphinxext/numpydoc/phantom_import.py | 2 +- doc/sphinxext/numpydoc/plot_directive.py | 2 +- .../numpydoc/tests/test_docscrape.py | 2 +- doc/sphinxext/numpydoc/traitsdoc.py | 2 +- doc/summarize.py | 2 +- doc/swig/test/testArray.py | 2 +- doc/swig/test/testFarray.py | 2 +- doc/swig/test/testFortran.py | 2 +- doc/swig/test/testMatrix.py | 2 +- doc/swig/test/testTensor.py | 2 +- doc/swig/test/testVector.py | 2 +- numpy/__init__.py | 40 +++++++------- numpy/_import_tools.py | 2 +- numpy/add_newdocs.py | 2 +- numpy/build_utils/__init__.py | 2 +- numpy/build_utils/common.py | 2 +- numpy/build_utils/waf.py | 4 +- numpy/compat/__init__.py | 10 ++-- numpy/compat/_inspect.py | 2 +- numpy/compat/py3k.py | 2 +- numpy/core/__init__.py | 52 +++++++++---------- numpy/core/_internal.py | 12 ++--- numpy/core/_methods.py | 2 +- numpy/core/arrayprint.py | 18 +++---- numpy/core/code_generators/__init__.py | 2 +- numpy/core/code_generators/cversions.py | 6 +-- numpy/core/code_generators/genapi.py | 2 +- numpy/core/code_generators/numpy_api.py | 2 +- .../core/code_generators/ufunc_docstrings.py | 2 +- numpy/core/defchararray.py | 8 +-- numpy/core/fromnumeric.py | 12 ++--- numpy/core/function_base.py | 6 +-- numpy/core/getlimits.py | 10 ++-- numpy/core/info.py | 2 +- numpy/core/machar.py | 2 +- numpy/core/memmap.py | 4 +- numpy/core/numeric.py | 20 +++---- numpy/core/numerictypes.py | 2 +- numpy/core/records.py | 8 +-- numpy/core/setup_common.py | 2 +- numpy/core/shape_base.py | 6 +-- numpy/core/src/multiarray/testcalcs.py | 2 +- numpy/core/tests/test_api.py | 2 +- numpy/core/tests/test_arrayprint.py | 2 +- numpy/core/tests/test_blasdot.py | 2 +- numpy/core/tests/test_datetime.py | 2 +- numpy/core/tests/test_defchararray.py | 2 +- numpy/core/tests/test_deprecations.py | 2 +- numpy/core/tests/test_dtype.py | 2 +- numpy/core/tests/test_einsum.py | 2 +- numpy/core/tests/test_errstate.py | 2 +- numpy/core/tests/test_function_base.py | 2 +- numpy/core/tests/test_getlimits.py | 2 +- numpy/core/tests/test_half.py | 2 +- numpy/core/tests/test_indexerrors.py | 2 +- numpy/core/tests/test_indexing.py | 2 +- numpy/core/tests/test_item_selection.py | 2 +- numpy/core/tests/test_machar.py | 2 +- numpy/core/tests/test_memmap.py | 2 +- numpy/core/tests/test_multiarray.py | 2 +- .../core/tests/test_multiarray_assignment.py | 2 +- numpy/core/tests/test_nditer.py | 2 +- numpy/core/tests/test_numeric.py | 2 +- numpy/core/tests/test_numerictypes.py | 2 +- numpy/core/tests/test_print.py | 2 +- numpy/core/tests/test_records.py | 2 +- numpy/core/tests/test_regression.py | 2 +- numpy/core/tests/test_scalarmath.py | 2 +- numpy/core/tests/test_scalarprint.py | 2 +- numpy/core/tests/test_shape_base.py | 2 +- numpy/core/tests/test_ufunc.py | 2 +- numpy/core/tests/test_umath.py | 2 +- numpy/core/tests/test_umath_complex.py | 2 +- numpy/core/tests/test_unicode.py | 2 +- numpy/ctypeslib.py | 2 +- numpy/distutils/__init__.py | 12 ++--- numpy/distutils/__version__.py | 2 +- numpy/distutils/ccompiler.py | 4 +- numpy/distutils/command/__init__.py | 2 +- numpy/distutils/command/autodist.py | 2 +- numpy/distutils/command/bdist_rpm.py | 2 +- numpy/distutils/command/build.py | 2 +- numpy/distutils/command/build_clib.py | 2 +- numpy/distutils/command/build_ext.py | 2 +- numpy/distutils/command/build_py.py | 2 +- numpy/distutils/command/build_scripts.py | 2 +- numpy/distutils/command/build_src.py | 2 +- numpy/distutils/command/config.py | 2 +- numpy/distutils/command/config_compiler.py | 2 +- numpy/distutils/command/develop.py | 2 +- numpy/distutils/command/egg_info.py | 2 +- numpy/distutils/command/install.py | 2 +- numpy/distutils/command/install_clib.py | 2 +- numpy/distutils/command/install_data.py | 2 +- numpy/distutils/command/install_headers.py | 2 +- numpy/distutils/command/sdist.py | 2 +- numpy/distutils/compat.py | 2 +- numpy/distutils/conv_template.py | 2 +- numpy/distutils/core.py | 2 +- numpy/distutils/cpuinfo.py | 2 +- numpy/distutils/environment.py | 2 +- numpy/distutils/exec_command.py | 2 +- numpy/distutils/extension.py | 2 +- numpy/distutils/fcompiler/__init__.py | 2 +- numpy/distutils/fcompiler/absoft.py | 2 +- numpy/distutils/fcompiler/compaq.py | 2 +- numpy/distutils/fcompiler/g95.py | 2 +- numpy/distutils/fcompiler/gnu.py | 2 +- numpy/distutils/fcompiler/hpux.py | 2 +- numpy/distutils/fcompiler/ibm.py | 2 +- numpy/distutils/fcompiler/intel.py | 2 +- numpy/distutils/fcompiler/lahey.py | 2 +- numpy/distutils/fcompiler/mips.py | 2 +- numpy/distutils/fcompiler/nag.py | 2 +- numpy/distutils/fcompiler/none.py | 2 +- numpy/distutils/fcompiler/pathf95.py | 2 +- numpy/distutils/fcompiler/pg.py | 2 +- numpy/distutils/fcompiler/sun.py | 2 +- numpy/distutils/fcompiler/vast.py | 2 +- numpy/distutils/from_template.py | 2 +- numpy/distutils/info.py | 2 +- numpy/distutils/intelccompiler.py | 2 +- numpy/distutils/lib2def.py | 2 +- numpy/distutils/line_endings.py | 2 +- numpy/distutils/log.py | 4 +- numpy/distutils/mingw32ccompiler.py | 4 +- numpy/distutils/misc_util.py | 4 +- numpy/distutils/npy_pkg_config.py | 2 +- numpy/distutils/numpy_distribution.py | 2 +- numpy/distutils/pathccompiler.py | 2 +- numpy/distutils/system_info.py | 4 +- numpy/distutils/tests/f2py_ext/__init__.py | 2 +- .../tests/f2py_ext/tests/test_fib2.py | 2 +- .../distutils/tests/f2py_f90_ext/__init__.py | 2 +- .../tests/f2py_f90_ext/tests/test_foo.py | 2 +- numpy/distutils/tests/gen_ext/__init__.py | 2 +- .../tests/gen_ext/tests/test_fib3.py | 2 +- numpy/distutils/tests/pyrex_ext/__init__.py | 2 +- .../tests/pyrex_ext/tests/test_primes.py | 2 +- numpy/distutils/tests/swig_ext/__init__.py | 2 +- .../tests/swig_ext/tests/test_example.py | 2 +- .../tests/swig_ext/tests/test_example2.py | 2 +- numpy/distutils/tests/test_fcompiler_gnu.py | 2 +- numpy/distutils/tests/test_fcompiler_intel.py | 2 +- numpy/distutils/tests/test_misc_util.py | 2 +- numpy/distutils/tests/test_npy_pkg_config.py | 2 +- numpy/distutils/unixccompiler.py | 4 +- numpy/doc/__init__.py | 2 +- numpy/doc/basics.py | 2 +- numpy/doc/broadcasting.py | 2 +- numpy/doc/byteswapping.py | 2 +- numpy/doc/constants.py | 2 +- numpy/doc/creation.py | 2 +- numpy/doc/glossary.py | 2 +- numpy/doc/howtofind.py | 2 +- numpy/doc/indexing.py | 2 +- numpy/doc/internals.py | 2 +- numpy/doc/io.py | 2 +- numpy/doc/jargon.py | 2 +- numpy/doc/methods_vs_functions.py | 2 +- numpy/doc/misc.py | 2 +- numpy/doc/performance.py | 2 +- numpy/doc/structured_arrays.py | 2 +- numpy/doc/subclassing.py | 2 +- numpy/doc/ufuncs.py | 2 +- numpy/dual.py | 2 +- numpy/f2py/__init__.py | 10 ++-- numpy/f2py/__version__.py | 2 +- numpy/f2py/auxfuncs.py | 8 +-- numpy/f2py/capi_maps.py | 10 ++-- numpy/f2py/cb_rules.py | 10 ++-- numpy/f2py/cfuncs.py | 6 +-- numpy/f2py/common_rules.py | 12 ++--- numpy/f2py/crackfortran.py | 6 +-- numpy/f2py/diagnose.py | 2 +- numpy/f2py/doc/collectinput.py | 2 +- numpy/f2py/docs/pytest.py | 2 +- numpy/f2py/docs/usersguide/setup_example.py | 2 +- numpy/f2py/f2py2e.py | 16 +++--- numpy/f2py/f2py_testing.py | 2 +- numpy/f2py/f90mod_rules.py | 12 ++--- numpy/f2py/func2subr.py | 4 +- numpy/f2py/info.py | 2 +- numpy/f2py/rules.py | 20 +++---- numpy/f2py/tests/test_array_from_pyobj.py | 2 +- numpy/f2py/tests/test_assumed_shape.py | 2 +- numpy/f2py/tests/test_callback.py | 2 +- numpy/f2py/tests/test_kind.py | 2 +- numpy/f2py/tests/test_mixed.py | 2 +- numpy/f2py/tests/test_return_character.py | 2 +- numpy/f2py/tests/test_return_complex.py | 2 +- numpy/f2py/tests/test_return_integer.py | 2 +- numpy/f2py/tests/test_return_logical.py | 2 +- numpy/f2py/tests/test_return_real.py | 2 +- numpy/f2py/tests/test_size.py | 2 +- numpy/f2py/tests/util.py | 2 +- numpy/f2py/use_rules.py | 4 +- numpy/fft/__init__.py | 8 +-- numpy/fft/fftpack.py | 4 +- numpy/fft/helper.py | 2 +- numpy/fft/info.py | 2 +- numpy/fft/tests/test_fftpack.py | 2 +- numpy/fft/tests/test_helper.py | 2 +- numpy/lib/__init__.py | 34 ++++++------ numpy/lib/_datasource.py | 2 +- numpy/lib/_iotools.py | 2 +- numpy/lib/arraypad.py | 2 +- numpy/lib/arraysetops.py | 2 +- numpy/lib/arrayterator.py | 2 +- numpy/lib/financial.py | 2 +- numpy/lib/format.py | 2 +- numpy/lib/function_base.py | 12 ++--- numpy/lib/index_tricks.py | 6 +-- numpy/lib/info.py | 2 +- numpy/lib/npyio.py | 10 ++-- numpy/lib/polynomial.py | 2 +- numpy/lib/recfunctions.py | 2 +- numpy/lib/scimath.py | 2 +- numpy/lib/shape_base.py | 2 +- numpy/lib/stride_tricks.py | 2 +- numpy/lib/tests/test__datasource.py | 2 +- numpy/lib/tests/test__iotools.py | 2 +- numpy/lib/tests/test_arraypad.py | 2 +- numpy/lib/tests/test_arraysetops.py | 2 +- numpy/lib/tests/test_arrayterator.py | 2 +- numpy/lib/tests/test_financial.py | 2 +- numpy/lib/tests/test_format.py | 2 +- numpy/lib/tests/test_function_base.py | 2 +- numpy/lib/tests/test_index_tricks.py | 2 +- numpy/lib/tests/test_io.py | 2 +- numpy/lib/tests/test_polynomial.py | 2 +- numpy/lib/tests/test_recfunctions.py | 2 +- numpy/lib/tests/test_regression.py | 2 +- numpy/lib/tests/test_shape_base.py | 2 +- numpy/lib/tests/test_stride_tricks.py | 2 +- numpy/lib/tests/test_twodim_base.py | 2 +- numpy/lib/tests/test_type_check.py | 2 +- numpy/lib/tests/test_ufunclike.py | 2 +- numpy/lib/tests/test_utils.py | 2 +- numpy/lib/twodim_base.py | 2 +- numpy/lib/type_check.py | 4 +- numpy/lib/ufunclike.py | 2 +- numpy/lib/user_array.py | 2 +- numpy/lib/utils.py | 2 +- numpy/linalg/__init__.py | 6 +-- numpy/linalg/info.py | 2 +- numpy/linalg/lapack_lite/clapack_scrub.py | 2 +- numpy/linalg/lapack_lite/fortran.py | 2 +- numpy/linalg/lapack_lite/make_lite.py | 2 +- numpy/linalg/linalg.py | 2 +- numpy/linalg/tests/test_build.py | 2 +- numpy/linalg/tests/test_linalg.py | 2 +- numpy/linalg/tests/test_regression.py | 2 +- numpy/ma/__init__.py | 10 ++-- numpy/ma/bench.py | 2 +- numpy/ma/core.py | 2 +- numpy/ma/extras.py | 6 +-- numpy/ma/mrecords.py | 2 +- numpy/ma/tests/test_core.py | 2 +- numpy/ma/tests/test_extras.py | 2 +- numpy/ma/tests/test_mrecords.py | 2 +- numpy/ma/tests/test_old_ma.py | 2 +- numpy/ma/tests/test_regression.py | 2 +- numpy/ma/tests/test_subclassing.py | 2 +- numpy/ma/testutils.py | 4 +- numpy/ma/timer_comparison.py | 2 +- numpy/ma/version.py | 6 +-- numpy/matlib.py | 2 +- numpy/matrixlib/__init__.py | 4 +- numpy/matrixlib/defmatrix.py | 2 +- numpy/matrixlib/tests/test_defmatrix.py | 2 +- numpy/matrixlib/tests/test_multiarray.py | 2 +- numpy/matrixlib/tests/test_numeric.py | 2 +- numpy/matrixlib/tests/test_regression.py | 2 +- numpy/numarray/__init__.py | 26 +++++----- numpy/numarray/alter_code1.py | 2 +- numpy/numarray/alter_code2.py | 2 +- numpy/numarray/compat.py | 2 +- numpy/numarray/convolve.py | 2 +- numpy/numarray/fft.py | 2 +- numpy/numarray/functions.py | 4 +- numpy/numarray/image.py | 2 +- numpy/numarray/linear_algebra.py | 2 +- numpy/numarray/ma.py | 2 +- numpy/numarray/matrix.py | 2 +- numpy/numarray/mlab.py | 2 +- numpy/numarray/nd_image.py | 2 +- numpy/numarray/numerictypes.py | 2 +- numpy/numarray/random_array.py | 2 +- numpy/numarray/session.py | 2 +- numpy/numarray/ufuncs.py | 2 +- numpy/numarray/util.py | 2 +- numpy/oldnumeric/__init__.py | 24 ++++----- numpy/oldnumeric/alter_code1.py | 2 +- numpy/oldnumeric/alter_code2.py | 2 +- numpy/oldnumeric/array_printer.py | 2 +- numpy/oldnumeric/arrayfns.py | 2 +- numpy/oldnumeric/compat.py | 6 +-- numpy/oldnumeric/fft.py | 2 +- numpy/oldnumeric/fix_default_axis.py | 2 +- numpy/oldnumeric/functions.py | 4 +- numpy/oldnumeric/linear_algebra.py | 2 +- numpy/oldnumeric/ma.py | 2 +- numpy/oldnumeric/matrix.py | 4 +- numpy/oldnumeric/misc.py | 4 +- numpy/oldnumeric/mlab.py | 26 +++++----- numpy/oldnumeric/precision.py | 4 +- numpy/oldnumeric/random_array.py | 2 +- numpy/oldnumeric/rng.py | 2 +- numpy/oldnumeric/rng_stats.py | 2 +- numpy/oldnumeric/tests/test_oldnumeric.py | 2 +- numpy/oldnumeric/tests/test_regression.py | 2 +- numpy/oldnumeric/typeconv.py | 2 +- numpy/oldnumeric/ufuncs.py | 2 +- numpy/oldnumeric/user_array.py | 2 +- numpy/polynomial/__init__.py | 14 ++--- numpy/polynomial/chebyshev.py | 8 +-- numpy/polynomial/hermite.py | 8 +-- numpy/polynomial/hermite_e.py | 8 +-- numpy/polynomial/laguerre.py | 8 +-- numpy/polynomial/legendre.py | 8 +-- numpy/polynomial/polynomial.py | 6 +-- numpy/polynomial/polytemplate.py | 13 ++--- numpy/polynomial/polyutils.py | 2 +- numpy/polynomial/tests/test_chebyshev.py | 2 +- numpy/polynomial/tests/test_classes.py | 2 +- numpy/polynomial/tests/test_hermite.py | 2 +- numpy/polynomial/tests/test_hermite_e.py | 2 +- numpy/polynomial/tests/test_laguerre.py | 2 +- numpy/polynomial/tests/test_legendre.py | 2 +- numpy/polynomial/tests/test_polynomial.py | 2 +- numpy/polynomial/tests/test_polyutils.py | 2 +- numpy/polynomial/tests/test_printing.py | 2 +- numpy/random/__init__.py | 6 +-- numpy/random/info.py | 2 +- numpy/random/mtrand/generate_mtrand_c.py | 2 +- numpy/random/tests/test_random.py | 2 +- numpy/random/tests/test_regression.py | 2 +- numpy/testing/__init__.py | 12 ++--- numpy/testing/decorators.py | 6 +-- numpy/testing/noseclasses.py | 4 +- numpy/testing/nosetester.py | 12 ++--- numpy/testing/nulltester.py | 2 +- numpy/testing/numpytest.py | 2 +- numpy/testing/print_coercion_tables.py | 2 +- numpy/testing/tests/test_decorators.py | 2 +- numpy/testing/tests/test_doctesting.py | 2 +- numpy/testing/tests/test_utils.py | 2 +- numpy/testing/utils.py | 4 +- numpy/tests/test_ctypeslib.py | 2 +- numpy/tests/test_matlib.py | 2 +- pavement.py | 2 +- setupegg.py | 2 +- .../allocation_tracking/track_allocations.py | 2 +- tools/c_coverage/c_coverage_report.py | 2 +- tools/commitstats.py | 2 +- tools/py3tool.py | 45 ++-------------- tools/test-installed-numpy.py | 2 +- 378 files changed, 659 insertions(+), 703 deletions(-) diff --git a/doc/cdoc/numpyfilter.py b/doc/cdoc/numpyfilter.py index 4a93141dd273..60bee1b5180f 100755 --- a/doc/cdoc/numpyfilter.py +++ b/doc/cdoc/numpyfilter.py @@ -6,7 +6,7 @@ Also, add Doxygen /** and /**< syntax automatically where appropriate. """ -from __future__ import division +from __future__ import division, absolute_import import sys import re diff --git a/doc/cython/run_test.py b/doc/cython/run_test.py index 64918ed9c06d..986016c7a2b8 100755 --- a/doc/cython/run_test.py +++ b/doc/cython/run_test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import from numpyx import test test() diff --git a/doc/example.py b/doc/example.py index 5c9d3d27e539..e01640948251 100644 --- a/doc/example.py +++ b/doc/example.py @@ -8,7 +8,7 @@ a line by itself, preferably preceeded by a blank line. """ -from __future__ import division +from __future__ import division, absolute_import import os # standard library imports first diff --git a/doc/newdtype_example/example.py b/doc/newdtype_example/example.py index b9ccc465b52b..f6251c0b9622 100644 --- a/doc/newdtype_example/example.py +++ b/doc/newdtype_example/example.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import floatint.floatint as ff import numpy as np diff --git a/doc/newdtype_example/floatint/__init__.py b/doc/newdtype_example/floatint/__init__.py index 5c6aac4d6166..b4895eb4cbb8 100644 --- a/doc/newdtype_example/floatint/__init__.py +++ b/doc/newdtype_example/floatint/__init__.py @@ -1,3 +1,3 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/doc/numpybook/comparison/ctypes/filter.py b/doc/numpybook/comparison/ctypes/filter.py index ebc274f316eb..16acec04b1f8 100644 --- a/doc/numpybook/comparison/ctypes/filter.py +++ b/doc/numpybook/comparison/ctypes/filter.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['filter2d'] diff --git a/doc/numpybook/comparison/ctypes/interface.py b/doc/numpybook/comparison/ctypes/interface.py index ab1b14731aa4..651ee94391b9 100644 --- a/doc/numpybook/comparison/ctypes/interface.py +++ b/doc/numpybook/comparison/ctypes/interface.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['add', 'filter2d'] diff --git a/doc/numpybook/comparison/timing.py b/doc/numpybook/comparison/timing.py index 18004855e1ce..59978ba35461 100644 --- a/doc/numpybook/comparison/timing.py +++ b/doc/numpybook/comparison/timing.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import timeit diff --git a/doc/numpybook/comparison/weave/filter.py b/doc/numpybook/comparison/weave/filter.py index 519a54c5bf8b..9fa726a796ef 100644 --- a/doc/numpybook/comparison/weave/filter.py +++ b/doc/numpybook/comparison/weave/filter.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from scipy import weave, zeros_like diff --git a/doc/numpybook/comparison/weave/inline.py b/doc/numpybook/comparison/weave/inline.py index 1f98b7a621ed..9c134b231144 100644 --- a/doc/numpybook/comparison/weave/inline.py +++ b/doc/numpybook/comparison/weave/inline.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from scipy import weave from numpy import rand, zeros_like diff --git a/doc/numpybook/runcode.py b/doc/numpybook/runcode.py index 92784d34eaf2..66c74cd745cb 100644 --- a/doc/numpybook/runcode.py +++ b/doc/numpybook/runcode.py @@ -14,7 +14,7 @@ -n name of code section (default MyCode) """ -from __future__ import division +from __future__ import division, absolute_import import sys import optparse diff --git a/doc/postprocess.py b/doc/postprocess.py index 51207019335d..195ab9d96f61 100755 --- a/doc/postprocess.py +++ b/doc/postprocess.py @@ -6,7 +6,7 @@ MODE is either 'html' or 'tex'. """ -from __future__ import division +from __future__ import division, absolute_import import re, optparse diff --git a/doc/pyrex/run_test.py b/doc/pyrex/run_test.py index 64918ed9c06d..986016c7a2b8 100755 --- a/doc/pyrex/run_test.py +++ b/doc/pyrex/run_test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import from numpyx import test test() diff --git a/doc/source/conf.py b/doc/source/conf.py index f22505f97992..8b29316cb37f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import division +from __future__ import division, absolute_import import sys, os, re diff --git a/doc/sphinxext/numpydoc/comment_eater.py b/doc/sphinxext/numpydoc/comment_eater.py index 0e205072e6fb..74d0d476893e 100644 --- a/doc/sphinxext/numpydoc/comment_eater.py +++ b/doc/sphinxext/numpydoc/comment_eater.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys if sys.version_info[0] >= 3: diff --git a/doc/sphinxext/numpydoc/compiler_unparse.py b/doc/sphinxext/numpydoc/compiler_unparse.py index 56da748d1065..bb76f7ea38a5 100644 --- a/doc/sphinxext/numpydoc/compiler_unparse.py +++ b/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 +from __future__ import division, absolute_import import sys from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add diff --git a/doc/sphinxext/numpydoc/docscrape.py b/doc/sphinxext/numpydoc/docscrape.py index 0fe2594475fb..af76b86e573b 100644 --- a/doc/sphinxext/numpydoc/docscrape.py +++ b/doc/sphinxext/numpydoc/docscrape.py @@ -1,7 +1,7 @@ """Extract reference documentation from the NumPy source tree. """ -from __future__ import division +from __future__ import division, absolute_import import sys import inspect diff --git a/doc/sphinxext/numpydoc/docscrape_sphinx.py b/doc/sphinxext/numpydoc/docscrape_sphinx.py index 14d766d84541..1248253b3f00 100644 --- a/doc/sphinxext/numpydoc/docscrape_sphinx.py +++ b/doc/sphinxext/numpydoc/docscrape_sphinx.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import re, inspect, textwrap, pydoc import sphinx diff --git a/doc/sphinxext/numpydoc/linkcode.py b/doc/sphinxext/numpydoc/linkcode.py index 58361e8c3eff..986f3938460d 100644 --- a/doc/sphinxext/numpydoc/linkcode.py +++ b/doc/sphinxext/numpydoc/linkcode.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for details. """ -from __future__ import division +from __future__ import division, absolute_import import warnings import collections diff --git a/doc/sphinxext/numpydoc/numpydoc.py b/doc/sphinxext/numpydoc/numpydoc.py index 0243d23c49bc..d95d476ef14b 100644 --- a/doc/sphinxext/numpydoc/numpydoc.py +++ b/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 +from __future__ import division, absolute_import import sphinx import collections diff --git a/doc/sphinxext/numpydoc/phantom_import.py b/doc/sphinxext/numpydoc/phantom_import.py index 6308f492dc03..855068834575 100644 --- a/doc/sphinxext/numpydoc/phantom_import.py +++ b/doc/sphinxext/numpydoc/phantom_import.py @@ -14,7 +14,7 @@ .. [1] http://code.google.com/p/pydocweb """ -from __future__ import division +from __future__ import division, absolute_import import imp, sys, compiler, types, os, inspect, re diff --git a/doc/sphinxext/numpydoc/plot_directive.py b/doc/sphinxext/numpydoc/plot_directive.py index 7547642a2aee..9e92acabb944 100644 --- a/doc/sphinxext/numpydoc/plot_directive.py +++ b/doc/sphinxext/numpydoc/plot_directive.py @@ -74,7 +74,7 @@ to make them appear side-by-side, or in floats. """ -from __future__ import division +from __future__ import division, absolute_import import sys, os, glob, shutil, imp, warnings, re, textwrap, traceback import sphinx diff --git a/doc/sphinxext/numpydoc/tests/test_docscrape.py b/doc/sphinxext/numpydoc/tests/test_docscrape.py index 07ac68003006..ce99754da59c 100644 --- a/doc/sphinxext/numpydoc/tests/test_docscrape.py +++ b/doc/sphinxext/numpydoc/tests/test_docscrape.py @@ -1,5 +1,5 @@ # -*- encoding:utf-8 -*- -from __future__ import division +from __future__ import division, absolute_import import sys, textwrap diff --git a/doc/sphinxext/numpydoc/traitsdoc.py b/doc/sphinxext/numpydoc/traitsdoc.py index 784c4fc2ff7b..74c226ab48ba 100644 --- a/doc/sphinxext/numpydoc/traitsdoc.py +++ b/doc/sphinxext/numpydoc/traitsdoc.py @@ -13,7 +13,7 @@ .. [2] http://code.enthought.com/projects/traits/ """ -from __future__ import division +from __future__ import division, absolute_import import inspect import os diff --git a/doc/summarize.py b/doc/summarize.py index d953bd642769..d72fcef61e73 100755 --- a/doc/summarize.py +++ b/doc/summarize.py @@ -5,7 +5,7 @@ Show a summary about which Numpy functions are documented and which are not. """ -from __future__ import division +from __future__ import division, absolute_import import os, glob, re, sys, inspect, optparse import collections diff --git a/doc/swig/test/testArray.py b/doc/swig/test/testArray.py index b25aff85ab40..433dfb1bdde2 100755 --- a/doc/swig/test/testArray.py +++ b/doc/swig/test/testArray.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/doc/swig/test/testFarray.py b/doc/swig/test/testFarray.py index 184fd2564e02..c0699b07d24b 100755 --- a/doc/swig/test/testFarray.py +++ b/doc/swig/test/testFarray.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/doc/swig/test/testFortran.py b/doc/swig/test/testFortran.py index 56bc03eae18e..499f6a4394a3 100644 --- a/doc/swig/test/testFortran.py +++ b/doc/swig/test/testFortran.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/doc/swig/test/testMatrix.py b/doc/swig/test/testMatrix.py index 68259de3e68a..187cd7214420 100755 --- a/doc/swig/test/testMatrix.py +++ b/doc/swig/test/testMatrix.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/doc/swig/test/testTensor.py b/doc/swig/test/testTensor.py index 41b037811068..cd9cada4649f 100755 --- a/doc/swig/test/testTensor.py +++ b/doc/swig/test/testTensor.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/doc/swig/test/testVector.py b/doc/swig/test/testVector.py index 2ad00b856ffd..29a77d281d66 100755 --- a/doc/swig/test/testVector.py +++ b/doc/swig/test/testVector.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # System imports from distutils.util import get_platform diff --git a/numpy/__init__.py b/numpy/__init__.py index 03e2afe6ed21..9cae9d38847e 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -104,7 +104,7 @@ Exceptions to this rule are documented. """ -from __future__ import division +from __future__ import division, absolute_import # We first need to detect if we're being called as part of the numpy setup # procedure itself in a reliable manner. @@ -126,43 +126,43 @@ its source directory; please exit the numpy source tree, and relaunch your python intepreter from there.""" raise ImportError(msg) - from version import git_revision as __git_revision__ - from version import version as __version__ + from .version import git_revision as __git_revision__ + from .version import version as __version__ - from _import_tools import PackageLoader + from ._import_tools import PackageLoader def pkgload(*packages, **options): loader = PackageLoader(infunc=True) return loader(*packages, **options) - import add_newdocs + from . import add_newdocs __all__ = ['add_newdocs'] pkgload.__doc__ = PackageLoader.__call__.__doc__ - from testing import Tester + from .testing import Tester test = Tester().test bench = Tester().bench - import core - from core import * - import compat - import lib - from lib import * - import linalg - import fft - import polynomial - import random - import ctypeslib - import ma - import matrixlib as _mat - from matrixlib import * + from . import core + from .core import * + from . import compat + from . import lib + from .lib import * + from . import linalg + from . import fft + from . import polynomial + from . import random + from . import ctypeslib + from . import ma + from . import matrixlib as _mat + from .matrixlib import * # Make these accessible from numpy name-space # but not imported in from numpy import * from __builtin__ import bool, int, long, float, complex, \ object, unicode, str - from core import round, abs, max, min + from .core import round, abs, max, min __all__.extend(['__version__', 'pkgload', 'PackageLoader', 'show_config']) diff --git a/numpy/_import_tools.py b/numpy/_import_tools.py index ecf29975b82f..b5939cd0ad0d 100644 --- a/numpy/_import_tools.py +++ b/numpy/_import_tools.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 9303fe77cd95..f2b7077c7b3a 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -8,7 +8,7 @@ core/fromnumeric.py, core/defmatrix.py up-to-date. """ -from __future__ import division +from __future__ import division, absolute_import from numpy.lib import add_newdoc diff --git a/numpy/build_utils/__init__.py b/numpy/build_utils/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/build_utils/__init__.py +++ b/numpy/build_utils/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/build_utils/common.py b/numpy/build_utils/common.py index 031a24583af3..301d1da7d3bd 100644 --- a/numpy/build_utils/common.py +++ b/numpy/build_utils/common.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import copy diff --git a/numpy/build_utils/waf.py b/numpy/build_utils/waf.py index ee28c0ee6ba4..09f1943eac02 100644 --- a/numpy/build_utils/waf.py +++ b/numpy/build_utils/waf.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import re @@ -7,7 +7,7 @@ import waflib.Tools.c_config from waflib import Logs, Utils -from common \ +from .common \ import \ LONG_DOUBLE_REPRESENTATION_SRC, pyod, \ long_double_representation diff --git a/numpy/compat/__init__.py b/numpy/compat/__init__.py index 930be5a90a9f..bb40fdbe9d04 100644 --- a/numpy/compat/__init__.py +++ b/numpy/compat/__init__.py @@ -8,12 +8,12 @@ * we may only need a small subset of the copied library/module """ -from __future__ import division +from __future__ import division, absolute_import -import _inspect -import py3k -from _inspect import getargspec, formatargspec -from py3k import * +from . import _inspect +from . import py3k +from ._inspect import getargspec, formatargspec +from .py3k import * __all__ = [] __all__.extend(_inspect.__all__) diff --git a/numpy/compat/_inspect.py b/numpy/compat/_inspect.py index cb9717ced588..902d609a922c 100644 --- a/numpy/compat/_inspect.py +++ b/numpy/compat/_inspect.py @@ -5,7 +5,7 @@ no overhead. """ -from __future__ import division +from __future__ import division, absolute_import import types diff --git a/numpy/compat/py3k.py b/numpy/compat/py3k.py index 594acc1e0c81..7d853d84bee3 100644 --- a/numpy/compat/py3k.py +++ b/numpy/compat/py3k.py @@ -2,7 +2,7 @@ Python 3 compatibility tools. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar', 'unicode', 'asunicode', 'asbytes_nested', 'asunicode_nested', diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 011e356b2fa2..f055d289ee0c 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -1,36 +1,36 @@ -from __future__ import division +from __future__ import division, absolute_import -from info import __doc__ +from .info import __doc__ from numpy.version import version as __version__ -import multiarray -import umath -import _internal # for freeze programs -import numerictypes as nt +from . import multiarray +from . import umath +from . import _internal # for freeze programs +from . import numerictypes as nt multiarray.set_typeDict(nt.sctypeDict) -import numeric -from numeric import * -import fromnumeric -from fromnumeric import * -import defchararray as char -import records as rec -from records import * -from memmap import * -from defchararray import chararray -import scalarmath -import function_base -from function_base import * -import machar -from machar import * -import getlimits -from getlimits import * -import shape_base -from shape_base import * +from . import numeric +from .numeric import * +from . import fromnumeric +from .fromnumeric import * +from . import defchararray as char +from . import records as rec +from .records import * +from .memmap import * +from .defchararray import chararray +from . import scalarmath +from . import function_base +from .function_base import * +from . import machar +from .machar import * +from . import getlimits +from .getlimits import * +from . import shape_base +from .shape_base import * del nt -from fromnumeric import amax as max, amin as min, \ +from .fromnumeric import amax as max, amin as min, \ round_ as round -from numeric import absolute as abs +from .numeric import absolute as abs __all__ = ['char','rec','memmap'] __all__ += numeric.__all__ diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index 6b448528eaaf..ae7a81ca8758 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -4,7 +4,7 @@ Some things are more easily handled Python. """ -from __future__ import division +from __future__ import division, absolute_import import re import sys @@ -18,7 +18,7 @@ _nbo = asbytes('>') def _makenames_list(adict, align): - from multiarray import dtype + from .multiarray import dtype allfields = [] fnames = adict.keys() for fname in fnames: @@ -52,7 +52,7 @@ def _makenames_list(adict, align): # a dictionary without "names" and "formats" # fields is used as a data-type descriptor. def _usefields(adict, align): - from multiarray import dtype + from .multiarray import dtype try: names = adict[-1] except KeyError: @@ -130,7 +130,7 @@ def _array_descr(descriptor): # so don't remove the name here, or you'll # break backward compatibilty. def _reconstruct(subtype, shape, dtype): - from multiarray import ndarray + from .multiarray import ndarray return ndarray.__new__(subtype, shape, dtype) @@ -194,7 +194,7 @@ def _commastring(astr): return result def _getintp_ctype(): - from multiarray import dtype + from .multiarray import dtype val = _getintp_ctype.cache if val is not None: return val @@ -290,7 +290,7 @@ def _newnames(datatype, order): # Given an array with fields and a sequence of field names # construct a new array with just those fields copied over def _index_fields(ary, fields): - from multiarray import empty, dtype, array + from .multiarray import empty, dtype, array dt = ary.dtype names = [name for name in fields if name in dt.names] diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index e0eaecb95291..358d35ef18a3 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -3,7 +3,7 @@ and the Python code for the NumPy-namespace function """ -from __future__ import division +from __future__ import division, absolute_import from numpy.core import multiarray as mu from numpy.core import umath as um diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index c665cec0e37e..2675b0ea1747 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -3,7 +3,7 @@ $Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $ """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ["array2string", "set_printoptions", "get_printoptions"] __docformat__ = 'restructuredtext' @@ -16,10 +16,10 @@ # and by Travis Oliphant 2005-8-22 for numpy import sys -import numerictypes as _nt -from umath import maximum, minimum, absolute, not_equal, isnan, isinf -from multiarray import format_longfloat, datetime_as_string, datetime_data -from fromnumeric import ravel +from . import numerictypes as _nt +from .umath import maximum, minimum, absolute, not_equal, isnan, isinf +from .multiarray import format_longfloat, datetime_as_string, datetime_data +from .fromnumeric import ravel def product(x, y): return x*y @@ -197,7 +197,7 @@ def get_printoptions(): return d def _leading_trailing(a): - import numeric as _nc + from . import numeric as _nc if a.ndim == 1: if len(a) > 2*_summaryEdgeItems: b = _nc.concatenate((a[:_summaryEdgeItems], @@ -324,7 +324,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ', return lst def _convert_arrays(obj): - import numeric as _nc + from . import numeric as _nc newtup = [] for k in obj: if isinstance(k, _nc.ndarray): @@ -539,7 +539,7 @@ def __init__(self, data, precision, suppress_small, sign=False): pass def fillFormat(self, data): - import numeric as _nc + from . import numeric as _nc errstate = _nc.seterr(all='ignore') try: special = isnan(data) | isinf(data) @@ -592,7 +592,7 @@ def fillFormat(self, data): self.format = format def __call__(self, x, strip_zeros=True): - import numeric as _nc + from . import numeric as _nc err = _nc.seterr(invalid='ignore') try: if isnan(x): diff --git a/numpy/core/code_generators/__init__.py b/numpy/core/code_generators/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/core/code_generators/__init__.py +++ b/numpy/core/code_generators/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/core/code_generators/cversions.py b/numpy/core/code_generators/cversions.py index 161dae8d912a..9f8a8fb346bd 100644 --- a/numpy/core/code_generators/cversions.py +++ b/numpy/core/code_generators/cversions.py @@ -3,12 +3,12 @@ The API has is defined by numpy_api_order and ufunc_api_order. """ -from __future__ import division +from __future__ import division, absolute_import from os.path import dirname -from genapi import fullapi_hash -import numpy_api +from .genapi import fullapi_hash +from . import numpy_api if __name__ == '__main__': diff --git a/numpy/core/code_generators/genapi.py b/numpy/core/code_generators/genapi.py index a1fb9e6418a3..3855d5a3d4cd 100644 --- a/numpy/core/code_generators/genapi.py +++ b/numpy/core/code_generators/genapi.py @@ -6,7 +6,7 @@ specified. """ -from __future__ import division +from __future__ import division, absolute_import import sys, os, re try: diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py index 4a9c747eac3c..35c8ab496a2b 100644 --- a/numpy/core/code_generators/numpy_api.py +++ b/numpy/core/code_generators/numpy_api.py @@ -12,7 +12,7 @@ exception, so it should hopefully not get unnoticed). """ -from __future__ import division +from __future__ import division, absolute_import multiarray_global_vars = { 'NPY_NUMUSERTYPES': 7, diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index 8e175160e78b..ff947acb8929 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -9,7 +9,7 @@ at compile time. """ -from __future__ import division +from __future__ import division, absolute_import docdict = {} diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index c85d95c49d6f..3f0a730ad512 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -15,12 +15,12 @@ The preferred alias for `defchararray` is `numpy.char`. """ -from __future__ import division +from __future__ import division, absolute_import import sys -from numerictypes import string_, unicode_, integer, object_, bool_, character -from numeric import ndarray, compare_chararrays -from numeric import array as narray +from .numerictypes import string_, unicode_, integer, object_, bool_, character +from .numeric import ndarray, compare_chararrays +from .numeric import array as narray from numpy.core.multiarray import _vec_string from numpy.compat import asbytes import numpy diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 9ca56ce27573..0080c38ce738 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1,7 +1,7 @@ """Module containing non-deprecated functions borrowed from Numeric. """ -from __future__ import division +from __future__ import division, absolute_import __docformat__ = "restructuredtext en" @@ -16,11 +16,11 @@ 'amax', 'amin', ] -import multiarray as mu -import umath as um -import numerictypes as nt -from numeric import asarray, array, asanyarray, concatenate -import _methods +from . import multiarray as mu +from . import umath as um +from . import numerictypes as nt +from .numeric import asarray, array, asanyarray, concatenate +from . import _methods _dt_ = nt.sctype2char import types diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index fa67320770e6..4a757b931d0c 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -1,9 +1,9 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['logspace', 'linspace'] -import numeric as _nx -from numeric import array +from . import numeric as _nx +from .numeric import array def linspace(start, stop, num=50, endpoint=True, retstep=False): """ diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py index 7b94346c7972..60603867782e 100644 --- a/numpy/core/getlimits.py +++ b/numpy/core/getlimits.py @@ -1,14 +1,14 @@ """Machine limits for Float32 and Float64 and (long double) if available... """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['finfo','iinfo'] -from machar import MachAr -import numeric -import numerictypes as ntypes -from numeric import array +from .machar import MachAr +from . import numeric +from . import numerictypes as ntypes +from .numeric import array def _frz(a): """fix rank-0 --> rank-1""" diff --git a/numpy/core/info.py b/numpy/core/info.py index f56b2d3953a3..7152e4aca4f3 100644 --- a/numpy/core/info.py +++ b/numpy/core/info.py @@ -81,7 +81,7 @@ arccosh arcsinh arctanh """ -from __future__ import division +from __future__ import division, absolute_import depends = ['testing'] global_symbols = ['*'] diff --git a/numpy/core/machar.py b/numpy/core/machar.py index d44d17499371..1053570f8971 100644 --- a/numpy/core/machar.py +++ b/numpy/core/machar.py @@ -5,7 +5,7 @@ Author: Pearu Peterson, September 2003 """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['MachAr'] diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 5107e9b28de5..528951537946 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -1,9 +1,9 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['memmap'] import warnings -from numeric import uint8, ndarray, dtype +from .numeric import uint8, ndarray, dtype import sys import numpy as np diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 57e366efbce7..5c5d1a0da086 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['newaxis', 'ndarray', 'flatiter', 'nditer', 'nested_iters', 'ufunc', 'arange', 'array', 'zeros', 'count_nonzero', @@ -26,11 +26,11 @@ import sys import warnings -import multiarray -import umath -from umath import * -import numerictypes -from numerictypes import * +from . import multiarray +from . import umath +from .umath import * +from . import numerictypes +from .numerictypes import * import collections @@ -911,7 +911,7 @@ def outer(a,b): try: # importing this changes the dot function for basic 4 types # to blas-optimized versions. - from _dotblas import dot, vdot, inner, alterdot, restoredot + from ._dotblas import dot, vdot, inner, alterdot, restoredot except ImportError: # docstrings are in add_newdocs.py inner = multiarray.inner @@ -1364,7 +1364,7 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): #Use numarray's printing function -from arrayprint import array2string, get_printoptions, set_printoptions +from .arrayprint import array2string, get_printoptions, set_printoptions _typelessdata = [int_, float_, complex_] if issubclass(intc, int): @@ -2591,6 +2591,6 @@ def _setdef(): False_ = bool_(False) True_ = bool_(True) -import fromnumeric -from fromnumeric import * +from . import fromnumeric +from .fromnumeric import * extend_all(fromnumeric) diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index f89fa994d987..a1af9d80d2cc 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -80,7 +80,7 @@ \\-> object_ (not used much) (kind=O) """ -from __future__ import division +from __future__ import division, absolute_import # we add more at the bottom __all__ = ['sctypeDict', 'sctypeNA', 'typeDict', 'typeNA', 'sctypes', diff --git a/numpy/core/records.py b/numpy/core/records.py index 761b1015a730..385f9866d928 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -34,14 +34,14 @@ array([ 2., 2.]) """ -from __future__ import division +from __future__ import division, absolute_import # All of the functions allow formats to be a dtype __all__ = ['record', 'recarray', 'format_parser'] -import numeric as sb -from defchararray import chararray -import numerictypes as nt +from . import numeric as sb +from .defchararray import chararray +from . import numerictypes as nt import types import os import sys diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index 1afc71085e1c..056cf9ec0d78 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import # Code common to build tools import sys diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py index 4d543924907a..d7e86f64e967 100644 --- a/numpy/core/shape_base.py +++ b/numpy/core/shape_base.py @@ -1,9 +1,9 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['atleast_1d','atleast_2d','atleast_3d','vstack','hstack'] -import numeric as _nx -from numeric import array, asanyarray, newaxis +from . import numeric as _nx +from .numeric import array, asanyarray, newaxis def atleast_1d(*arys): """ diff --git a/numpy/core/src/multiarray/testcalcs.py b/numpy/core/src/multiarray/testcalcs.py index 78a875406d11..d4b39cb4a3c8 100644 --- a/numpy/core/src/multiarray/testcalcs.py +++ b/numpy/core/src/multiarray/testcalcs.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from scipy import weave diff --git a/numpy/core/tests/test_api.py b/numpy/core/tests/test_api.py index 484b6afbd0a9..92e7d936c6eb 100644 --- a/numpy/core/tests/test_api.py +++ b/numpy/core/tests/test_api.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py index a61aa5161e36..e286aea075d4 100644 --- a/numpy/core/tests/test_arrayprint.py +++ b/numpy/core/tests/test_arrayprint.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -from __future__ import division +from __future__ import division, absolute_import import sys import numpy as np diff --git a/numpy/core/tests/test_blasdot.py b/numpy/core/tests/test_blasdot.py index d6abacfc1e07..1dd56fddd026 100644 --- a/numpy/core/tests/test_blasdot.py +++ b/numpy/core/tests/test_blasdot.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import sys diff --git a/numpy/core/tests/test_datetime.py b/numpy/core/tests/test_datetime.py index 03ee20b09026..eecbfe75bf86 100644 --- a/numpy/core/tests/test_datetime.py +++ b/numpy/core/tests/test_datetime.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os, pickle import numpy diff --git a/numpy/core/tests/test_defchararray.py b/numpy/core/tests/test_defchararray.py index ed928bce139c..d75955075842 100644 --- a/numpy/core/tests/test_defchararray.py +++ b/numpy/core/tests/test_defchararray.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.core import * diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index c7cc9d413fe3..6a248b5cf019 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -3,7 +3,7 @@ to document how deprecations should eventually be turned into errors. """ -from __future__ import division +from __future__ import division, absolute_import import sys import warnings diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py index a08cf48517a9..804c1cf2c393 100644 --- a/numpy/core/tests/test_dtype.py +++ b/numpy/core/tests/test_dtype.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import numpy as np diff --git a/numpy/core/tests/test_einsum.py b/numpy/core/tests/test_einsum.py index 4fba533dba97..ed7d455dcd8a 100644 --- a/numpy/core/tests/test_einsum.py +++ b/numpy/core/tests/test_einsum.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from decimal import Decimal diff --git a/numpy/core/tests/test_errstate.py b/numpy/core/tests/test_errstate.py index c7c5a13ce059..04acafbc9a1e 100644 --- a/numpy/core/tests/test_errstate.py +++ b/numpy/core/tests/test_errstate.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import platform diff --git a/numpy/core/tests/test_function_base.py b/numpy/core/tests/test_function_base.py index 914ffbb14eeb..345e326c2db7 100644 --- a/numpy/core/tests/test_function_base.py +++ b/numpy/core/tests/test_function_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import logspace, linspace diff --git a/numpy/core/tests/test_getlimits.py b/numpy/core/tests/test_getlimits.py index 5d5d9bc44c2f..794d9d0b70f1 100644 --- a/numpy/core/tests/test_getlimits.py +++ b/numpy/core/tests/test_getlimits.py @@ -1,7 +1,7 @@ """ Test functions for limits module. """ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/core/tests/test_half.py b/numpy/core/tests/test_half.py index ed1b3e5dd3eb..a6a3cd05ce01 100644 --- a/numpy/core/tests/test_half.py +++ b/numpy/core/tests/test_half.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import platform diff --git a/numpy/core/tests/test_indexerrors.py b/numpy/core/tests/test_indexerrors.py index 2d74d2ef3243..5ab9b5aef378 100644 --- a/numpy/core/tests/test_indexerrors.py +++ b/numpy/core/tests/test_indexerrors.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import TestCase, run_module_suite, assert_raises, assert_equal, assert_ diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py index 6b8b7b8a8aaa..530fd55836a1 100644 --- a/numpy/core/tests/test_indexing.py +++ b/numpy/core/tests/test_indexing.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.compat import asbytes diff --git a/numpy/core/tests/test_item_selection.py b/numpy/core/tests/test_item_selection.py index ab10b476c37c..d2282e52a61d 100644 --- a/numpy/core/tests/test_item_selection.py +++ b/numpy/core/tests/test_item_selection.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import * diff --git a/numpy/core/tests/test_machar.py b/numpy/core/tests/test_machar.py index 1d2c4211087a..659902d847a1 100644 --- a/numpy/core/tests/test_machar.py +++ b/numpy/core/tests/test_machar.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py index 5daeaa279348..01c80493346c 100644 --- a/numpy/core/tests/test_memmap.py +++ b/numpy/core/tests/test_memmap.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from tempfile import NamedTemporaryFile, mktemp diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index a9a79d38c23e..f4f51b414b13 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import tempfile import sys diff --git a/numpy/core/tests/test_multiarray_assignment.py b/numpy/core/tests/test_multiarray_assignment.py index d5e50624963b..c47979b4d1e1 100644 --- a/numpy/core/tests/test_multiarray_assignment.py +++ b/numpy/core/tests/test_multiarray_assignment.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import TestCase diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py index 219629191f67..ebbe25fd384f 100644 --- a/numpy/core/tests/test_nditer.py +++ b/numpy/core/tests/test_nditer.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy import array, arange, nditer, all diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 6d3cbe92324a..047070cce94d 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import platform diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py index f00aee453267..77fe2daf2faf 100644 --- a/numpy/core/tests/test_numerictypes.py +++ b/numpy/core/tests/test_numerictypes.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/core/tests/test_print.py b/numpy/core/tests/test_print.py index 3b9025d10bd7..67021c20e2eb 100644 --- a/numpy/core/tests/test_print.py +++ b/numpy/core/tests/test_print.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import * diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index 57d128b11634..fa5877538292 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from os import path import numpy as np diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index 69138647e839..19c15b32f882 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import pickle import sys diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index 03b90af7959d..3078c583b996 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py index 3f791e12d7b1..80f5ab622b84 100644 --- a/numpy/core/tests/test_scalarprint.py +++ b/numpy/core/tests/test_scalarprint.py @@ -2,7 +2,7 @@ """ Test printing of scalar types. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import TestCase, assert_, run_module_suite diff --git a/numpy/core/tests/test_shape_base.py b/numpy/core/tests/test_shape_base.py index e0c8197dec58..cc2ff9d1743d 100644 --- a/numpy/core/tests/test_shape_base.py +++ b/numpy/core/tests/test_shape_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import warnings import numpy as np diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 963b2aae71fa..16ae9f50c8b9 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 244ba59a5cb4..cbad84bfc016 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import platform diff --git a/numpy/core/tests/test_umath_complex.py b/numpy/core/tests/test_umath_complex.py index 34977e6839f1..a1368bccda63 100644 --- a/numpy/core/tests/test_umath_complex.py +++ b/numpy/core/tests/test_umath_complex.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import platform diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py index 8941f8e82874..17a3c386b1ea 100644 --- a/numpy/core/tests/test_unicode.py +++ b/numpy/core/tests/test_unicode.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/ctypeslib.py b/numpy/ctypeslib.py index e111fdb83e78..f2c5be52391e 100644 --- a/numpy/ctypeslib.py +++ b/numpy/ctypeslib.py @@ -49,7 +49,7 @@ >>> _lib.foo_func(out, len(out)) #doctest: +SKIP """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['load_library', 'ndpointer', 'test', 'ctypes_load_library', 'c_intp', 'as_ctypes', 'as_array'] diff --git a/numpy/distutils/__init__.py b/numpy/distutils/__init__.py index 5b68de74f942..2a99ef8ad9e3 100644 --- a/numpy/distutils/__init__.py +++ b/numpy/distutils/__init__.py @@ -1,16 +1,16 @@ -from __future__ import division +from __future__ import division, absolute_import import sys if sys.version_info[0] < 3: - from __version__ import version as __version__ + from .__version__ import version as __version__ # Must import local ccompiler ASAP in order to get # customized CCompiler.spawn effective. - import ccompiler - import unixccompiler + from . import ccompiler + from . import unixccompiler - from info import __doc__ - from npy_pkg_config import * + from .info import __doc__ + from .npy_pkg_config import * try: import __config__ diff --git a/numpy/distutils/__version__.py b/numpy/distutils/__version__.py index c9af8cdb1154..e1bc8d30f526 100644 --- a/numpy/distutils/__version__.py +++ b/numpy/distutils/__version__.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import major = 0 minor = 4 diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 4478154f8111..247eead42181 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import re import os @@ -165,7 +165,7 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None, return [] # FIXME:RELATIVE_IMPORT if sys.version_info[0] < 3: - from fcompiler import FCompiler + from .fcompiler import FCompiler else: from numpy.distutils.fcompiler import FCompiler if isinstance(self, FCompiler): diff --git a/numpy/distutils/command/__init__.py b/numpy/distutils/command/__init__.py index 09fe78d225dd..4c4ddbf1f0b0 100644 --- a/numpy/distutils/command/__init__.py +++ b/numpy/distutils/command/__init__.py @@ -4,7 +4,7 @@ commands. """ -from __future__ import division +from __future__ import division, absolute_import def test_na_writable_attributes_deletion(): a = np.NA(2) diff --git a/numpy/distutils/command/autodist.py b/numpy/distutils/command/autodist.py index 2e31fe22a8c1..3d71bb68e2aa 100644 --- a/numpy/distutils/command/autodist.py +++ b/numpy/distutils/command/autodist.py @@ -1,7 +1,7 @@ """This module implements additional tests ala autoconf which can be useful. """ -from __future__ import division +from __future__ import division, absolute_import # We put them here since they could be easily reused outside numpy.distutils diff --git a/numpy/distutils/command/bdist_rpm.py b/numpy/distutils/command/bdist_rpm.py index 302c6fdd266e..004f67b9d1ef 100644 --- a/numpy/distutils/command/bdist_rpm.py +++ b/numpy/distutils/command/bdist_rpm.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/distutils/command/build.py b/numpy/distutils/command/build.py index 239cafe1e60d..f0755373be10 100644 --- a/numpy/distutils/command/build.py +++ b/numpy/distutils/command/build.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index 99144d7b5486..87005e05f526 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -1,6 +1,6 @@ """ Modified version of build_clib that handles fortran source files. """ -from __future__ import division +from __future__ import division, absolute_import import os from glob import glob diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 2245661a5b75..d1092a85b56d 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -1,7 +1,7 @@ """ Modified version of build_ext that handles fortran source files. """ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/distutils/command/build_py.py b/numpy/distutils/command/build_py.py index e8c7b8f839f0..655e56b87fb0 100644 --- a/numpy/distutils/command/build_py.py +++ b/numpy/distutils/command/build_py.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from distutils.command.build_py import build_py as old_build_py from numpy.distutils.misc_util import is_string diff --git a/numpy/distutils/command/build_scripts.py b/numpy/distutils/command/build_scripts.py index 1a3d26d5856a..17cc6aaed257 100644 --- a/numpy/distutils/command/build_scripts.py +++ b/numpy/distutils/command/build_scripts.py @@ -1,7 +1,7 @@ """ Modified version of build_scripts that handles building scripts from functions. """ -from __future__ import division +from __future__ import division, absolute_import from distutils.command.build_scripts import build_scripts as old_build_scripts from numpy.distutils import log diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py index cacfc472bfde..d9a9023b0198 100644 --- a/numpy/distutils/command/build_src.py +++ b/numpy/distutils/command/build_src.py @@ -1,6 +1,6 @@ """ Build swig, f2py, pyrex sources. """ -from __future__ import division +from __future__ import division, absolute_import import os import re diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index 3417fac44698..055fd26a919f 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -2,7 +2,7 @@ # try_compile call. try_run works but is untested for most of Fortran # compilers (they must define linker_exe first). # Pearu Peterson -from __future__ import division +from __future__ import division, absolute_import import os, signal import warnings diff --git a/numpy/distutils/command/config_compiler.py b/numpy/distutils/command/config_compiler.py index 6894b4552864..3303d3469493 100644 --- a/numpy/distutils/command/config_compiler.py +++ b/numpy/distutils/command/config_compiler.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from distutils.core import Command from numpy.distutils import log diff --git a/numpy/distutils/command/develop.py b/numpy/distutils/command/develop.py index 8328effcf5c9..17661e0bd9c2 100644 --- a/numpy/distutils/command/develop.py +++ b/numpy/distutils/command/develop.py @@ -3,7 +3,7 @@ files with filenames. """ -from __future__ import division +from __future__ import division, absolute_import from setuptools.command.develop import develop as old_develop diff --git a/numpy/distutils/command/egg_info.py b/numpy/distutils/command/egg_info.py index 33c64b0e4f63..3a908f602b45 100644 --- a/numpy/distutils/command/egg_info.py +++ b/numpy/distutils/command/egg_info.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from setuptools.command.egg_info import egg_info as _egg_info diff --git a/numpy/distutils/command/install.py b/numpy/distutils/command/install.py index d9b84fc085be..37523c8e40d2 100644 --- a/numpy/distutils/command/install.py +++ b/numpy/distutils/command/install.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys if 'setuptools' in sys.modules: diff --git a/numpy/distutils/command/install_clib.py b/numpy/distutils/command/install_clib.py index 8845cedab134..7753020e5b04 100644 --- a/numpy/distutils/command/install_clib.py +++ b/numpy/distutils/command/install_clib.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os from distutils.core import Command diff --git a/numpy/distutils/command/install_data.py b/numpy/distutils/command/install_data.py index d99d656dbe64..afdc980132a9 100644 --- a/numpy/distutils/command/install_data.py +++ b/numpy/distutils/command/install_data.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys have_setuptools = ('setuptools' in sys.modules) diff --git a/numpy/distutils/command/install_headers.py b/numpy/distutils/command/install_headers.py index 548c3c6437f2..c6c01e35bc09 100644 --- a/numpy/distutils/command/install_headers.py +++ b/numpy/distutils/command/install_headers.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os from distutils.command.install_headers import install_headers as old_install_headers diff --git a/numpy/distutils/command/sdist.py b/numpy/distutils/command/sdist.py index 3e07f7a01c7e..a4e2158ce0bc 100644 --- a/numpy/distutils/command/sdist.py +++ b/numpy/distutils/command/sdist.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys if 'setuptools' in sys.modules: diff --git a/numpy/distutils/compat.py b/numpy/distutils/compat.py index 55b9627d54f5..bd4184dcd99a 100644 --- a/numpy/distutils/compat.py +++ b/numpy/distutils/compat.py @@ -2,7 +2,7 @@ numpy.distutils """ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/distutils/conv_template.py b/numpy/distutils/conv_template.py index 6b969cef3dc1..77e2eb5e1fcc 100644 --- a/numpy/distutils/conv_template.py +++ b/numpy/distutils/conv_template.py @@ -78,7 +78,7 @@ 3, 3, jim """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['process_str', 'process_file'] diff --git a/numpy/distutils/core.py b/numpy/distutils/core.py index f450b1564794..711d5a223ffe 100644 --- a/numpy/distutils/core.py +++ b/numpy/distutils/core.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from distutils.core import * diff --git a/numpy/distutils/cpuinfo.py b/numpy/distutils/cpuinfo.py index 86a18993af5d..1e2d9379cc5e 100644 --- a/numpy/distutils/cpuinfo.py +++ b/numpy/distutils/cpuinfo.py @@ -12,7 +12,7 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['cpu'] diff --git a/numpy/distutils/environment.py b/numpy/distutils/environment.py index 015815cbe612..1360d82fea0c 100644 --- a/numpy/distutils/environment.py +++ b/numpy/distutils/environment.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os from distutils.dist import Distribution diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index a469fc5e0381..9234861584f4 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -44,7 +44,7 @@ - Tests, that send messages to stderr, fail when executed from MSYS prompt because the messages are lost at some point. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['exec_command','find_executable'] diff --git a/numpy/distutils/extension.py b/numpy/distutils/extension.py index 95213644f1e8..f58b27780c9f 100644 --- a/numpy/distutils/extension.py +++ b/numpy/distutils/extension.py @@ -6,7 +6,7 @@ Overridden to support f2py. """ -from __future__ import division +from __future__ import division, absolute_import __revision__ = "$Id: extension.py,v 1.1 2005/04/09 19:29:34 pearu Exp $" diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py index 510a38a58ffb..c0b587fedcfe 100644 --- a/numpy/distutils/fcompiler/__init__.py +++ b/numpy/distutils/fcompiler/__init__.py @@ -13,7 +13,7 @@ But note that FCompiler.executables is actually a dictionary of commands. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['FCompiler','new_fcompiler','show_fcompilers', 'dummy_fortran_file'] diff --git a/numpy/distutils/fcompiler/absoft.py b/numpy/distutils/fcompiler/absoft.py index 7c06d70a3d45..2fb579e354ed 100644 --- a/numpy/distutils/fcompiler/absoft.py +++ b/numpy/distutils/fcompiler/absoft.py @@ -5,7 +5,7 @@ # Notes: # - when using -g77 then use -DUNDERSCORE_G77 to compile f2py # generated extension modules (works for f2py v2.45.241_1936 and up) -from __future__ import division +from __future__ import division, absolute_import import os diff --git a/numpy/distutils/fcompiler/compaq.py b/numpy/distutils/fcompiler/compaq.py index d67c1f24e4fc..16f3a0e546dc 100644 --- a/numpy/distutils/fcompiler/compaq.py +++ b/numpy/distutils/fcompiler/compaq.py @@ -1,6 +1,6 @@ #http://www.compaq.com/fortran/docs/ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/distutils/fcompiler/g95.py b/numpy/distutils/fcompiler/g95.py index 478f48f3efbe..41b7810108bb 100644 --- a/numpy/distutils/fcompiler/g95.py +++ b/numpy/distutils/fcompiler/g95.py @@ -1,5 +1,5 @@ # http://g95.sourceforge.net/ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index c26e81fcd618..80dbf48c6157 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import re import os diff --git a/numpy/distutils/fcompiler/hpux.py b/numpy/distutils/fcompiler/hpux.py index 44bfbe1c2bfe..2501591075c7 100644 --- a/numpy/distutils/fcompiler/hpux.py +++ b/numpy/distutils/fcompiler/hpux.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py index b3126b558a9e..09001c500aa1 100644 --- a/numpy/distutils/fcompiler/ibm.py +++ b/numpy/distutils/fcompiler/ibm.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import re diff --git a/numpy/distutils/fcompiler/intel.py b/numpy/distutils/fcompiler/intel.py index 53ea7af05747..b975d1f1bcf4 100644 --- a/numpy/distutils/fcompiler/intel.py +++ b/numpy/distutils/fcompiler/intel.py @@ -1,5 +1,5 @@ # http://developer.intel.com/software/products/compilers/flin/ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/distutils/fcompiler/lahey.py b/numpy/distutils/fcompiler/lahey.py index 06c4c6f5646c..208f09a273fa 100644 --- a/numpy/distutils/fcompiler/lahey.py +++ b/numpy/distutils/fcompiler/lahey.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os diff --git a/numpy/distutils/fcompiler/mips.py b/numpy/distutils/fcompiler/mips.py index 6cd2fdfaca09..433f053e3e7d 100644 --- a/numpy/distutils/fcompiler/mips.py +++ b/numpy/distutils/fcompiler/mips.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.cpuinfo import cpu from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/nag.py b/numpy/distutils/fcompiler/nag.py index 11253c4be019..8cbd15f60f66 100644 --- a/numpy/distutils/fcompiler/nag.py +++ b/numpy/distutils/fcompiler/nag.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/none.py b/numpy/distutils/fcompiler/none.py index e99c2ab35c8c..ee7e6dee9a5e 100644 --- a/numpy/distutils/fcompiler/none.py +++ b/numpy/distutils/fcompiler/none.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/pathf95.py b/numpy/distutils/fcompiler/pathf95.py index c9bd58c628a0..3b3c31e00405 100644 --- a/numpy/distutils/fcompiler/pathf95.py +++ b/numpy/distutils/fcompiler/pathf95.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/pg.py b/numpy/distutils/fcompiler/pg.py index e0f5e0d44c99..959f86d68e10 100644 --- a/numpy/distutils/fcompiler/pg.py +++ b/numpy/distutils/fcompiler/pg.py @@ -1,5 +1,5 @@ # http://www.pgroup.com -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.fcompiler import FCompiler from sys import platform diff --git a/numpy/distutils/fcompiler/sun.py b/numpy/distutils/fcompiler/sun.py index 7deeac29a66d..bff37a543732 100644 --- a/numpy/distutils/fcompiler/sun.py +++ b/numpy/distutils/fcompiler/sun.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.distutils.ccompiler import simple_version_match from numpy.distutils.fcompiler import FCompiler diff --git a/numpy/distutils/fcompiler/vast.py b/numpy/distutils/fcompiler/vast.py index bddc1be910c7..2d6d164a1762 100644 --- a/numpy/distutils/fcompiler/vast.py +++ b/numpy/distutils/fcompiler/vast.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os diff --git a/numpy/distutils/from_template.py b/numpy/distutils/from_template.py index 99f36e371288..dc933dd6ad12 100644 --- a/numpy/distutils/from_template.py +++ b/numpy/distutils/from_template.py @@ -45,7 +45,7 @@ """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['process_str','process_file'] diff --git a/numpy/distutils/info.py b/numpy/distutils/info.py index 4d8b847bdd58..de3dc4f489de 100644 --- a/numpy/distutils/info.py +++ b/numpy/distutils/info.py @@ -1,6 +1,6 @@ """ Enhanced distutils with Fortran compilers support and more. """ -from __future__ import division +from __future__ import division, absolute_import postpone_import = True diff --git a/numpy/distutils/intelccompiler.py b/numpy/distutils/intelccompiler.py index 8c3af095772e..58208647d383 100644 --- a/numpy/distutils/intelccompiler.py +++ b/numpy/distutils/intelccompiler.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from distutils.unixccompiler import UnixCCompiler from numpy.distutils.exec_command import find_executable diff --git a/numpy/distutils/lib2def.py b/numpy/distutils/lib2def.py index 0e98e17efaf9..b2c4f1f285d8 100644 --- a/numpy/distutils/lib2def.py +++ b/numpy/distutils/lib2def.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import re import sys diff --git a/numpy/distutils/line_endings.py b/numpy/distutils/line_endings.py index f18850716dbf..93f5421c04e3 100644 --- a/numpy/distutils/line_endings.py +++ b/numpy/distutils/line_endings.py @@ -1,7 +1,7 @@ """ Functions for converting from DOS to UNIX line endings """ -from __future__ import division +from __future__ import division, absolute_import import sys, re, os diff --git a/numpy/distutils/log.py b/numpy/distutils/log.py index a3f4cb9ffb65..41c9a56da791 100644 --- a/numpy/distutils/log.py +++ b/numpy/distutils/log.py @@ -1,5 +1,5 @@ # Colored log, requires Python 2.3 or up. -from __future__ import division +from __future__ import division, absolute_import import sys from distutils.log import * @@ -7,7 +7,7 @@ from distutils.log import _global_log if sys.version_info[0] < 3: - from misc_util import red_text, default_text, cyan_text, green_text, is_sequence, is_string + from .misc_util import red_text, default_text, cyan_text, green_text, is_sequence, is_string else: from numpy.distutils.misc_util import red_text, default_text, cyan_text, green_text, is_sequence, is_string diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 10e3608eff93..0505309fa607 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -7,7 +7,7 @@ # 3. Force windows to use g77 """ -from __future__ import division +from __future__ import division, absolute_import import os import subprocess @@ -19,7 +19,7 @@ import numpy.distutils.ccompiler if sys.version_info[0] < 3: - import log + from . import log else: from numpy.distutils import log # NT stuff diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 20cacb7596f8..f526557d60b1 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import re @@ -1990,7 +1990,7 @@ def get_info(self,*names): Return information (from system_info.get_info) for all of the names in the argument list in a single dictionary. """ - from system_info import get_info, dict_append + from .system_info import get_info, dict_append info_dict = {} for a in names: dict_append(info_dict,**get_info(a)) diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py index 6f307288562a..2dacbbc70ac7 100644 --- a/numpy/distutils/npy_pkg_config.py +++ b/numpy/distutils/npy_pkg_config.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys if sys.version_info[0] < 3: diff --git a/numpy/distutils/numpy_distribution.py b/numpy/distutils/numpy_distribution.py index 276f81398712..353e18a51d67 100644 --- a/numpy/distutils/numpy_distribution.py +++ b/numpy/distutils/numpy_distribution.py @@ -1,5 +1,5 @@ # XXX: Handle setuptools ? -from __future__ import division +from __future__ import division, absolute_import from distutils.core import Distribution diff --git a/numpy/distutils/pathccompiler.py b/numpy/distutils/pathccompiler.py index 2e5b76a53b12..e847e7d0a1c6 100644 --- a/numpy/distutils/pathccompiler.py +++ b/numpy/distutils/pathccompiler.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from distutils.unixccompiler import UnixCCompiler diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 869bd6bd1ddc..68ad926e3366 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -110,7 +110,7 @@ NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. """ -from __future__ import division +from __future__ import division, absolute_import import sys import os @@ -929,7 +929,7 @@ def __init__(self): if mklroot is None: system_info.__init__(self) else: - from cpuinfo import cpu + from .cpuinfo import cpu l = 'mkl' # use shared library if cpu.is_Itanium(): plt = '64' diff --git a/numpy/distutils/tests/f2py_ext/__init__.py b/numpy/distutils/tests/f2py_ext/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/distutils/tests/f2py_ext/__init__.py +++ b/numpy/distutils/tests/f2py_ext/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/distutils/tests/f2py_ext/tests/test_fib2.py b/numpy/distutils/tests/f2py_ext/tests/test_fib2.py index 696ee41d8dfb..149256d72876 100644 --- a/numpy/distutils/tests/f2py_ext/tests/test_fib2.py +++ b/numpy/distutils/tests/f2py_ext/tests/test_fib2.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/f2py_f90_ext/__init__.py b/numpy/distutils/tests/f2py_f90_ext/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/distutils/tests/f2py_f90_ext/__init__.py +++ b/numpy/distutils/tests/f2py_f90_ext/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py b/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py index 3fa7b3730b42..d68981c04354 100644 --- a/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py +++ b/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/gen_ext/__init__.py b/numpy/distutils/tests/gen_ext/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/distutils/tests/gen_ext/__init__.py +++ b/numpy/distutils/tests/gen_ext/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/distutils/tests/gen_ext/tests/test_fib3.py b/numpy/distutils/tests/gen_ext/tests/test_fib3.py index 3fa72036e3d9..0f194255d6a0 100644 --- a/numpy/distutils/tests/gen_ext/tests/test_fib3.py +++ b/numpy/distutils/tests/gen_ext/tests/test_fib3.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/pyrex_ext/__init__.py b/numpy/distutils/tests/pyrex_ext/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/distutils/tests/pyrex_ext/__init__.py +++ b/numpy/distutils/tests/pyrex_ext/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/distutils/tests/pyrex_ext/tests/test_primes.py b/numpy/distutils/tests/pyrex_ext/tests/test_primes.py index 96f73c426f7a..a2bb091ea241 100644 --- a/numpy/distutils/tests/pyrex_ext/tests/test_primes.py +++ b/numpy/distutils/tests/pyrex_ext/tests/test_primes.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/swig_ext/__init__.py b/numpy/distutils/tests/swig_ext/__init__.py index b06eaf1a45e4..52119d5cd53a 100644 --- a/numpy/distutils/tests/swig_ext/__init__.py +++ b/numpy/distutils/tests/swig_ext/__init__.py @@ -1 +1 @@ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/distutils/tests/swig_ext/tests/test_example.py b/numpy/distutils/tests/swig_ext/tests/test_example.py index 5a4765fa7f59..419ca53d8beb 100644 --- a/numpy/distutils/tests/swig_ext/tests/test_example.py +++ b/numpy/distutils/tests/swig_ext/tests/test_example.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/swig_ext/tests/test_example2.py b/numpy/distutils/tests/swig_ext/tests/test_example2.py index c3c4727c03c4..f876bad16fa6 100644 --- a/numpy/distutils/tests/swig_ext/tests/test_example2.py +++ b/numpy/distutils/tests/swig_ext/tests/test_example2.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys from numpy.testing import * diff --git a/numpy/distutils/tests/test_fcompiler_gnu.py b/numpy/distutils/tests/test_fcompiler_gnu.py index d3b38db235f8..09a7275f8cce 100644 --- a/numpy/distutils/tests/test_fcompiler_gnu.py +++ b/numpy/distutils/tests/test_fcompiler_gnu.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/distutils/tests/test_fcompiler_intel.py b/numpy/distutils/tests/test_fcompiler_intel.py index 4ebf1a0c0c4f..8e3ba5fd3dab 100644 --- a/numpy/distutils/tests/test_fcompiler_intel.py +++ b/numpy/distutils/tests/test_fcompiler_intel.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/distutils/tests/test_misc_util.py b/numpy/distutils/tests/test_misc_util.py index 57fde88998a7..b19c09f81ec2 100644 --- a/numpy/distutils/tests/test_misc_util.py +++ b/numpy/distutils/tests/test_misc_util.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.distutils.misc_util import appendpath, minrelpath, gpaths, rel_path diff --git a/numpy/distutils/tests/test_npy_pkg_config.py b/numpy/distutils/tests/test_npy_pkg_config.py index d3568eb6b121..e25f47d76dee 100644 --- a/numpy/distutils/tests/test_npy_pkg_config.py +++ b/numpy/distutils/tests/test_npy_pkg_config.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os from tempfile import mkstemp diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py index 837ce5092c6d..2825a899bf5e 100644 --- a/numpy/distutils/unixccompiler.py +++ b/numpy/distutils/unixccompiler.py @@ -2,7 +2,7 @@ unixccompiler - can handle very long argument lists for ar. """ -from __future__ import division +from __future__ import division, absolute_import import os @@ -12,7 +12,7 @@ from numpy.distutils.compat import get_exception if sys.version_info[0] < 3: - import log + from . import log else: from numpy.distutils import log diff --git a/numpy/doc/__init__.py b/numpy/doc/__init__.py index 19b3d87dbc61..028d0c343277 100644 --- a/numpy/doc/__init__.py +++ b/numpy/doc/__init__.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os diff --git a/numpy/doc/basics.py b/numpy/doc/basics.py index d50388282f2f..b56d61380ad6 100644 --- a/numpy/doc/basics.py +++ b/numpy/doc/basics.py @@ -136,5 +136,5 @@ methods arrays do. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/broadcasting.py b/numpy/doc/broadcasting.py index be6cde0bd585..bbbd5bdcc8c4 100644 --- a/numpy/doc/broadcasting.py +++ b/numpy/doc/broadcasting.py @@ -175,5 +175,5 @@ for illustrations of broadcasting concepts. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/byteswapping.py b/numpy/doc/byteswapping.py index 395c858ed596..df767f1bc92f 100644 --- a/numpy/doc/byteswapping.py +++ b/numpy/doc/byteswapping.py @@ -135,5 +135,5 @@ False """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/constants.py b/numpy/doc/constants.py index 10f41a7bac92..5fe93fa2b342 100644 --- a/numpy/doc/constants.py +++ b/numpy/doc/constants.py @@ -10,7 +10,7 @@ # # Note: the docstring is autogenerated. # -from __future__ import division +from __future__ import division, absolute_import import textwrap, re diff --git a/numpy/doc/creation.py b/numpy/doc/creation.py index f14b163e67e8..045b476e3532 100644 --- a/numpy/doc/creation.py +++ b/numpy/doc/creation.py @@ -141,5 +141,5 @@ diagonal). """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/glossary.py b/numpy/doc/glossary.py index 35adfc820fb2..02b291b64aee 100644 --- a/numpy/doc/glossary.py +++ b/numpy/doc/glossary.py @@ -415,5 +415,5 @@ and f2py (which wraps Fortran). """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/howtofind.py b/numpy/doc/howtofind.py index 8e6793c4858f..e456a742278e 100644 --- a/numpy/doc/howtofind.py +++ b/numpy/doc/howtofind.py @@ -7,5 +7,5 @@ How to find things in NumPy. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/indexing.py b/numpy/doc/indexing.py index 84f300dcdca6..821240efd7c8 100644 --- a/numpy/doc/indexing.py +++ b/numpy/doc/indexing.py @@ -405,5 +405,5 @@ 40 """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/internals.py b/numpy/doc/internals.py index d7b6d3c93b23..ed2991a323c3 100644 --- a/numpy/doc/internals.py +++ b/numpy/doc/internals.py @@ -160,5 +160,5 @@ it is more in line with Python semantics and the natural order of the data. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/io.py b/numpy/doc/io.py index 4ee4c7c2ff36..a212b969720b 100644 --- a/numpy/doc/io.py +++ b/numpy/doc/io.py @@ -7,5 +7,5 @@ Placeholder for array I/O documentation. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/jargon.py b/numpy/doc/jargon.py index 3bf4d50709de..68467481618d 100644 --- a/numpy/doc/jargon.py +++ b/numpy/doc/jargon.py @@ -7,5 +7,5 @@ Placeholder for computer science, engineering and other jargon. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/methods_vs_functions.py b/numpy/doc/methods_vs_functions.py index 902ec54d0423..7090190c04d1 100644 --- a/numpy/doc/methods_vs_functions.py +++ b/numpy/doc/methods_vs_functions.py @@ -7,5 +7,5 @@ Placeholder for Methods vs. Functions documentation. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/misc.py b/numpy/doc/misc.py index 9195ebb5a847..a16698a20d12 100644 --- a/numpy/doc/misc.py +++ b/numpy/doc/misc.py @@ -226,5 +226,5 @@ 5) SIP (used mainly in PyQT) """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/performance.py b/numpy/doc/performance.py index 711dd3153860..e2ca2c53e234 100644 --- a/numpy/doc/performance.py +++ b/numpy/doc/performance.py @@ -7,5 +7,5 @@ Placeholder for Improving Performance documentation. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/structured_arrays.py b/numpy/doc/structured_arrays.py index eeb8a949f058..cd308c1cfc2c 100644 --- a/numpy/doc/structured_arrays.py +++ b/numpy/doc/structured_arrays.py @@ -221,5 +221,5 @@ `_. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/subclassing.py b/numpy/doc/subclassing.py index 19bdd425f0b2..8734a0567d35 100644 --- a/numpy/doc/subclassing.py +++ b/numpy/doc/subclassing.py @@ -557,5 +557,5 @@ def __array_wrap__(self, arr, context=None): """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/doc/ufuncs.py b/numpy/doc/ufuncs.py index d566ee98a46b..a1de5681fd0d 100644 --- a/numpy/doc/ufuncs.py +++ b/numpy/doc/ufuncs.py @@ -135,5 +135,5 @@ a convenient way to apply these operators. """ -from __future__ import division +from __future__ import division, absolute_import diff --git a/numpy/dual.py b/numpy/dual.py index 15b175b92a08..481e42d0c1c6 100644 --- a/numpy/dual.py +++ b/numpy/dual.py @@ -10,7 +10,7 @@ .. _Scipy : http://www.scipy.org """ -from __future__ import division +from __future__ import division, absolute_import # This module should be used for functions both in numpy and scipy if # you want to use the numpy version if available but the scipy version diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py index 12add21530cb..951544588d4b 100644 --- a/numpy/f2py/__init__.py +++ b/numpy/f2py/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import __all__ = ['run_main','compile','f2py_testing'] @@ -7,11 +7,11 @@ import sys import commands -import f2py2e -import f2py_testing -import diagnose +from . import f2py2e +from . import f2py_testing +from . import diagnose -from info import __doc__ +from .info import __doc__ run_main = f2py2e.run_main main = f2py2e.main diff --git a/numpy/f2py/__version__.py b/numpy/f2py/__version__.py index 2f842c89d7fa..44791aa37d1b 100644 --- a/numpy/f2py/__version__.py +++ b/numpy/f2py/__version__.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import major = 2 diff --git a/numpy/f2py/auxfuncs.py b/numpy/f2py/auxfuncs.py index 0f68953ad27a..5b13747f1aef 100644 --- a/numpy/f2py/auxfuncs.py +++ b/numpy/f2py/auxfuncs.py @@ -14,17 +14,17 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.65 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version import pprint import sys import types -import cfuncs +from . import cfuncs errmess=sys.stderr.write @@ -522,7 +522,7 @@ def getcallprotoargument(rout,cb_map={}): if hascallstatement(rout): outmess('warning: callstatement is defined without callprotoargument\n') return - from capi_maps import getctype + from .capi_maps import getctype arg_types,arg_types2 = [],[] if l_and(isstringfunction,l_not(isfunction_wrap))(rout): arg_types.extend(['char*','size_t']) diff --git a/numpy/f2py/capi_maps.py b/numpy/f2py/capi_maps.py index d82b2c3f5945..117ea2233443 100644 --- a/numpy/f2py/capi_maps.py +++ b/numpy/f2py/capi_maps.py @@ -11,20 +11,20 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.60 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version import copy import re import os import sys -from auxfuncs import * -from crackfortran import markoutercomma -import cb_rules +from .auxfuncs import * +from .crackfortran import markoutercomma +from . import cb_rules # Numarray and Numeric users should set this False using_newcore = True diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py index 05404add26b7..bc565a904704 100644 --- a/numpy/f2py/cb_rules.py +++ b/numpy/f2py/cb_rules.py @@ -13,11 +13,11 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.53 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version @@ -28,8 +28,8 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * -import cfuncs +from .auxfuncs import * +from . import cfuncs ################## Rules for callback function ############## @@ -416,7 +416,7 @@ def buildcallbacks(m): def buildcallback(rout,um): global cb_map - import capi_maps + from . import capi_maps outmess('\tConstructing call-back function "cb_%s_in_%s"\n'%(rout['name'],um)) args,depargs=getargs(rout) diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index ccadd94e30c0..a0110c530c74 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -14,11 +14,11 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.75 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version import types @@ -1117,7 +1117,7 @@ """ def buildcfuncs(): - from capi_maps import c2capi_map + from .capi_maps import c2capi_map for k in c2capi_map.keys(): m='pyarr_from_p_%s1'%k cppmacros[m]='#define %s(v) (PyArray_SimpleNewFromData(0,NULL,%s,(char *)v))'%(m,c2capi_map[k]) diff --git a/numpy/f2py/common_rules.py b/numpy/f2py/common_rules.py index db7a6ee6da9c..aec0ef1b1c6f 100644 --- a/numpy/f2py/common_rules.py +++ b/numpy/f2py/common_rules.py @@ -13,11 +13,11 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.19 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version import pprint @@ -26,10 +26,10 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * -import capi_maps -import func2subr -from crackfortran import rmbadname +from .auxfuncs import * +from . import capi_maps +from . import func2subr +from .crackfortran import rmbadname ############## def findcommonblocks(block,top=1): diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 95ebcaee42d4..2a7f137d2329 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -138,11 +138,11 @@ The above may be solved by creating appropriate preprocessor program, for example. """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.177 $"[10:-1] import platform -import __version__ +from . import __version__ f2py_version = __version__.version # @@ -153,7 +153,7 @@ import pprint import os import copy -from auxfuncs import * +from .auxfuncs import * # Global flags: strictf77=1 # Ignore `!' comments unless line[0]=='!' diff --git a/numpy/f2py/diagnose.py b/numpy/f2py/diagnose.py index e7759b6ddff8..59ef5205ba85 100644 --- a/numpy/f2py/diagnose.py +++ b/numpy/f2py/diagnose.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/f2py/doc/collectinput.py b/numpy/f2py/doc/collectinput.py index 5e98c8350cff..078da8eebaae 100755 --- a/numpy/f2py/doc/collectinput.py +++ b/numpy/f2py/doc/collectinput.py @@ -19,7 +19,7 @@ collectinput # in and out are stdin and stdout """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "0.0" diff --git a/numpy/f2py/docs/pytest.py b/numpy/f2py/docs/pytest.py index b49dc764ad9c..40d6b0c5edb9 100644 --- a/numpy/f2py/docs/pytest.py +++ b/numpy/f2py/docs/pytest.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import #File: pytest.py import Numeric diff --git a/numpy/f2py/docs/usersguide/setup_example.py b/numpy/f2py/docs/usersguide/setup_example.py index 911dc3324e92..e80bc493b763 100644 --- a/numpy/f2py/docs/usersguide/setup_example.py +++ b/numpy/f2py/docs/usersguide/setup_example.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # File: setup_example.py diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py index 235fcb75a8bc..aee8afba0ac4 100755 --- a/numpy/f2py/f2py2e.py +++ b/numpy/f2py/f2py2e.py @@ -14,9 +14,9 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import -import __version__ +from . import __version__ f2py_version = __version__.version import sys @@ -28,12 +28,12 @@ #outmess=sys.stdout.write show=pprint.pprint -import crackfortran -import rules -import cb_rules -import auxfuncs -import cfuncs -import f90mod_rules +from . import crackfortran +from . import rules +from . import cb_rules +from . import auxfuncs +from . import cfuncs +from . import f90mod_rules outmess = auxfuncs.outmess diff --git a/numpy/f2py/f2py_testing.py b/numpy/f2py/f2py_testing.py index 73eb2caed164..b0f396ad4d35 100644 --- a/numpy/f2py/f2py_testing.py +++ b/numpy/f2py/f2py_testing.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import re diff --git a/numpy/f2py/f90mod_rules.py b/numpy/f2py/f90mod_rules.py index 3a80eb8f46e3..bc571371bad0 100644 --- a/numpy/f2py/f90mod_rules.py +++ b/numpy/f2py/f90mod_rules.py @@ -13,7 +13,7 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.27 $"[10:-1] @@ -25,11 +25,11 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * +from .auxfuncs import * import numpy as np -import capi_maps -import func2subr -from crackfortran import undo_rmbadname, undo_rmbadname1 +from . import capi_maps +from . import func2subr +from .crackfortran import undo_rmbadname, undo_rmbadname1 options={} @@ -84,7 +84,7 @@ def findf90modules(m): def buildhooks(pymod): global fgetdims1,fgetdims2 - import rules + from . import rules ret = {'f90modhooks':[],'initf90modhooks':[],'body':[], 'need':['F_FUNC','arrayobject.h'], 'separatorsfor':{'includes0':'\n','includes':'\n'}, diff --git a/numpy/f2py/func2subr.py b/numpy/f2py/func2subr.py index eb72c76c9463..7597e43ae09e 100644 --- a/numpy/f2py/func2subr.py +++ b/numpy/f2py/func2subr.py @@ -13,7 +13,7 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.16 $"[10:-1] @@ -26,7 +26,7 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * +from .auxfuncs import * def var2fixfortran(vars,a,fa=None,f90mode=None): if fa is None: fa = a diff --git a/numpy/f2py/info.py b/numpy/f2py/info.py index b976fb2ea0b1..07a750588ded 100644 --- a/numpy/f2py/info.py +++ b/numpy/f2py/info.py @@ -1,6 +1,6 @@ """Fortran to Python Interface Generator. """ -from __future__ import division +from __future__ import division, absolute_import postpone_import = True diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index b04f54e16bd4..38c43b4ae4fd 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -50,11 +50,11 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.129 $"[10:-1] -import __version__ +from . import __version__ f2py_version = __version__.version import pprint @@ -66,14 +66,14 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * -import capi_maps -from capi_maps import * -import cfuncs -import common_rules -import use_rules -import f90mod_rules -import func2subr +from .auxfuncs import * +from . import capi_maps +from .capi_maps import * +from . import cfuncs +from . import common_rules +from . import use_rules +from . import f90mod_rules +from . import func2subr options={} sepdict={} diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py index ff8c16cd1819..586833e68f71 100644 --- a/numpy/f2py/tests/test_array_from_pyobj.py +++ b/numpy/f2py/tests/test_array_from_pyobj.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import unittest import os diff --git a/numpy/f2py/tests/test_assumed_shape.py b/numpy/f2py/tests/test_assumed_shape.py index 728c034ec87d..19a5575303c1 100644 --- a/numpy/f2py/tests/test_assumed_shape.py +++ b/numpy/f2py/tests/test_assumed_shape.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import math diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py index f903fbcb44fa..51b1bb1b424f 100644 --- a/numpy/f2py/tests/test_callback.py +++ b/numpy/f2py/tests/test_callback.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_kind.py b/numpy/f2py/tests/test_kind.py index 56a74709678a..d24099b05bd5 100644 --- a/numpy/f2py/tests/test_kind.py +++ b/numpy/f2py/tests/test_kind.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import math diff --git a/numpy/f2py/tests/test_mixed.py b/numpy/f2py/tests/test_mixed.py index dc29d2b5d493..d62098ab4be0 100644 --- a/numpy/f2py/tests/test_mixed.py +++ b/numpy/f2py/tests/test_mixed.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import math diff --git a/numpy/f2py/tests/test_return_character.py b/numpy/f2py/tests/test_return_character.py index fd8355ac3dd3..5a68bec72f13 100644 --- a/numpy/f2py/tests/test_return_character.py +++ b/numpy/f2py/tests/test_return_character.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_return_complex.py b/numpy/f2py/tests/test_return_complex.py index 4cdc0399316c..00ba1cfe6b6a 100644 --- a/numpy/f2py/tests/test_return_complex.py +++ b/numpy/f2py/tests/test_return_complex.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_return_integer.py b/numpy/f2py/tests/test_return_integer.py index a1af6b9326c8..6c55cc1b96dc 100644 --- a/numpy/f2py/tests/test_return_integer.py +++ b/numpy/f2py/tests/test_return_integer.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_return_logical.py b/numpy/f2py/tests/test_return_logical.py index 1c8dce532f17..af35c50d165a 100644 --- a/numpy/f2py/tests/test_return_logical.py +++ b/numpy/f2py/tests/test_return_logical.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_return_real.py b/numpy/f2py/tests/test_return_real.py index 943a4972daac..0ea4373fbb53 100644 --- a/numpy/f2py/tests/test_return_real.py +++ b/numpy/f2py/tests/test_return_real.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy import array diff --git a/numpy/f2py/tests/test_size.py b/numpy/f2py/tests/test_size.py index 72443b4f6c22..1a41ce9720df 100644 --- a/numpy/f2py/tests/test_size.py +++ b/numpy/f2py/tests/test_size.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import math diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py index 215df95537b4..0da4bc310e78 100644 --- a/numpy/f2py/tests/util.py +++ b/numpy/f2py/tests/util.py @@ -5,7 +5,7 @@ - detecting if compilers are present """ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/f2py/use_rules.py b/numpy/f2py/use_rules.py index e47dfc6e56c0..c027baef8699 100644 --- a/numpy/f2py/use_rules.py +++ b/numpy/f2py/use_rules.py @@ -15,7 +15,7 @@ Pearu Peterson """ -from __future__ import division +from __future__ import division, absolute_import __version__ = "$Revision: 1.3 $"[10:-1] @@ -27,7 +27,7 @@ outmess=sys.stdout.write show=pprint.pprint -from auxfuncs import * +from .auxfuncs import * ############## usemodule_rules={ diff --git a/numpy/fft/__init__.py b/numpy/fft/__init__.py index 6cfa535fb9d3..001ac59b0092 100644 --- a/numpy/fft/__init__.py +++ b/numpy/fft/__init__.py @@ -1,10 +1,10 @@ -from __future__ import division +from __future__ import division, absolute_import # To get sub-modules -from info import __doc__ +from .info import __doc__ -from fftpack import * -from helper import * +from .fftpack import * +from .helper import * from numpy.testing import Tester test = Tester().test diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py index d229f0702316..59ab5d9db873 100644 --- a/numpy/fft/fftpack.py +++ b/numpy/fft/fftpack.py @@ -30,14 +30,14 @@ version of the FFTPACK routines. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['fft','ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn', 'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn'] from numpy.core import asarray, zeros, swapaxes, shape, conjugate, \ take -import fftpack_lite as fftpack +from . import fftpack_lite as fftpack _fft_cache = {} _real_fft_cache = {} diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py index c22c92d76347..910ccc9a2a2e 100644 --- a/numpy/fft/helper.py +++ b/numpy/fft/helper.py @@ -2,7 +2,7 @@ Discrete Fourier Transforms - helper.py """ -from __future__ import division +from __future__ import division, absolute_import # Created by Pearu Peterson, September 2002 diff --git a/numpy/fft/info.py b/numpy/fft/info.py index 9fb98eda68d5..6b5a1db79032 100644 --- a/numpy/fft/info.py +++ b/numpy/fft/info.py @@ -174,6 +174,6 @@ For examples, see the various functions. """ -from __future__ import division +from __future__ import division, absolute_import depends = ['core'] diff --git a/numpy/fft/tests/test_fftpack.py b/numpy/fft/tests/test_fftpack.py index dceb3bd89bb5..b592d788d44b 100644 --- a/numpy/fft/tests/test_fftpack.py +++ b/numpy/fft/tests/test_fftpack.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal diff --git a/numpy/fft/tests/test_helper.py b/numpy/fft/tests/test_helper.py index b20e6ddc348b..a57cbd81a8d1 100644 --- a/numpy/fft/tests/test_helper.py +++ b/numpy/fft/tests/test_helper.py @@ -4,7 +4,7 @@ Copied from fftpack.helper by Pearu Peterson, October 2005 """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal diff --git a/numpy/lib/__init__.py b/numpy/lib/__init__.py index 5679a2dc80bd..37c06c014dcf 100644 --- a/numpy/lib/__init__.py +++ b/numpy/lib/__init__.py @@ -1,26 +1,26 @@ -from __future__ import division +from __future__ import division, absolute_import -from info import __doc__ +from .info import __doc__ from numpy.version import version as __version__ -from type_check import * -from index_tricks import * -from function_base import * -from shape_base import * -from stride_tricks import * -from twodim_base import * -from ufunclike import * +from .type_check import * +from .index_tricks import * +from .function_base import * +from .shape_base import * +from .stride_tricks import * +from .twodim_base import * +from .ufunclike import * -import scimath as emath -from polynomial import * +from . import scimath as emath +from .polynomial import * #import convertcode -from utils import * -from arraysetops import * -from npyio import * -from financial import * +from .utils import * +from .arraysetops import * +from .npyio import * +from .financial import * import math -from arrayterator import * -from arraypad import * +from .arrayterator import * +from .arraypad import * __all__ = ['emath','math'] __all__ += type_check.__all__ diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py index d5424e8d3e6e..db97c550747c 100644 --- a/numpy/lib/_datasource.py +++ b/numpy/lib/_datasource.py @@ -31,7 +31,7 @@ >>> fp.close() """ -from __future__ import division +from __future__ import division, absolute_import __docformat__ = "restructuredtext en" diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index aa37442044d7..87ce9b01de3b 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -1,7 +1,7 @@ """A collection of functions designed to help I/O with ascii files. """ -from __future__ import division +from __future__ import division, absolute_import __docformat__ = "restructuredtext en" diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py index bfb96fc2459c..fbf65904a41c 100644 --- a/numpy/lib/arraypad.py +++ b/numpy/lib/arraypad.py @@ -3,7 +3,7 @@ of an n-dimensional array. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index 61bb817216e0..e3a39342fbf2 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -24,7 +24,7 @@ :Author: Robert Cimrman """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['ediff1d', 'intersect1d', 'setxor1d', 'union1d', 'setdiff1d', 'unique', 'in1d'] diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py index 6f6953a22285..b71e9a123efd 100644 --- a/numpy/lib/arrayterator.py +++ b/numpy/lib/arrayterator.py @@ -7,7 +7,7 @@ a user-specified number of elements. """ -from __future__ import division +from __future__ import division, absolute_import from operator import mul diff --git a/numpy/lib/financial.py b/numpy/lib/financial.py index 5887a9224ee4..2a3295bfe7e9 100644 --- a/numpy/lib/financial.py +++ b/numpy/lib/financial.py @@ -8,7 +8,7 @@ or arrays (or other sequences). """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np diff --git a/numpy/lib/format.py b/numpy/lib/format.py index 9a558f40c986..21b0607e7b51 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -134,7 +134,7 @@ alternatives, is described fully in the "npy-format" NEP. """ -from __future__ import division +from __future__ import division, absolute_import import cPickle diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 540092d45703..9ca72bf417be 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __docformat__ = "restructuredtext en" __all__ = ['select', 'piecewise', 'trim_zeros', 'copy', 'iterable', @@ -26,11 +26,11 @@ from numpy.core.numerictypes import typecodes, number from numpy.core import atleast_1d, atleast_2d from numpy.lib.twodim_base import diag -from _compiled_base import _insert, add_docstring -from _compiled_base import digitize, bincount, interp as compiled_interp -from arraysetops import setdiff1d -from utils import deprecate -from _compiled_base import add_newdoc_ufunc +from ._compiled_base import _insert, add_docstring +from ._compiled_base import digitize, bincount, interp as compiled_interp +from .arraysetops import setdiff1d +from .utils import deprecate +from ._compiled_base import add_newdoc_ufunc import numpy as np import collections diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 07e7c1e39c9d..ad9af9840073 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['ravel_multi_index', 'unravel_index', @@ -16,9 +16,9 @@ from numpy.core.numerictypes import find_common_type import math -import function_base +from . import function_base import numpy.matrixlib as matrix -from function_base import diff +from .function_base import diff from numpy.lib._compiled_base import ravel_multi_index, unravel_index from numpy.lib.stride_tricks import as_strided makemat = matrix.matrix diff --git a/numpy/lib/info.py b/numpy/lib/info.py index 1a2154951aa9..de94f0a19605 100644 --- a/numpy/lib/info.py +++ b/numpy/lib/info.py @@ -145,7 +145,7 @@ ================ =================== """ -from __future__ import division +from __future__ import division, absolute_import depends = ['core','testing'] global_symbols = ['*'] diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index bd96a17f61f7..065a3ba46f35 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1,11 +1,11 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['savetxt', 'loadtxt', 'genfromtxt', 'ndfromtxt', 'mafromtxt', 'recfromtxt', 'recfromcsv', 'load', 'loads', 'save', 'savez', 'savez_compressed', 'packbits', 'unpackbits', 'fromregex', 'DataSource'] import numpy as np -import format +from . import format import sys import os import re @@ -16,10 +16,10 @@ from operator import itemgetter from cPickle import load as _cload, loads -from _datasource import DataSource -from _compiled_base import packbits, unpackbits +from ._datasource import DataSource +from ._compiled_base import packbits, unpackbits -from _iotools import LineSplitter, NameValidator, StringConverter, \ +from ._iotools import LineSplitter, NameValidator, StringConverter, \ ConverterError, ConverterLockError, ConversionWarning, \ _is_string_like, has_nested_fields, flatten_dtype, \ easy_dtype, _bytes_to_name diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index de83016e98e4..2d455e33ab0e 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -2,7 +2,7 @@ Functions to operate on polynomials. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index c72cf20595a1..9f0beff59c63 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -5,7 +5,7 @@ They have been rewritten and extended for convenience. """ -from __future__ import division +from __future__ import division, absolute_import import sys import itertools diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py index 00fc4bccd3a7..0457e120ccaa 100644 --- a/numpy/lib/scimath.py +++ b/numpy/lib/scimath.py @@ -15,7 +15,7 @@ correctly handled. See their respective docstrings for specific examples. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos', 'arcsin', 'arctanh'] diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 1aa8f686c742..909f6faa81ba 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['column_stack','row_stack', 'dstack','array_split','split','hsplit', 'vsplit','dsplit','apply_over_axes','expand_dims', diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py index b82537024ad1..70457c19f24b 100644 --- a/numpy/lib/stride_tricks.py +++ b/numpy/lib/stride_tricks.py @@ -5,7 +5,7 @@ NumPy reference guide. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py index f025b947e2ab..e784e429693a 100644 --- a/numpy/lib/tests/test__datasource.py +++ b/numpy/lib/tests/test__datasource.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os from tempfile import mkdtemp, mkstemp, NamedTemporaryFile diff --git a/numpy/lib/tests/test__iotools.py b/numpy/lib/tests/test__iotools.py index 6416b6d7a4a5..ebb01ad3a5d3 100644 --- a/numpy/lib/tests/test__iotools.py +++ b/numpy/lib/tests/test__iotools.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index e70c06aebf87..0a87acb3606c 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -1,7 +1,7 @@ """Tests for the pad functions. """ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import TestCase, run_module_suite, assert_array_equal from numpy.testing import assert_raises, assert_array_almost_equal diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index cab7a86b12b1..b0a2e429d0f2 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -1,7 +1,7 @@ """Test functions for 1D array set operations. """ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy as np diff --git a/numpy/lib/tests/test_arrayterator.py b/numpy/lib/tests/test_arrayterator.py index 5064ab496d0d..28feb482490b 100644 --- a/numpy/lib/tests/test_arrayterator.py +++ b/numpy/lib/tests/test_arrayterator.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from operator import mul diff --git a/numpy/lib/tests/test_financial.py b/numpy/lib/tests/test_financial.py index d11195f0de63..56681dbb4691 100644 --- a/numpy/lib/tests/test_financial.py +++ b/numpy/lib/tests/test_financial.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy as np diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 320cef3d2805..5c07da1c381f 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import r''' Test the .npy file format. diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 73af90386a8e..406bad40b0b1 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import warnings import numpy as np diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 2b42fdc2c735..02516cab7784 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy as np diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index ba28cf73a7f1..ab990976ea5a 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys import gzip diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index fc2b49c81168..4a110d58eef0 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import ''' >>> p = np.poly1d([1.,2,3]) diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 6a0ad1609a53..f38a6914c58a 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py index e0a3a424da92..9e303d2b1a84 100644 --- a/numpy/lib/tests/test_regression.py +++ b/numpy/lib/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.testing.utils import _assert_valid_refcount diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 70c4d33ac70f..9aaf3d08644e 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.lib import * diff --git a/numpy/lib/tests/test_stride_tricks.py b/numpy/lib/tests/test_stride_tricks.py index 0ac1c279b6bc..b6408fe1986e 100644 --- a/numpy/lib/tests/test_stride_tricks.py +++ b/numpy/lib/tests/test_stride_tricks.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import * diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py index f6b4ba4c3783..e2d24464ae90 100644 --- a/numpy/lib/tests/test_twodim_base.py +++ b/numpy/lib/tests/test_twodim_base.py @@ -1,7 +1,7 @@ """Test functions for matrix module """ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index c4f4a62990de..c1204cec4b48 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.lib import * diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index 0f688b021edf..d4505266ccb0 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy.core as nx diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py index 534806ff280c..4b386e0b13a8 100644 --- a/numpy/lib/tests/test_utils.py +++ b/numpy/lib/tests/test_utils.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy.lib.utils as utils diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index 92df5306de77..b2e74e07af29 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -1,7 +1,7 @@ """ Basic functions for manipulating 2d arrays """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu', 'tril','vander','histogram2d','mask_indices', diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 895c4d406051..b59cf13aa8a9 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -1,7 +1,7 @@ """Automatically adapted for numpy Sep 19, 2005 by convertcode.py """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['iscomplexobj','isrealobj','imag','iscomplex', 'isreal','nan_to_num','real','real_if_close', @@ -11,7 +11,7 @@ import numpy.core.numeric as _nx from numpy.core.numeric import asarray, asanyarray, array, isnan, \ obj2sctype, zeros -from ufunclike import isneginf, isposinf +from .ufunclike import isneginf, isposinf _typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?' diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py index 8b85ef7701b4..a71dab0d0e2c 100644 --- a/numpy/lib/ufunclike.py +++ b/numpy/lib/ufunclike.py @@ -3,7 +3,7 @@ storing results in an output array. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['fix', 'isneginf', 'isposinf'] diff --git a/numpy/lib/user_array.py b/numpy/lib/user_array.py index 51ab10520d5f..e6871f489477 100644 --- a/numpy/lib/user_array.py +++ b/numpy/lib/user_array.py @@ -4,7 +4,7 @@ complete. """ -from __future__ import division +from __future__ import division, absolute_import from numpy.core import array, asarray, absolute, add, subtract, multiply, \ divide, remainder, power, left_shift, right_shift, bitwise_and, \ diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 2e70bfd15ef3..9a8776098026 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/linalg/__init__.py b/numpy/linalg/__init__.py index ed281abee2b6..d0a5de983c7b 100644 --- a/numpy/linalg/__init__.py +++ b/numpy/linalg/__init__.py @@ -42,12 +42,12 @@ =============== ========================================================== """ -from __future__ import division +from __future__ import division, absolute_import # To get sub-modules -from info import __doc__ +from .info import __doc__ -from linalg import * +from .linalg import * from numpy.testing import Tester test = Tester().test diff --git a/numpy/linalg/info.py b/numpy/linalg/info.py index 45b91db18464..14d9ab1f72ab 100644 --- a/numpy/linalg/info.py +++ b/numpy/linalg/info.py @@ -32,6 +32,6 @@ - LinAlgError Indicates a failed linear algebra operation """ -from __future__ import division +from __future__ import division, absolute_import depends = ['core'] diff --git a/numpy/linalg/lapack_lite/clapack_scrub.py b/numpy/linalg/lapack_lite/clapack_scrub.py index 10ee543b9dc0..22f818e918ea 100644 --- a/numpy/linalg/lapack_lite/clapack_scrub.py +++ b/numpy/linalg/lapack_lite/clapack_scrub.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2.4 -from __future__ import division +from __future__ import division, absolute_import import sys, os from cStringIO import StringIO diff --git a/numpy/linalg/lapack_lite/fortran.py b/numpy/linalg/lapack_lite/fortran.py index 6fff7231229e..6aad0ba8c724 100644 --- a/numpy/linalg/lapack_lite/fortran.py +++ b/numpy/linalg/lapack_lite/fortran.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import re import itertools diff --git a/numpy/linalg/lapack_lite/make_lite.py b/numpy/linalg/lapack_lite/make_lite.py index 1fea7c049098..7e48a5a375a0 100755 --- a/numpy/linalg/lapack_lite/make_lite.py +++ b/numpy/linalg/lapack_lite/make_lite.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import import sys, os import fortran diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 7e7833c2645a..c66ab8c3a69a 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -8,7 +8,7 @@ dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, zgetrf, dpotrf, zpotrf, dgeqrf, zgeqrf, zungqr, dorgqr. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['matrix_power', 'solve', 'tensorsolve', 'tensorinv', 'inv', diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py index 4a151d3f4a46..0e7dc3629c91 100644 --- a/numpy/linalg/tests/test_build.py +++ b/numpy/linalg/tests/test_build.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from subprocess import call, PIPE, Popen import sys diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index fb8f89fe9570..6750f059d663 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -1,6 +1,6 @@ """ Test functions for linalg module """ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py index 9ca56e9fff9d..c3e01c38354c 100644 --- a/numpy/linalg/tests/test_regression.py +++ b/numpy/linalg/tests/test_regression.py @@ -1,6 +1,6 @@ """ Test functions for linalg module """ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/ma/__init__.py b/numpy/ma/__init__.py index 7388a7ce3ca2..3113e538c523 100644 --- a/numpy/ma/__init__.py +++ b/numpy/ma/__init__.py @@ -36,18 +36,18 @@ invalid operation. """ -from __future__ import division +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' __revision__ = "$Revision: 3473 $" __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' -import core -from core import * +from . import core +from .core import * -import extras -from extras import * +from . import extras +from .extras import * __all__ = ['core', 'extras'] __all__ += core.__all__ diff --git a/numpy/ma/bench.py b/numpy/ma/bench.py index df6933eb9051..7500245c3577 100644 --- a/numpy/ma/bench.py +++ b/numpy/ma/bench.py @@ -1,6 +1,6 @@ #! python # encoding: utf-8 -from __future__ import division +from __future__ import division, absolute_import import timeit #import IPython.ipapi diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 371d5f302ab0..3299262d10b2 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -20,7 +20,7 @@ """ # pylint: disable-msg=E1002 -from __future__ import division +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant" diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 77d2dbb3639b..795e7540225e 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -8,7 +8,7 @@ :version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' @@ -38,8 +38,8 @@ import itertools import warnings -import core as ma -from core import MaskedArray, MAError, add, array, asarray, concatenate, count, \ +from . import core as ma +from .core import MaskedArray, MAError, add, array, asarray, concatenate, count, \ filled, getmask, getmaskarray, make_mask_descr, masked, masked_array, \ mask_or, nomask, ones, sort, zeros #from core import * diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py index 084859d0786f..ae31986bc64a 100644 --- a/numpy/ma/mrecords.py +++ b/numpy/ma/mrecords.py @@ -8,7 +8,7 @@ :author: Pierre Gerard-Marchant """ -from __future__ import division +from __future__ import division, absolute_import #!!!: * We should make sure that no field is called '_mask','mask','_fieldmask', #!!!: or whatever restricted keywords. diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index a11bf69436e4..383e4a907fcf 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 +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant" diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index 3f25ac21cba7..c32e689c3000 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -7,7 +7,7 @@ :version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division +from __future__ import division, absolute_import __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 4e59b8e41208..d6f8d9765aeb 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 +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __revision__ = "$Revision: 3473 $" diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py index b04e8ab37d06..41f7779d94b8 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 +from __future__ import division, absolute_import import numpy import types diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index 85c290160568..e5fea0c5275d 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import 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 ce3d8c88961f..6b8ff0769dec 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 +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index 3707dcc1603b..882db2b89740 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 +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = "1.0" @@ -21,7 +21,7 @@ from numpy.testing import * import numpy.testing.utils as utils -from core import mask_or, getmask, masked_array, nomask, masked, filled, \ +from .core import mask_or, getmask, masked_array, nomask, masked, filled, \ equal, less #------------------------------------------------------------------------------ diff --git a/numpy/ma/timer_comparison.py b/numpy/ma/timer_comparison.py index adc1fa22b169..549448689b80 100644 --- a/numpy/ma/timer_comparison.py +++ b/numpy/ma/timer_comparison.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import timeit diff --git a/numpy/ma/version.py b/numpy/ma/version.py index 73281311d42a..cf9a95572c01 100644 --- a/numpy/ma/version.py +++ b/numpy/ma/version.py @@ -1,14 +1,14 @@ """Version number """ -from __future__ import division +from __future__ import division, absolute_import version = '1.00' release = False if not release: - import core - import extras + from . import core + from . import extras revision = [core.__revision__.split(':')[-1][:-1].strip(), extras.__revision__.split(':')[-1][:-1].strip(),] version += '.dev%04i' % max([int(rev) for rev in revision]) diff --git a/numpy/matlib.py b/numpy/matlib.py index ae053373bdc7..df683573f23f 100644 --- a/numpy/matlib.py +++ b/numpy/matlib.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.matrixlib.defmatrix import matrix, asmatrix diff --git a/numpy/matrixlib/__init__.py b/numpy/matrixlib/__init__.py index dc9a6bca9647..bb826cd39e84 100644 --- a/numpy/matrixlib/__init__.py +++ b/numpy/matrixlib/__init__.py @@ -1,9 +1,9 @@ """Sub-package containing the matrix class and related functions. """ -from __future__ import division +from __future__ import division, absolute_import -from defmatrix import * +from .defmatrix import * __all__ = defmatrix.__all__ diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py index f0299ee8853a..cf47fadf81bc 100644 --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index 28b563977850..c67b447b8f7c 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * from numpy.core import * diff --git a/numpy/matrixlib/tests/test_multiarray.py b/numpy/matrixlib/tests/test_multiarray.py index 6247a1c489e0..d58adb3a2e4c 100644 --- a/numpy/matrixlib/tests/test_multiarray.py +++ b/numpy/matrixlib/tests/test_multiarray.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import * diff --git a/numpy/matrixlib/tests/test_numeric.py b/numpy/matrixlib/tests/test_numeric.py index 5539dac0d305..7b690fbef167 100644 --- a/numpy/matrixlib/tests/test_numeric.py +++ b/numpy/matrixlib/tests/test_numeric.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import assert_equal, TestCase from numpy.core import ones diff --git a/numpy/matrixlib/tests/test_regression.py b/numpy/matrixlib/tests/test_regression.py index ae352f09c973..da5131bc6f3e 100644 --- a/numpy/matrixlib/tests/test_regression.py +++ b/numpy/matrixlib/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * import numpy as np diff --git a/numpy/numarray/__init__.py b/numpy/numarray/__init__.py index 964ee2baaadf..f7a487cdfce3 100644 --- a/numpy/numarray/__init__.py +++ b/numpy/numarray/__init__.py @@ -1,18 +1,18 @@ -from __future__ import division +from __future__ import division, absolute_import -from util import * -from numerictypes import * -from functions import * -from ufuncs import * -from compat import * -from session import * +from .util import * +from .numerictypes import * +from .functions import * +from .ufuncs import * +from .compat import * +from .session import * -import util -import numerictypes -import functions -import ufuncs -import compat -import session +from . import util +from . import numerictypes +from . import functions +from . import ufuncs +from . import compat +from . import session __all__ = ['session', 'numerictypes'] __all__ += util.__all__ diff --git a/numpy/numarray/alter_code1.py b/numpy/numarray/alter_code1.py index 2393aff5a70d..09370549dd20 100644 --- a/numpy/numarray/alter_code1.py +++ b/numpy/numarray/alter_code1.py @@ -52,7 +52,7 @@ - .setimaginary() --> .imag """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['convertfile', 'convertall', 'converttree', 'convertsrc'] diff --git a/numpy/numarray/alter_code2.py b/numpy/numarray/alter_code2.py index 4d76222da10b..df248a92447f 100644 --- a/numpy/numarray/alter_code2.py +++ b/numpy/numarray/alter_code2.py @@ -5,7 +5,7 @@ FIXME: finish this. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = [] diff --git a/numpy/numarray/compat.py b/numpy/numarray/compat.py index 794a2d591f6e..24e20be17bfa 100644 --- a/numpy/numarray/compat.py +++ b/numpy/numarray/compat.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['NewAxis', 'ArrayType'] diff --git a/numpy/numarray/convolve.py b/numpy/numarray/convolve.py index 14c16f008d6d..af7330fc7e98 100644 --- a/numpy/numarray/convolve.py +++ b/numpy/numarray/convolve.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import try: from stsci.convolve import * diff --git a/numpy/numarray/fft.py b/numpy/numarray/fft.py index 158c8807e85c..4adf1d3bb90f 100644 --- a/numpy/numarray/fft.py +++ b/numpy/numarray/fft.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.oldnumeric.fft import * import numpy.oldnumeric.fft as nof diff --git a/numpy/numarray/functions.py b/numpy/numarray/functions.py index 2e12a4149d14..2492d5f3f3c6 100644 --- a/numpy/numarray/functions.py +++ b/numpy/numarray/functions.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import # missing Numarray defined names (in from numarray import *) @@ -40,7 +40,7 @@ resize, searchsorted, shape, size, sort, swapaxes, trace, transpose import numpy as np -from numerictypes import typefrom +from .numerictypes import typefrom if sys.version_info[0] >= 3: import copyreg as copy_reg diff --git a/numpy/numarray/image.py b/numpy/numarray/image.py index 112fdac9eeee..bcfa09afdfef 100644 --- a/numpy/numarray/image.py +++ b/numpy/numarray/image.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import try: from stsci.image import * diff --git a/numpy/numarray/linear_algebra.py b/numpy/numarray/linear_algebra.py index 1c716e05b6ca..3b92d09d18c7 100644 --- a/numpy/numarray/linear_algebra.py +++ b/numpy/numarray/linear_algebra.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.oldnumeric.linear_algebra import * diff --git a/numpy/numarray/ma.py b/numpy/numarray/ma.py index 2b820a98da60..f220362aeda3 100644 --- a/numpy/numarray/ma.py +++ b/numpy/numarray/ma.py @@ -1,3 +1,3 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.oldnumeric.ma import * diff --git a/numpy/numarray/matrix.py b/numpy/numarray/matrix.py index 723613c638d1..bd10f82789f2 100644 --- a/numpy/numarray/matrix.py +++ b/numpy/numarray/matrix.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['Matrix'] diff --git a/numpy/numarray/mlab.py b/numpy/numarray/mlab.py index 70ccf077a8d1..d530c8a0570c 100644 --- a/numpy/numarray/mlab.py +++ b/numpy/numarray/mlab.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.oldnumeric.mlab import * import numpy.oldnumeric.mlab as nom diff --git a/numpy/numarray/nd_image.py b/numpy/numarray/nd_image.py index a9a7ee1f4a1c..d73788ed349b 100644 --- a/numpy/numarray/nd_image.py +++ b/numpy/numarray/nd_image.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import try: from ndimage import * diff --git a/numpy/numarray/numerictypes.py b/numpy/numarray/numerictypes.py index ef1ccb2a37ad..b51706ec3b92 100644 --- a/numpy/numarray/numerictypes.py +++ b/numpy/numarray/numerictypes.py @@ -27,7 +27,7 @@ $Id: numerictypes.py,v 1.55 2005/12/01 16:22:03 jaytmiller Exp $ """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['NumericType','HasUInt64','typeDict','IsType', diff --git a/numpy/numarray/random_array.py b/numpy/numarray/random_array.py index 654f583463e6..6f56e9cf9ab2 100644 --- a/numpy/numarray/random_array.py +++ b/numpy/numarray/random_array.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['ArgumentError', 'F', 'beta', 'binomial', 'chi_square', 'exponential', 'gamma', 'get_seed', 'multinomial', diff --git a/numpy/numarray/session.py b/numpy/numarray/session.py index fab80a1e22c9..32a28cca018e 100644 --- a/numpy/numarray/session.py +++ b/numpy/numarray/session.py @@ -72,7 +72,7 @@ which is not restored by a simple import is lost. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['load', 'save'] diff --git a/numpy/numarray/ufuncs.py b/numpy/numarray/ufuncs.py index 357972c792bf..a5b72c3fb2b1 100644 --- a/numpy/numarray/ufuncs.py +++ b/numpy/numarray/ufuncs.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['abs', 'absolute', 'add', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'bitwise_and', 'bitwise_not', diff --git a/numpy/numarray/util.py b/numpy/numarray/util.py index 819987cbff95..acdb18fc8668 100644 --- a/numpy/numarray/util.py +++ b/numpy/numarray/util.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import numpy as np diff --git a/numpy/oldnumeric/__init__.py b/numpy/oldnumeric/__init__.py index 68bd39e45f4c..ff8c0088544d 100644 --- a/numpy/oldnumeric/__init__.py +++ b/numpy/oldnumeric/__init__.py @@ -1,7 +1,7 @@ """Don't add these to the __all__ variable though """ -from __future__ import division +from __future__ import division, absolute_import from numpy import * @@ -15,17 +15,17 @@ def _move_axis_to_0(a, axis): return transpose(a, axes) # Add these -from compat import * -from functions import * -from precision import * -from ufuncs import * -from misc import * - -import compat -import precision -import functions -import misc -import ufuncs +from .compat import * +from .functions import * +from .precision import * +from .ufuncs import * +from .misc import * + +from . import compat +from . import precision +from . import functions +from . import misc +from . import ufuncs import numpy __version__ = numpy.__version__ diff --git a/numpy/oldnumeric/alter_code1.py b/numpy/oldnumeric/alter_code1.py index 5eb1c99f21d0..f970994e4721 100644 --- a/numpy/oldnumeric/alter_code1.py +++ b/numpy/oldnumeric/alter_code1.py @@ -29,7 +29,7 @@ isinstance(..., ) """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['convertfile', 'convertall', 'converttree', 'convertsrc'] diff --git a/numpy/oldnumeric/alter_code2.py b/numpy/oldnumeric/alter_code2.py index 61f285f63450..6d33efd600d1 100644 --- a/numpy/oldnumeric/alter_code2.py +++ b/numpy/oldnumeric/alter_code2.py @@ -19,7 +19,7 @@ oldnumeric.random_array, and oldnumeric.fft """ -from __future__ import division +from __future__ import division, absolute_import #__all__ = ['convertfile', 'convertall', 'converttree'] __all__ = [] diff --git a/numpy/oldnumeric/array_printer.py b/numpy/oldnumeric/array_printer.py index 7c0428c14a0c..f14872821e03 100644 --- a/numpy/oldnumeric/array_printer.py +++ b/numpy/oldnumeric/array_printer.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['array2string'] diff --git a/numpy/oldnumeric/arrayfns.py b/numpy/oldnumeric/arrayfns.py index 1db219d4aba6..03f816db88aa 100644 --- a/numpy/oldnumeric/arrayfns.py +++ b/numpy/oldnumeric/arrayfns.py @@ -1,7 +1,7 @@ """Backward compatible with arrayfns from Numeric. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span', diff --git a/numpy/oldnumeric/compat.py b/numpy/oldnumeric/compat.py index 0c18917d0612..46c3c727ffc2 100644 --- a/numpy/oldnumeric/compat.py +++ b/numpy/oldnumeric/compat.py @@ -1,7 +1,7 @@ """Compatibility module containing deprecated names. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['NewAxis', 'UFuncType', 'UfuncType', 'ArrayType', 'arraytype', @@ -16,7 +16,7 @@ import numpy.core.multiarray as multiarray import numpy.core.umath as um from numpy.core.numeric import array -import functions +from . import functions import sys from cPickle import dump, dumps @@ -78,7 +78,7 @@ def load(fp): return loads(fp.read()) def _LoadArray(fp): - import typeconv + from . import typeconv ln = fp.readline().split() if ln[0][0] == 'A': ln[0] = ln[0][1:] typecode = ln[0][0] diff --git a/numpy/oldnumeric/fft.py b/numpy/oldnumeric/fft.py index ace7d27d98d4..7ea554e4a851 100644 --- a/numpy/oldnumeric/fft.py +++ b/numpy/oldnumeric/fft.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['fft', 'fft2d', 'fftnd', 'hermite_fft', 'inverse_fft', 'inverse_fft2d', 'inverse_fftnd', diff --git a/numpy/oldnumeric/fix_default_axis.py b/numpy/oldnumeric/fix_default_axis.py index 262f82859bf7..cefa672399f0 100644 --- a/numpy/oldnumeric/fix_default_axis.py +++ b/numpy/oldnumeric/fix_default_axis.py @@ -34,7 +34,7 @@ mean """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['convertfile', 'convertall', 'converttree'] diff --git a/numpy/oldnumeric/functions.py b/numpy/oldnumeric/functions.py index 1e4daef5d06a..50c11e32c741 100644 --- a/numpy/oldnumeric/functions.py +++ b/numpy/oldnumeric/functions.py @@ -1,12 +1,12 @@ """Functions that should behave the same as Numeric and need changing """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.core.multiarray as mu import numpy.core.numeric as nn -from typeconv import convtypecode, convtypecode2 +from .typeconv import convtypecode, convtypecode2 __all__ = ['take', 'repeat', 'sum', 'product', 'sometrue', 'alltrue', 'cumsum', 'cumproduct', 'compress', 'fromfunction', diff --git a/numpy/oldnumeric/linear_algebra.py b/numpy/oldnumeric/linear_algebra.py index a8600c77d1ec..e850cd792e98 100644 --- a/numpy/oldnumeric/linear_algebra.py +++ b/numpy/oldnumeric/linear_algebra.py @@ -6,7 +6,7 @@ zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, dpotrf. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['LinAlgError', 'solve_linear_equations', 'inverse', 'cholesky_decomposition', 'eigenvalues', diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py index 46af041bacce..b449d619ccd1 100644 --- a/numpy/oldnumeric/ma.py +++ b/numpy/oldnumeric/ma.py @@ -9,7 +9,7 @@ (mainly) Paul Dubois. """ -from __future__ import division +from __future__ import division, absolute_import import types, sys diff --git a/numpy/oldnumeric/matrix.py b/numpy/oldnumeric/matrix.py index 9be08e93c156..e76f8935f47e 100644 --- a/numpy/oldnumeric/matrix.py +++ b/numpy/oldnumeric/matrix.py @@ -1,12 +1,12 @@ """This module is for compatibility only. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['UserArray', 'squeeze', 'Matrix', 'asarray', 'dot', 'k', 'Numeric', 'LinearAlgebra', 'identity', 'multiply', 'types', 'string'] import types -from user_array import UserArray, asarray +from .user_array import UserArray, asarray import numpy.oldnumeric as Numeric from numpy.oldnumeric import dot, identity, multiply import numpy.oldnumeric.linear_algebra as LinearAlgebra diff --git a/numpy/oldnumeric/misc.py b/numpy/oldnumeric/misc.py index 3871d82511ee..8f1e1ae962fa 100644 --- a/numpy/oldnumeric/misc.py +++ b/numpy/oldnumeric/misc.py @@ -1,7 +1,7 @@ """Functions that already have the correct syntax or miscellaneous functions """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['sort', 'copy_reg', 'clip', 'rank', 'sign', 'shape', 'types', 'allclose', 'size', @@ -35,4 +35,4 @@ correlate as cross_correlate, \ place as insert -from array_printer import array2string +from .array_printer import array2string diff --git a/numpy/oldnumeric/mlab.py b/numpy/oldnumeric/mlab.py index e2ea78c02434..d4063f65e734 100644 --- a/numpy/oldnumeric/mlab.py +++ b/numpy/oldnumeric/mlab.py @@ -1,7 +1,7 @@ """This module is for compatibility only. All functions are defined elsewhere. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle', 'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort', @@ -21,7 +21,7 @@ from numpy.random import rand, randn import numpy as np -from typeconv import convtypecode +from .typeconv import convtypecode def eye(N, M=None, k=0, typecode=None, dtype=None): """ eye returns a N-by-M 2-d array where the k-th diagonal is all ones, @@ -98,17 +98,17 @@ def corrcoef(x, y=None): d = diag(c) return c/sqrt(multiply.outer(d,d)) -from compat import * -from functions import * -from precision import * -from ufuncs import * -from misc import * - -import compat -import precision -import functions -import misc -import ufuncs +from .compat import * +from .functions import * +from .precision import * +from .ufuncs import * +from .misc import * + +from . import compat +from . import precision +from . import functions +from . import misc +from . import ufuncs import numpy __version__ = numpy.__version__ diff --git a/numpy/oldnumeric/precision.py b/numpy/oldnumeric/precision.py index c6579f30273f..7c85f21fcf42 100644 --- a/numpy/oldnumeric/precision.py +++ b/numpy/oldnumeric/precision.py @@ -6,13 +6,13 @@ which is the only Incompatibility with Numeric """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['Character', 'Complex', 'Float', 'PrecisionError', 'PyObject', 'Int', 'UInt', 'UnsignedInt', 'UnsignedInteger', 'string', 'typecodes', 'zeros'] -from functions import zeros +from .functions import zeros import string # for backwards compatibility typecodes = {'Character':'c', 'Integer':'bhil', 'UnsignedInteger':'BHIL', 'Float':'fd', 'Complex':'FD'} diff --git a/numpy/oldnumeric/random_array.py b/numpy/oldnumeric/random_array.py index a7f6c4112913..4dcddda127ca 100644 --- a/numpy/oldnumeric/random_array.py +++ b/numpy/oldnumeric/random_array.py @@ -1,7 +1,7 @@ """Backward compatible module for RandomArray """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['ArgumentError','F','beta','binomial','chi_square', 'exponential', 'gamma', 'get_seed', 'mean_var_test', 'multinomial', diff --git a/numpy/oldnumeric/rng.py b/numpy/oldnumeric/rng.py index 28fb9d5919e4..3ad0b4190d37 100644 --- a/numpy/oldnumeric/rng.py +++ b/numpy/oldnumeric/rng.py @@ -4,7 +4,7 @@ It is for backwards compatibility only. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['CreateGenerator','ExponentialDistribution','LogNormalDistribution', 'NormalDistribution', 'UniformDistribution', 'error', 'ranf', diff --git a/numpy/oldnumeric/rng_stats.py b/numpy/oldnumeric/rng_stats.py index 96e50f9a4dfc..43d763046c1e 100644 --- a/numpy/oldnumeric/rng_stats.py +++ b/numpy/oldnumeric/rng_stats.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['average', 'histogram', 'standardDeviation', 'variance'] diff --git a/numpy/oldnumeric/tests/test_oldnumeric.py b/numpy/oldnumeric/tests/test_oldnumeric.py index 58ccc710ab7e..488b2b471526 100644 --- a/numpy/oldnumeric/tests/test_oldnumeric.py +++ b/numpy/oldnumeric/tests/test_oldnumeric.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import unittest diff --git a/numpy/oldnumeric/tests/test_regression.py b/numpy/oldnumeric/tests/test_regression.py index dd221699da7c..d169d6f3f2f5 100644 --- a/numpy/oldnumeric/tests/test_regression.py +++ b/numpy/oldnumeric/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import * diff --git a/numpy/oldnumeric/typeconv.py b/numpy/oldnumeric/typeconv.py index 014477950d54..c3a27f5a33f5 100644 --- a/numpy/oldnumeric/typeconv.py +++ b/numpy/oldnumeric/typeconv.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2', 'oldtypecodes'] diff --git a/numpy/oldnumeric/ufuncs.py b/numpy/oldnumeric/ufuncs.py index 9ace30a91657..7da0b5a93f30 100644 --- a/numpy/oldnumeric/ufuncs.py +++ b/numpy/oldnumeric/ufuncs.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['less', 'cosh', 'arcsinh', 'add', 'ceil', 'arctan2', 'floor_divide', 'fmod', 'hypot', 'logical_and', 'power', 'sinh', 'remainder', 'cos', diff --git a/numpy/oldnumeric/user_array.py b/numpy/oldnumeric/user_array.py index 08be8135b986..8d2421f4a5ec 100644 --- a/numpy/oldnumeric/user_array.py +++ b/numpy/oldnumeric/user_array.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.oldnumeric import * from numpy.lib.user_array import container as UserArray diff --git a/numpy/polynomial/__init__.py b/numpy/polynomial/__init__.py index 6847208282c7..1e9919614296 100644 --- a/numpy/polynomial/__init__.py +++ b/numpy/polynomial/__init__.py @@ -13,16 +13,16 @@ information can be found in the docstring for the module of interest. """ -from __future__ import division +from __future__ import division, absolute_import import warnings -from polynomial import Polynomial -from chebyshev import Chebyshev -from legendre import Legendre -from hermite import Hermite -from hermite_e import HermiteE -from laguerre import Laguerre +from .polynomial import Polynomial +from .chebyshev import Chebyshev +from .legendre import Legendre +from .hermite import Hermite +from .hermite_e import HermiteE +from .laguerre import Laguerre from numpy.testing import Tester test = Tester().test diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 9576a46979d6..dde4966e74e6 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -85,13 +85,13 @@ (preprint: http://www.math.hmc.edu/~benjamin/papers/CombTrig.pdf, pg. 4) """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate __all__ = ['chebzero', 'chebone', 'chebx', 'chebdomain', 'chebline', 'chebadd', 'chebsub', 'chebmulx', 'chebmul', 'chebdiv', 'chebpow', @@ -416,7 +416,7 @@ def cheb2poly(c) : array([ -2., -8., 4., 12.]) """ - from polynomial import polyadd, polysub, polymulx + from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index b410902ea7ec..51a0f2fe0d4f 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -57,13 +57,13 @@ `numpy.polynomial` """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate __all__ = ['hermzero', 'hermone', 'hermx', 'hermdomain', 'hermline', 'hermadd', 'hermsub', 'hermmulx', 'hermmul', 'hermdiv', 'hermpow', @@ -160,7 +160,7 @@ def herm2poly(c) : array([ 0., 1., 2., 3.]) """ - from polynomial import polyadd, polysub, polymulx + from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index 4d3bcd338659..9ae3c70670fc 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -57,13 +57,13 @@ `numpy.polynomial` """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate __all__ = ['hermezero', 'hermeone', 'hermex', 'hermedomain', 'hermeline', 'hermeadd', 'hermesub', 'hermemulx', 'hermemul', 'hermediv', 'hermpow', @@ -160,7 +160,7 @@ def herme2poly(c) : array([ 0., 1., 2., 3.]) """ - from polynomial import polyadd, polysub, polymulx + from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index 7b77ea819ca9..874088b2c19e 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -57,13 +57,13 @@ `numpy.polynomial` """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate __all__ = ['lagzero', 'lagone', 'lagx', 'lagdomain', 'lagline', 'lagadd', 'lagsub', 'lagmulx', 'lagmul', 'lagdiv', 'lagpow', @@ -159,7 +159,7 @@ def lag2poly(c) : array([ 0., 1., 2., 3.]) """ - from polynomial import polyadd, polysub, polymulx + from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index 5b88b628748a..ba49cbc576e1 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -81,13 +81,13 @@ numpy.polynomial.hermite_e """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate __all__ = ['legzero', 'legone', 'legx', 'legdomain', 'legline', 'legadd', 'legsub', 'legmulx', 'legmul', 'legdiv', 'legpow', 'legval', @@ -191,7 +191,7 @@ def leg2poly(c) : """ - from polynomial import polyadd, polysub, polymulx + from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index e174fdd962b0..b9a14972ec45 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -52,7 +52,7 @@ `numpy.polynomial` """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['polyzero', 'polyone', 'polyx', 'polydomain', 'polyline', 'polyadd', 'polysub', 'polymulx', 'polymul', 'polydiv', 'polypow', @@ -62,9 +62,9 @@ import numpy as np import numpy.linalg as la -import polyutils as pu +from . import polyutils as pu import warnings -from polytemplate import polytemplate +from .polytemplate import polytemplate polytrim = pu.trimcoef diff --git a/numpy/polynomial/polytemplate.py b/numpy/polynomial/polytemplate.py index 7d67c914cdbc..adf32170fb39 100644 --- a/numpy/polynomial/polytemplate.py +++ b/numpy/polynomial/polytemplate.py @@ -9,21 +9,16 @@ etc.) in the future, such that all these classes will have a common API. """ -from __future__ import division +from __future__ import division, absolute_import import string import sys -if sys.version_info[0] >= 3: - rel_import = "from . import" -else: - rel_import = "import" - polytemplate = string.Template(''' -from __future__ import division +from __future__ import division, absolute_import import numpy as np import warnings -REL_IMPORT polyutils as pu +from . import polyutils as pu class $name(pu.PolyBase) : """A $name series class. @@ -918,4 +913,4 @@ def cast(series, domain=$domain, window=$domain): """ return series.convert(domain, $name, window) -'''.replace('REL_IMPORT', rel_import)) +''') diff --git a/numpy/polynomial/polyutils.py b/numpy/polynomial/polyutils.py index 8861328c497a..0d3343b04907 100644 --- a/numpy/polynomial/polyutils.py +++ b/numpy/polynomial/polyutils.py @@ -31,7 +31,7 @@ - `mapparms` -- parameters of the linear map between domains. """ -from __future__ import division +from __future__ import division, absolute_import __all__ = ['RankWarning', 'PolyError', 'PolyDomainError', 'PolyBase', 'as_series', 'trimseq', 'trimcoef', 'getdomain', 'mapdomain', diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py index b5f1d567247d..2bf73d02bd81 100644 --- a/numpy/polynomial/tests/test_chebyshev.py +++ b/numpy/polynomial/tests/test_chebyshev.py @@ -1,7 +1,7 @@ """Tests for chebyshev module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.chebyshev as cheb diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py index fb0d359e084f..2439fc8add9f 100644 --- a/numpy/polynomial/tests/test_classes.py +++ b/numpy/polynomial/tests/test_classes.py @@ -3,7 +3,7 @@ This tests the convert and cast methods of all the polynomial classes. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.polynomial import ( diff --git a/numpy/polynomial/tests/test_hermite.py b/numpy/polynomial/tests/test_hermite.py index 36fa6f0e49a8..f9b936bbf758 100644 --- a/numpy/polynomial/tests/test_hermite.py +++ b/numpy/polynomial/tests/test_hermite.py @@ -1,7 +1,7 @@ """Tests for hermite module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.hermite as herm diff --git a/numpy/polynomial/tests/test_hermite_e.py b/numpy/polynomial/tests/test_hermite_e.py index 2fcef55daaa6..f7871fe99e1e 100644 --- a/numpy/polynomial/tests/test_hermite_e.py +++ b/numpy/polynomial/tests/test_hermite_e.py @@ -1,7 +1,7 @@ """Tests for hermite_e module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.hermite_e as herme diff --git a/numpy/polynomial/tests/test_laguerre.py b/numpy/polynomial/tests/test_laguerre.py index 915234b93d7c..2aabda114ad8 100644 --- a/numpy/polynomial/tests/test_laguerre.py +++ b/numpy/polynomial/tests/test_laguerre.py @@ -1,7 +1,7 @@ """Tests for laguerre module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.laguerre as lag diff --git a/numpy/polynomial/tests/test_legendre.py b/numpy/polynomial/tests/test_legendre.py index 500269484350..cd3db4e35098 100644 --- a/numpy/polynomial/tests/test_legendre.py +++ b/numpy/polynomial/tests/test_legendre.py @@ -1,7 +1,7 @@ """Tests for legendre module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.legendre as leg diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py index e8268d25f630..c93421c7dee7 100644 --- a/numpy/polynomial/tests/test_polynomial.py +++ b/numpy/polynomial/tests/test_polynomial.py @@ -1,7 +1,7 @@ """Tests for polynomial module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.polynomial as poly diff --git a/numpy/polynomial/tests/test_polyutils.py b/numpy/polynomial/tests/test_polyutils.py index 14bf8bb78984..95a8f39bbb9a 100644 --- a/numpy/polynomial/tests/test_polyutils.py +++ b/numpy/polynomial/tests/test_polyutils.py @@ -1,7 +1,7 @@ """Tests for polyutils module. """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.polynomial.polyutils as pu diff --git a/numpy/polynomial/tests/test_printing.py b/numpy/polynomial/tests/test_printing.py index 889966051ffa..3974620a7553 100644 --- a/numpy/polynomial/tests/test_printing.py +++ b/numpy/polynomial/tests/test_printing.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy.polynomial as poly from numpy.testing import TestCase, run_module_suite, assert_ diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py index f005bc15aaf1..fd401a32cbd1 100644 --- a/numpy/random/__init__.py +++ b/numpy/random/__init__.py @@ -86,10 +86,10 @@ ==================== ========================================================= """ -from __future__ import division +from __future__ import division, absolute_import # To get sub-modules -from info import __doc__, __all__ +from .info import __doc__, __all__ import warnings from numpy.testing.utils import WarningManager @@ -98,7 +98,7 @@ warn_ctx.__enter__() try: warnings.filterwarnings("ignore", message="numpy.ndarray size changed") - from mtrand import * + from .mtrand import * finally: warn_ctx.__exit__() diff --git a/numpy/random/info.py b/numpy/random/info.py index c886c565eb29..981c55046265 100644 --- a/numpy/random/info.py +++ b/numpy/random/info.py @@ -82,7 +82,7 @@ ==================== ========================================================= """ -from __future__ import division +from __future__ import division, absolute_import depends = ['core'] diff --git a/numpy/random/mtrand/generate_mtrand_c.py b/numpy/random/mtrand/generate_mtrand_c.py index d6527e6959cb..7bfda22ebf73 100644 --- a/numpy/random/mtrand/generate_mtrand_c.py +++ b/numpy/random/mtrand/generate_mtrand_c.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import import sys import re diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 410456ef4f94..27e7a3755387 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import TestCase, run_module_suite, assert_,\ assert_raises diff --git a/numpy/random/tests/test_regression.py b/numpy/random/tests/test_regression.py index a19974c47770..530c4522859c 100644 --- a/numpy/random/tests/test_regression.py +++ b/numpy/random/tests/test_regression.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import from numpy.testing import TestCase, run_module_suite, assert_,\ assert_array_equal diff --git a/numpy/testing/__init__.py b/numpy/testing/__init__.py index 19b0d20521e2..cee2d6944331 100644 --- a/numpy/testing/__init__.py +++ b/numpy/testing/__init__.py @@ -5,13 +5,13 @@ away. """ -from __future__ import division +from __future__ import division, absolute_import from unittest import TestCase -import decorators as dec -from utils import * -from numpytest import * -from nosetester import NoseTester as Tester -from nosetester import run_module_suite +from . import decorators as dec +from .utils import * +from .numpytest import * +from .nosetester import NoseTester as Tester +from .nosetester import run_module_suite test = Tester().test diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py index eae9d93b02a0..6d3da95ed2bb 100644 --- a/numpy/testing/decorators.py +++ b/numpy/testing/decorators.py @@ -13,7 +13,7 @@ ``nose.tools`` for more information. """ -from __future__ import division +from __future__ import division, absolute_import import warnings import sys @@ -210,7 +210,7 @@ def knownfail_decorator(f): # Local import to avoid a hard nose dependency and only incur the # import time overhead at actual test-time. import nose - from noseclasses import KnownFailureTest + from .noseclasses import KnownFailureTest def knownfailer(*args, **kwargs): if fail_val(): raise KnownFailureTest(msg) @@ -249,7 +249,7 @@ def deprecate_decorator(f): # Local import to avoid a hard nose dependency and only incur the # import time overhead at actual test-time. import nose - from noseclasses import KnownFailureTest + from .noseclasses import KnownFailureTest def _deprecated_imp(*args, **kwargs): # Poor man's replacement for the with statement diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index 96c779c2eef4..f3c15b39d96a 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -4,7 +4,7 @@ # Because this module imports nose directly, it should not # be used except by nosetester.py to avoid a general NumPy # dependency on nose. -from __future__ import division +from __future__ import division, absolute_import import os import doctest @@ -15,7 +15,7 @@ from nose.plugins.base import Plugin from nose.util import src import numpy -from nosetester import get_package_name +from .nosetester import get_package_name import inspect # Some of the classes in this module begin with 'Numpy' to clearly distinguish diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index 7f1292cd8047..326c36cac7fa 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -4,7 +4,7 @@ This module implements ``test()`` and ``bench()`` functions for NumPy modules. """ -from __future__ import division +from __future__ import division, absolute_import import os import sys @@ -216,7 +216,7 @@ def _get_custom_doctester(self): A return value of None means use the nose builtin doctest plugin """ - from noseclasses import NumpyDoctest + from .noseclasses import NumpyDoctest return NumpyDoctest() def prepare_test_args(self, label='fast', verbose=1, extra_argv=None, @@ -245,7 +245,7 @@ def prepare_test_args(self, label='fast', verbose=1, extra_argv=None, '--cover-tests', '--cover-erase'] # construct list of plugins import nose.plugins.builtin - from noseclasses import KnownFailure, Unplugger + from .noseclasses import KnownFailure, Unplugger plugins = [KnownFailure()] plugins += [p() for p in nose.plugins.builtin.plugins] # add doctesting if required @@ -331,7 +331,7 @@ def test(self, label='fast', verbose=1, extra_argv=None, # cap verbosity at 3 because nose becomes *very* verbose beyond that verbose = min(verbose, 3) - import utils + from . import utils utils.verbose = verbose if doctests: @@ -371,7 +371,7 @@ def test(self, label='fast', verbose=1, extra_argv=None, warnings.filterwarnings("ignore", message="numpy.ufunc size changed") try: - from noseclasses import NumpyTestProgram + from .noseclasses import NumpyTestProgram argv, plugins = self.prepare_test_args(label, verbose, extra_argv, doctests, coverage) @@ -447,7 +447,7 @@ def bench(self, label='fast', verbose=1, extra_argv=None): nose = import_nose() # get plugin to disable doctests - from noseclasses import Unplugger + from .noseclasses import Unplugger add_plugins = [Unplugger('doctest')] return nose.run(argv=argv, addplugins=add_plugins) diff --git a/numpy/testing/nulltester.py b/numpy/testing/nulltester.py index e0c7531b34a7..0419f9436c0b 100644 --- a/numpy/testing/nulltester.py +++ b/numpy/testing/nulltester.py @@ -6,7 +6,7 @@ See pkgtester, nosetester modules """ -from __future__ import division +from __future__ import division, absolute_import class NullTester(object): diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py index 5259ba773a9a..4e2409e8d379 100644 --- a/numpy/testing/numpytest.py +++ b/numpy/testing/numpytest.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import os import sys diff --git a/numpy/testing/print_coercion_tables.py b/numpy/testing/print_coercion_tables.py index 4982f56023bd..829ba0a16ea3 100755 --- a/numpy/testing/print_coercion_tables.py +++ b/numpy/testing/print_coercion_tables.py @@ -2,7 +2,7 @@ """Prints type-coercion tables for the built-in NumPy types """ -from __future__ import division +from __future__ import division, absolute_import import numpy as np diff --git a/numpy/testing/tests/test_decorators.py b/numpy/testing/tests/test_decorators.py index 22d39e9a6d1e..0acf5a11adef 100644 --- a/numpy/testing/tests/test_decorators.py +++ b/numpy/testing/tests/test_decorators.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np from numpy.testing import * diff --git a/numpy/testing/tests/test_doctesting.py b/numpy/testing/tests/test_doctesting.py index 58f65aa459e0..798c0e7e73b8 100644 --- a/numpy/testing/tests/test_doctesting.py +++ b/numpy/testing/tests/test_doctesting.py @@ -1,7 +1,7 @@ """ Doctests for NumPy-specific nose/doctest modifications """ -from __future__ import division +from __future__ import division, absolute_import # try the #random directive on the output line def check_random_directive(): diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 4dd5a8121e28..f08ca2b12d52 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import warnings import sys diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 019adeb27f5d..c08dd0c33b6c 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -2,7 +2,7 @@ Utility function to facilitate testing. """ -from __future__ import division +from __future__ import division, absolute_import import os import sys @@ -10,7 +10,7 @@ import operator import types import warnings -from nosetester import import_nose +from .nosetester import import_nose __all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal', 'assert_array_equal', 'assert_array_less', 'assert_string_equal', diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py index 9b53ed0c605e..cbf8db6a38af 100644 --- a/numpy/tests/test_ctypeslib.py +++ b/numpy/tests/test_ctypeslib.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import sys diff --git a/numpy/tests/test_matlib.py b/numpy/tests/test_matlib.py index 0ac49fed3e28..621563462078 100644 --- a/numpy/tests/test_matlib.py +++ b/numpy/tests/test_matlib.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import numpy.matlib diff --git a/pavement.py b/pavement.py index 56fe5e71496b..444976238364 100644 --- a/pavement.py +++ b/pavement.py @@ -55,7 +55,7 @@ - fix bdist_mpkg: we build the same source twice -> how to make sure we use the same underlying python for egg install in venv and for bdist_mpkg """ -from __future__ import division +from __future__ import division, absolute_import # What need to be installed to build everything on mac os x: # - wine: python 2.6 and 2.5 + makensis + cpuid plugin + mingw, all in the PATH diff --git a/setupegg.py b/setupegg.py index 4269fd4c85e7..e2d1ad0b8a14 100755 --- a/setupegg.py +++ b/setupegg.py @@ -12,7 +12,7 @@ >>> np.test(extra_argv=['--exe']) """ -from __future__ import division +from __future__ import division, absolute_import import sys from setuptools import setup diff --git a/tools/allocation_tracking/track_allocations.py b/tools/allocation_tracking/track_allocations.py index b37e8cd0439d..ddd0ffea0ad9 100644 --- a/tools/allocation_tracking/track_allocations.py +++ b/tools/allocation_tracking/track_allocations.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import import numpy as np import inspect diff --git a/tools/c_coverage/c_coverage_report.py b/tools/c_coverage/c_coverage_report.py index e4522bd925e3..83fdd1998f55 100755 --- a/tools/c_coverage/c_coverage_report.py +++ b/tools/c_coverage/c_coverage_report.py @@ -4,7 +4,7 @@ valgrind's callgrind tool. """ -from __future__ import division +from __future__ import division, absolute_import import optparse import os diff --git a/tools/commitstats.py b/tools/commitstats.py index d89c7a98eecc..73e99591263d 100644 --- a/tools/commitstats.py +++ b/tools/commitstats.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, absolute_import # Run svn log -l diff --git a/tools/py3tool.py b/tools/py3tool.py index ef175ebfd161..6563274506b0 100755 --- a/tools/py3tool.py +++ b/tools/py3tool.py @@ -18,7 +18,7 @@ makes the test-bugfix cycle faster. """ -from __future__ import division +from __future__ import division, absolute_import from optparse import OptionParser import shutil @@ -37,10 +37,6 @@ SCRIPT_2TO3 = os.path.join(BASE, 'tools', '2to3.py') EXTRA_2TO3_FLAGS = { - '*/setup.py': '-x import', - 'numpy/core/code_generators/generate_umath.py': '-x import', - 'numpy/core/code_generators/generate_numpy_api.py': '-x import', - 'numpy/core/code_generators/generate_ufunc_api.py': '-x import', 'numpy/core/defchararray.py': '-x unicode', 'numpy/compat/py3k.py': '-x unicode', 'numpy/ma/timer_comparison.py': 'skip', @@ -80,7 +76,8 @@ 'input', 'raw_input', 'xreadlines', - 'xrange' + 'xrange', + 'import' ] skip_fixes= [] @@ -172,38 +169,6 @@ def getenv(): # Run nosetests subprocess.call(['nosetests3', '-v', d], cwd=TEMP) -def custom_mangling(filename): - import_mangling = [ - os.path.join('core', '__init__.py'), - os.path.join('core', 'numeric.py'), - os.path.join('core', '_internal.py'), - os.path.join('core', 'arrayprint.py'), - os.path.join('core', 'fromnumeric.py'), - os.path.join('numpy', '__init__.py'), - os.path.join('lib', 'npyio.py'), - os.path.join('lib', 'function_base.py'), - os.path.join('fft', 'fftpack.py'), - os.path.join('random', '__init__.py'), - ] - - if any(filename.endswith(x) for x in import_mangling): - f = open(filename, 'r') - text = f.read() - f.close() - for mod in ['multiarray', 'scalarmath', 'umath', '_sort', - '_compiled_base', 'core', 'lib', 'testing', 'fft', - 'polynomial', 'random', 'ma', 'linalg', 'compat', - 'mtrand', '_dotblas', 'version']: - text = re.sub(r'^(\s*)import %s' % mod, - r'\1from . import %s' % mod, - text, flags=re.M) - text = re.sub(r'^(\s*)from %s import' % mod, - r'\1from .%s import' % mod, - text, flags=re.M) - text = text.replace('from matrixlib', 'from .matrixlib') - f = open(filename, 'w') - f.write(text) - f.close() def walk_sync(dir1, dir2, _seen=None): if _seen is None: @@ -313,10 +278,6 @@ def sync_2to3(src, dst, patchfile=None, clean=False): finally: sys.stdout = _old_stdout - for fn, dst_fn in to_convert: - # perform custom mangling - custom_mangling(dst_fn) - p.close() if __name__ == "__main__": diff --git a/tools/test-installed-numpy.py b/tools/test-installed-numpy.py index ac917b05f4f9..d3c865139eac 100644 --- a/tools/test-installed-numpy.py +++ b/tools/test-installed-numpy.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, absolute_import # A simple script to test the installed version of numpy by calling # 'numpy.test()'. Key features: