diff options
Diffstat (limited to 'numpy/__init__.py')
-rw-r--r-- | numpy/__init__.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index ae297597e..fef8245de 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -143,7 +143,9 @@ else: from .core import * from . import compat from . import lib + # FIXME: why have numpy.lib if everything is imported here?? from .lib import * + from . import linalg from . import fft from . import polynomial @@ -174,6 +176,14 @@ else: __all__.extend(lib.__all__) __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma']) + # Remove things that are in the numpy.lib but not in the numpy namespace + # Note that there is a test (numpy/tests/test_public_api.py:test_numpy_namespace) + # that prevents adding more things to the main namespace by accident. + # The list below will grow until the `from .lib import *` fixme above is + # taken care of + __all__.remove('Arrayterator') + del Arrayterator + # Filter out Cython harmless warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.ufunc size changed") @@ -202,9 +212,8 @@ else: from .testing import Tester return Tester else: - raise AttributeError( - "module %s has no attribute $s".format(__name__, attr)) - + raise AttributeError("module {!r} has no attribute " + "{!r}".format(__name__, attr)) def __dir__(): return __all__ + ['Tester', 'testing'] |