diff options
author | Pauli Virtanen <pav@iki.fi> | 2013-02-16 16:22:32 +0200 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2013-02-16 17:48:32 +0200 |
commit | fd9064f5ee734ffb1dd1f16e7b0f6ce9cfa25df5 (patch) | |
tree | 3886376bc4a36ddbcbc6a15e08ea21fd94aa3426 /doc/sphinxext/numpydoc/docscrape.py | |
parent | c5efee88abd79f2338b28267377fe31be7dfa0f4 (diff) | |
download | numpy-fd9064f5ee734ffb1dd1f16e7b0f6ce9cfa25df5.tar.gz |
BUG: numpydoc: fix bugs in attribute docstring extraction + improve presentation
Diffstat (limited to 'doc/sphinxext/numpydoc/docscrape.py')
-rw-r--r-- | doc/sphinxext/numpydoc/docscrape.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/doc/sphinxext/numpydoc/docscrape.py b/doc/sphinxext/numpydoc/docscrape.py index 1e9f6343a..e4bf308b5 100644 --- a/doc/sphinxext/numpydoc/docscrape.py +++ b/doc/sphinxext/numpydoc/docscrape.py @@ -490,12 +490,19 @@ class ClassDoc(NumpyDocString): NumpyDocString.__init__(self, doc) if config.get('show_class_members', True): - if not self['Methods']: - self['Methods'] = [(name, '', '') - for name in sorted(self.methods)] - if not self['Attributes']: - self['Attributes'] = [(name, '', '') - for name in sorted(self.properties)] + def splitlines_x(s): + if not s: + return [] + else: + return s.splitlines() + + for field, items in [('Methods', self.methods), + ('Attributes', self.properties)]: + if not self[field]: + self[field] = [ + (name, '', + splitlines_x(pydoc.getdoc(getattr(self._cls, name)))) + for name in sorted(items)] @property def methods(self): @@ -511,4 +518,6 @@ class ClassDoc(NumpyDocString): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) - if not name.startswith('_') and func is None] + if not name.startswith('_') and + (func is None or isinstance(func, property) or + inspect.isgetsetdescriptor(func))] |