diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-11-13 09:38:07 -0800 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-11-13 20:24:31 -0800 |
commit | 4d24bbda32d133d51940b0691bd9b428d4198eaa (patch) | |
tree | c018ac1ada700494f1bb404a8ae9f1346720ebfe /numpy/core/function_base.py | |
parent | cd39348e8593dc2b41e2516fbdd8a69b0f0bda6e (diff) | |
download | numpy-4d24bbda32d133d51940b0691bd9b428d4198eaa.tar.gz |
ENH: set correct __module__ for objects in numpy's public API
Fixes GH-12271
Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to
``'numpy'``, or appears in an explicit whitelist of undocumented functions and
exported bulitins. These should eventually be documented or removed.
I also identified a handful of functions for which I had accidentally not setup
dispatch for with ``__array_function__`` before, because they were listed under
"ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in
trusting code comments :).
Diffstat (limited to 'numpy/core/function_base.py')
-rw-r--r-- | numpy/core/function_base.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index 799b1418d..b3dd313cf 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -7,6 +7,7 @@ from . import numeric as _nx from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError,asanyarray) from numpy.core.multiarray import add_docstring +from numpy.core.overrides import set_module __all__ = ['logspace', 'linspace', 'geomspace'] @@ -23,6 +24,7 @@ def _index_deprecate(i, stacklevel=2): return i +@set_module('numpy') def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None): """ Return evenly spaced numbers over a specified interval. @@ -154,6 +156,7 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None): return y.astype(dtype, copy=False) +@set_module('numpy') def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None): """ Return numbers spaced evenly on a log scale. @@ -238,6 +241,7 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None): return _nx.power(base, y).astype(dtype) +@set_module('numpy') def geomspace(start, stop, num=50, endpoint=True, dtype=None): """ Return numbers spaced evenly on a log scale (a geometric progression). |