summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2019-09-08 11:57:31 -0700
committerRalf Gommers <ralf.gommers@gmail.com>2019-09-19 08:57:52 +0200
commitd072f12354d1802aa6ac7a3bfa92a24fa5df613d (patch)
treef0b48f84f6378ffba8135f0e2aea904e0f17a152 /numpy
parent50cbd096099d71250fa45b2d3332b0faa1341625 (diff)
downloadnumpy-d072f12354d1802aa6ac7a3bfa92a24fa5df613d.tar.gz
MAINT: add missing 'Arrayterator' to `numpy.lib.__all__`
Also finish the TODO about figuring out which np.lib.<submodule>'s are public. This is a giant mess ...
Diffstat (limited to 'numpy')
-rw-r--r--numpy/__init__.py6
-rw-r--r--numpy/lib/__init__.py10
-rw-r--r--numpy/tests/test_public_api.py11
3 files changed, 19 insertions, 8 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 07d67945c..c5ef6869f 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,10 @@ 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
+ __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")
diff --git a/numpy/lib/__init__.py b/numpy/lib/__init__.py
index eb6c9cace..906bede37 100644
--- a/numpy/lib/__init__.py
+++ b/numpy/lib/__init__.py
@@ -5,10 +5,15 @@ import math
from .info import __doc__
from numpy.version import version as __version__
+# Public submodules
+# Note: recfunctions and (maybe) format are public too, but not imported
+from . import mixins
+from . import scimath as emath
+
+# Private submodules
from .type_check import *
from .index_tricks import *
from .function_base import *
-from . import mixins # public
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
@@ -16,7 +21,6 @@ from .twodim_base import *
from .ufunclike import *
from .histograms import *
-from . import scimath as emath
from .polynomial import *
from .utils import *
from .arraysetops import *
@@ -27,7 +31,7 @@ from .arraypad import *
from ._version import *
from numpy.core._multiarray_umath import tracemalloc_domain
-__all__ = ['emath', 'math', 'tracemalloc_domain']
+__all__ = ['emath', 'math', 'tracemalloc_domain', 'Arrayterator']
__all__ += type_check.__all__
__all__ += index_tricks.__all__
__all__ += function_base.__all__
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py
index 4d9066fc9..2b29ea0e9 100644
--- a/numpy/tests/test_public_api.py
+++ b/numpy/tests/test_public_api.py
@@ -33,7 +33,8 @@ def check_dir(module, module_name=None):
sys.version_info[0] < 3,
reason="NumPy exposes slightly different functions on Python 2")
def test_numpy_namespace():
- # None of these objects are publicly documented.
+ # None of these objects are publicly documented to be part of the main
+ # NumPy namespace (some are useful though, others need to be cleaned up)
undocumented = {
'Tester': 'numpy.testing._private.nosetester.NoseTester',
'_add_newdoc_ufunc': 'numpy.core._multiarray_umath._add_newdoc_ufunc',
@@ -144,9 +145,8 @@ PUBLIC_MODULES = [
"f2py",
"fft",
"lib",
- "lib.format",
+ "lib.format", # was this meant to be public?
"lib.mixins",
- "lib.npyio",
"lib.recfunctions",
"lib.scimath",
"linalg",
@@ -276,7 +276,7 @@ PRIVATE_BUT_PRESENT_MODULES = [
"fft.info",
"fft.pocketfft",
"fft.pocketfft_internal",
- "lib.arraypad", # TODO: figure out which numpy.lib submodules are public
+ "lib.arraypad",
"lib.arraysetops",
"lib.arrayterator",
"lib.financial",
@@ -285,13 +285,14 @@ PRIVATE_BUT_PRESENT_MODULES = [
"lib.index_tricks",
"lib.info",
"lib.nanfunctions",
+ "lib.npyio",
"lib.polynomial",
"lib.shape_base",
"lib.stride_tricks",
"lib.twodim_base",
"lib.type_check",
"lib.ufunclike",
- "lib.user_array",
+ "lib.user_array", # note: not in np.lib, but probably should just be deleted
"lib.utils",
"linalg.info",
"linalg.lapack_lite",