summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 07758e3c9..3684c0c87 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -532,7 +532,7 @@ class Documenter(object):
elif self.options.inherited_members:
# safe_getmembers() uses dir() which pulls in members from all
# base classes
- members = safe_getmembers(self.object)
+ members = safe_getmembers(self.object, attr_getter=self.get_attr)
else:
# __dict__ contains only the members directly defined in
# the class (but get them via getattr anyway, to e.g. get
@@ -601,6 +601,7 @@ class Documenter(object):
membername != '__doc__':
keep = has_doc or self.options.undoc_members
elif self.options.special_members and \
+ self.options.special_members is not ALL and \
membername in self.options.special_members:
keep = has_doc or self.options.undoc_members
elif want_all and membername.startswith('_'):
@@ -1020,6 +1021,18 @@ class ClassDocumenter(ModuleLevelDocumenter):
def format_signature(self):
if self.doc_as_attr:
return ''
+
+ # get __init__ method signature from __init__.__doc__
+ if self.env.config.autodoc_docstring_signature:
+ # only act if the feature is enabled
+ init_doc = MethodDocumenter(self.directive, '__init__')
+ init_doc.object = self.get_attr(self.object, '__init__', None)
+ init_doc.objpath = ['__init__']
+ result = init_doc._find_signature()
+ if result is not None:
+ # use args only for Class signature
+ return '(%s)' % result[0]
+
return ModuleLevelDocumenter.format_signature(self)
def add_directive_header(self, sig):