diff options
Diffstat (limited to 'doc/sphinxext/docscrape.py')
-rw-r--r-- | doc/sphinxext/docscrape.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/sphinxext/docscrape.py b/doc/sphinxext/docscrape.py index f374b3ddc..0e073da93 100644 --- a/doc/sphinxext/docscrape.py +++ b/doc/sphinxext/docscrape.py @@ -8,7 +8,7 @@ import re import pydoc from StringIO import StringIO from warnings import warn -4 + class Reader(object): """A line-based string reader. @@ -386,6 +386,8 @@ class NumpyDocString(object): out += self._str_see_also(func_role) for s in ('Notes','References','Examples'): out += self._str_section(s) + for param_list in ('Attributes', 'Methods'): + out += self._str_param_list(param_list) out += self._str_index() return '\n'.join(out) @@ -477,21 +479,19 @@ class ClassDoc(NumpyDocString): NumpyDocString.__init__(self, doc) + 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)] + @property def methods(self): return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and callable(func)] - def __str__(self): - out = '' - out += super(ClassDoc, self).__str__() - out += "\n\n" - - #for m in self.methods: - # print "Parsing `%s`" % m - # out += str(self._func_doc(getattr(self._cls,m), 'meth')) + '\n\n' - # out += '.. index::\n single: %s; %s\n\n' % (self._name, m) - - return out - - + @property + def properties(self): + return [name for name,func in inspect.getmembers(self._cls) + if not name.startswith('_') and func is None] |