diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-04-15 14:40:21 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-04-15 14:45:50 +0200 |
commit | cfbcd38558045197eded5cb84b8c8fe006a77480 (patch) | |
tree | 2e9ed21200c1357c85354406d7134036a3c3d73e | |
parent | 181f273a59744d58f90f45d953a3285484c72cba (diff) | |
download | numpy-cfbcd38558045197eded5cb84b8c8fe006a77480.tar.gz |
ENH: Add `__all__` to a number of public modules
-rw-r--r-- | numpy/fft/__init__.py | 4 | ||||
-rw-r--r-- | numpy/fft/__init__.pyi | 4 | ||||
-rw-r--r-- | numpy/linalg/__init__.py | 3 | ||||
-rw-r--r-- | numpy/linalg/__init__.pyi | 4 | ||||
-rw-r--r-- | numpy/polynomial/__init__.py | 16 | ||||
-rw-r--r-- | numpy/polynomial/__init__.pyi | 4 |
6 files changed, 29 insertions, 6 deletions
diff --git a/numpy/fft/__init__.py b/numpy/fft/__init__.py index a86bb3ac0..fd5e47580 100644 --- a/numpy/fft/__init__.py +++ b/numpy/fft/__init__.py @@ -200,9 +200,13 @@ For examples, see the various functions. """ +from . import _pocketfft, helper from ._pocketfft import * from .helper import * +__all__ = _pocketfft.__all__.copy() +__all__ += helper.__all__ + from numpy._pytesttester import PytestTester test = PytestTester(__name__) del PytestTester diff --git a/numpy/fft/__init__.pyi b/numpy/fft/__init__.pyi index 45190517f..bb4fae903 100644 --- a/numpy/fft/__init__.pyi +++ b/numpy/fft/__init__.pyi @@ -1,4 +1,6 @@ -from typing import Any +from typing import Any, List + +__all__: List[str] fft: Any ifft: Any diff --git a/numpy/linalg/__init__.py b/numpy/linalg/__init__.py index 3a53ac6ec..93943de38 100644 --- a/numpy/linalg/__init__.py +++ b/numpy/linalg/__init__.py @@ -70,8 +70,11 @@ Exceptions """ # To get sub-modules +from . import linalg from .linalg import * +__all__ = linalg.__all__.copy() + from numpy._pytesttester import PytestTester test = PytestTester(__name__) del PytestTester diff --git a/numpy/linalg/__init__.pyi b/numpy/linalg/__init__.pyi index ffb05bb81..39b061969 100644 --- a/numpy/linalg/__init__.pyi +++ b/numpy/linalg/__init__.pyi @@ -1,4 +1,6 @@ -from typing import Any +from typing import Any, List + +__all__: List[str] matrix_power: Any solve: Any diff --git a/numpy/polynomial/__init__.py b/numpy/polynomial/__init__.py index d629df29f..4b4361163 100644 --- a/numpy/polynomial/__init__.py +++ b/numpy/polynomial/__init__.py @@ -37,13 +37,13 @@ This eliminates the need to navigate to the corresponding submodules, e.g. The classes provide a more consistent and concise interface than the type-specific functions defined in the submodules for each type of polynomial. For example, to fit a Chebyshev polynomial with degree ``1`` to data given -by arrays ``xdata`` and ``ydata``, the +by arrays ``xdata`` and ``ydata``, the `~chebyshev.Chebyshev.fit` class method:: >>> from numpy.polynomial import Chebyshev >>> c = Chebyshev.fit(xdata, ydata, deg=1) -is preferred over the `chebyshev.chebfit` function from the +is preferred over the `chebyshev.chebfit` function from the ``np.polynomial.chebyshev`` module:: >>> from numpy.polynomial.chebyshev import chebfit @@ -76,7 +76,7 @@ Methods for creating polynomial instances. - ``Poly.basis(degree)`` -- Basis polynomial of given degree - ``Poly.identity()`` -- ``p`` where ``p(x) = x`` for all ``x`` -- ``Poly.fit(x, y, deg)`` -- ``p`` of degree ``deg`` with coefficients +- ``Poly.fit(x, y, deg)`` -- ``p`` of degree ``deg`` with coefficients determined by the least-squares fit to the data ``x``, ``y`` - ``Poly.fromroots(roots)`` -- ``p`` with specified roots - ``p.copy()`` -- Create a copy of ``p`` @@ -120,6 +120,16 @@ from .hermite import Hermite from .hermite_e import HermiteE from .laguerre import Laguerre +__all__ = [ + "set_default_printstyle", + "polynomial", "Polynomial", + "chebyshev", "Chebyshev", + "legendre", "Legendre", + "hermite", "Hermite", + "hermite_e", "HermiteE", + "laguerre", "Laguerre", +] + def set_default_printstyle(style): """ diff --git a/numpy/polynomial/__init__.pyi b/numpy/polynomial/__init__.pyi index 755f7521b..6a7406041 100644 --- a/numpy/polynomial/__init__.pyi +++ b/numpy/polynomial/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, List from numpy.polynomial import ( chebyshev as chebyshev, @@ -9,6 +9,8 @@ from numpy.polynomial import ( polynomial as polynomial, ) +__all__: List[str] + Polynomial: Any Chebyshev: Any Legendre: Any |