summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/sphinxext/docscrape.py24
-rw-r--r--doc/sphinxext/docscrape_sphinx.py4
2 files changed, 12 insertions, 16 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]
diff --git a/doc/sphinxext/docscrape_sphinx.py b/doc/sphinxext/docscrape_sphinx.py
index 8b93459d5..12907731e 100644
--- a/doc/sphinxext/docscrape_sphinx.py
+++ b/doc/sphinxext/docscrape_sphinx.py
@@ -70,9 +70,7 @@ class SphinxDocString(NumpyDocString):
others = []
for param, param_type, desc in self[name]:
param = param.strip()
- if not self._obj or \
- (hasattr(self._obj, param) and
- getattr(getattr(self._obj, param), '__doc__', None)):
+ if not self._obj or hasattr(self._obj, param):
autosum += [" %s%s" % (prefix, param)]
else:
others.append((param, param_type, desc))