summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2018-11-13 09:38:07 -0800
committerStephan Hoyer <shoyer@google.com>2018-11-13 20:24:31 -0800
commit4d24bbda32d133d51940b0691bd9b428d4198eaa (patch)
treec018ac1ada700494f1bb404a8ae9f1346720ebfe /numpy/lib/polynomial.py
parentcd39348e8593dc2b41e2516fbdd8a69b0f0bda6e (diff)
downloadnumpy-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/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index c2702f0a7..7cbe80b46 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -16,6 +16,7 @@ import numpy.core.numeric as NX
from numpy.core import (isscalar, abs, finfo, atleast_1d, hstack, dot, array,
ones)
from numpy.core import overrides
+from numpy.core.overrides import set_module
from numpy.lib.twodim_base import diag, vander
from numpy.lib.function_base import trim_zeros
from numpy.lib.type_check import iscomplex, real, imag, mintypecode
@@ -26,6 +27,7 @@ array_function_dispatch = functools.partial(
overrides.array_function_dispatch, module='numpy')
+@set_module('numpy')
class RankWarning(UserWarning):
"""
Issued by `polyfit` when the Vandermonde matrix is rank deficient.
@@ -992,6 +994,7 @@ def _raise_power(astr, wrap=70):
return output + astr[n:]
+@set_module('numpy')
class poly1d(object):
"""
A one-dimensional polynomial class.