diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-03-27 21:49:08 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-03-28 08:43:26 -0600 |
commit | d4b88c1dbd6898fb6fcebc97f36b421999340f71 (patch) | |
tree | 61cc0282cf2509afe364c91e97b59dfb2ebcafd3 /numpy/ma | |
parent | 40742184df68fc01f3392c9865f35d5402e74b01 (diff) | |
download | numpy-d4b88c1dbd6898fb6fcebc97f36b421999340f71.tar.gz |
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
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/__init__.py | 10 | ||||
-rw-r--r-- | numpy/ma/bench.py | 2 | ||||
-rw-r--r-- | numpy/ma/core.py | 2 | ||||
-rw-r--r-- | numpy/ma/extras.py | 6 | ||||
-rw-r--r-- | numpy/ma/mrecords.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_extras.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_mrecords.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_old_ma.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_regression.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_subclassing.py | 2 | ||||
-rw-r--r-- | numpy/ma/testutils.py | 4 | ||||
-rw-r--r-- | numpy/ma/timer_comparison.py | 2 | ||||
-rw-r--r-- | numpy/ma/version.py | 6 |
14 files changed, 23 insertions, 23 deletions
diff --git a/numpy/ma/__init__.py b/numpy/ma/__init__.py index 7388a7ce3..3113e538c 100644 --- a/numpy/ma/__init__.py +++ b/numpy/ma/__init__.py @@ -36,18 +36,18 @@ may now proceed to calculate the mean of the other values: 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 df6933eb9..7500245c3 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 371d5f302..3299262d1 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -20,7 +20,7 @@ Released for unlimited redistribution. """ # pylint: disable-msg=E1002 -from __future__ import division +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant" diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 77d2dbb36..795e75402 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -8,7 +8,7 @@ A collection of utilities for `numpy.ma`. :version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division +from __future__ import division, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' @@ -38,8 +38,8 @@ __all__ = ['apply_along_axis', 'apply_over_axes', 'atleast_1d', 'atleast_2d', 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 084859d07..ae31986bc 100644 --- a/numpy/ma/mrecords.py +++ b/numpy/ma/mrecords.py @@ -8,7 +8,7 @@ and the masking of individual fields. :author: Pierre Gerard-Marchant """ -from __future__ import division +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 a11bf6943..383e4a907 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 3f25ac21c..c32e689c3 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -7,7 +7,7 @@ Adapted from the original test_ma by Pierre Gerard-Marchant :version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ -from __future__ import division +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 4e59b8e41..d6f8d9765 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 b04e8ab37..41f7779d9 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 85c290160..e5fea0c52 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 ce3d8c889..6b8ff0769 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 3707dcc16..882db2b89 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 @@ import numpy.core.umath as umath 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 adc1fa22b..549448689 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 73281311d..cf9a95572 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]) |