diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-02-06 00:27:08 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-02-06 00:27:08 +0000 |
commit | d46fa57c68b1f6ff4e9f2da6bf9c1e60045c89cf (patch) | |
tree | 96f98c7e3765dad5a08f102b0581aca1d2e5fcc3 /doc/sphinxext/docscrape.py | |
parent | aeb090d5f7081a166357fa850950da89feb25e97 (diff) | |
download | numpy-d46fa57c68b1f6ff4e9f2da6bf9c1e60045c89cf.tar.gz |
doc/numpydoc: work better together with Sphinx's config option
Diffstat (limited to 'doc/sphinxext/docscrape.py')
-rw-r--r-- | doc/sphinxext/docscrape.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/sphinxext/docscrape.py b/doc/sphinxext/docscrape.py index 904270a52..f374b3ddc 100644 --- a/doc/sphinxext/docscrape.py +++ b/doc/sphinxext/docscrape.py @@ -406,11 +406,13 @@ def header(text, style='-'): class FunctionDoc(NumpyDocString): - def __init__(self, func, role='func'): + def __init__(self, func, role='func', doc=None): self._f = func self._role = role # e.g. "func" or "meth" + if doc is None: + doc = inspect.getdoc(func) or '' try: - NumpyDocString.__init__(self,inspect.getdoc(func) or '') + NumpyDocString.__init__(self, doc) except ValueError, e: print '*'*78 print "ERROR: '%s' while parsing `%s`" % (e, self._f) @@ -459,7 +461,7 @@ class FunctionDoc(NumpyDocString): class ClassDoc(NumpyDocString): - def __init__(self,cls,modulename='',func_doc=FunctionDoc): + def __init__(self,cls,modulename='',func_doc=FunctionDoc,doc=None): if not inspect.isclass(cls): raise ValueError("Initialise using a class. Got %r" % cls) self._cls = cls @@ -470,7 +472,10 @@ class ClassDoc(NumpyDocString): self._name = cls.__name__ self._func_doc = func_doc - NumpyDocString.__init__(self, pydoc.getdoc(cls)) + if doc is None: + doc = pydoc.getdoc(cls) + + NumpyDocString.__init__(self, doc) @property def methods(self): |