From 7a57dc108fe8ee981439aea38df0d35cfbffaf4c Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 25 Jun 2011 18:23:22 +0200 Subject: sphinxext: expose __call__ in the documentation, if it is present --- doc/sphinxext/docscrape.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'doc/sphinxext') diff --git a/doc/sphinxext/docscrape.py b/doc/sphinxext/docscrape.py index 615ea11f8..bbd3fcacc 100644 --- a/doc/sphinxext/docscrape.py +++ b/doc/sphinxext/docscrape.py @@ -460,6 +460,9 @@ class FunctionDoc(NumpyDocString): class ClassDoc(NumpyDocString): + + extra_public_methods = ['__call__'] + def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, config={}): if not inspect.isclass(cls) and cls is not None: @@ -490,7 +493,9 @@ class ClassDoc(NumpyDocString): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) - if not name.startswith('_') and callable(func)] + if ((not name.startswith('_') + or name in self.extra_public_methods) + and callable(func))] @property def properties(self): -- cgit v1.2.1