summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-07-02 12:48:52 -0600
committerGitHub <noreply@github.com>2018-07-02 12:48:52 -0600
commit407885667643e2305ca9444ccf58fea142226e1b (patch)
treeace0b7e1d2a90297944d38305ab3a4b4a075d908 /numpy/lib/function_base.py
parenta854e702c5314c1decd2c968b30ae5032703ae96 (diff)
parent2244cd929354fb4157eaa78204ad6bb3bebea9bf (diff)
downloadnumpy-407885667643e2305ca9444ccf58fea142226e1b.tar.gz
Merge pull request #11474 from eric-wieser/move-add-new-docs
MAINT: Move add_newdocs into core, since it only adds docs to those pieces
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py36
1 files changed, 1 insertions, 35 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 26ef3e235..9a680dd55 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -27,6 +27,7 @@ from numpy.core.fromnumeric import (
ravel, nonzero, sort, partition, mean, any, sum
)
from numpy.core.numerictypes import typecodes, number
+from numpy.core.function_base import add_newdoc
from numpy.lib.twodim_base import diag
from .utils import deprecate
from numpy.core.multiarray import (
@@ -3892,41 +3893,6 @@ def trapz(y, x=None, dx=1.0, axis=-1):
return ret
-#always succeed
-def add_newdoc(place, obj, doc):
- """
- Adds documentation to obj which is in module place.
-
- If doc is a string add it to obj as a docstring
-
- If doc is a tuple, then the first element is interpreted as
- an attribute of obj and the second as the docstring
- (method, docstring)
-
- If doc is a list, then each element of the list should be a
- sequence of length two --> [(method1, docstring1),
- (method2, docstring2), ...]
-
- This routine never raises an error.
-
- This routine cannot modify read-only docstrings, as appear
- in new-style classes or built-in functions. Because this
- routine never raises an error the caller must check manually
- that the docstrings were changed.
- """
- try:
- new = getattr(__import__(place, globals(), {}, [obj]), obj)
- if isinstance(doc, str):
- add_docstring(new, doc.strip())
- elif isinstance(doc, tuple):
- add_docstring(getattr(new, doc[0]), doc[1].strip())
- elif isinstance(doc, list):
- for val in doc:
- add_docstring(getattr(new, val[0]), val[1].strip())
- except Exception:
- pass
-
-
# Based on scitools meshgrid
def meshgrid(*xi, **kwargs):
"""