summaryrefslogtreecommitdiff
path: root/doc/sphinxext/docscrape.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-06-27 17:40:32 +0000
committerPauli Virtanen <pav@iki.fi>2009-06-27 17:40:32 +0000
commitaa292318e92eee5f99fa5701e4a84ae7bd0bdc4c (patch)
tree2dc0269396268404ffbbfc9dc8c75a68ba930c0f /doc/sphinxext/docscrape.py
parent7a661682c1d8209fe17daba26ed0cddc2cb5edf3 (diff)
downloadnumpy-aa292318e92eee5f99fa5701e4a84ae7bd0bdc4c.tar.gz
docs: fill in stub Methods/Attributes sections if they are omitted
Diffstat (limited to 'doc/sphinxext/docscrape.py')
-rw-r--r--doc/sphinxext/docscrape.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/doc/sphinxext/docscrape.py b/doc/sphinxext/docscrape.py
index 3e190b6f2..0e073da93 100644
--- a/doc/sphinxext/docscrape.py
+++ b/doc/sphinxext/docscrape.py
@@ -479,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]