[Python-checkins] r62300 - in doctools/trunk: CHANGES sphinx/directives.py sphinx/ext/autodoc.py
georg.brandl
python-checkins at python.org
Sat Apr 12 23:23:35 CEST 2008
Author: georg.brandl
Date: Sat Apr 12 23:23:35 2008
New Revision: 62300
Log:
Fix class constructor signature, and class name display for members.
Modified:
doctools/trunk/CHANGES
doctools/trunk/sphinx/directives.py
doctools/trunk/sphinx/ext/autodoc.py
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Sat Apr 12 23:23:35 2008
@@ -6,7 +6,7 @@
create a target and no output.
* sphinx.ext.autodoc: Don't check ``__module__`` for explicitly given
- members.
+ members. Remove "self" in class constructor argument list.
* sphinx.environment: Don't swallow TOC entries when resolving subtrees.
@@ -16,6 +16,9 @@
* sphinx.directives: Allow giving multiple options in a ``cmdoption``
directive.
+* sphinx.directives: Fix display of class members without explicit
+ class name given.
+
* sphinx.roles: Fix referencing glossary terms with explicit targets.
* sphinx.builder, sphinx.environment: Gracefully handle some exception
Modified: doctools/trunk/sphinx/directives.py
==============================================================================
--- doctools/trunk/sphinx/directives.py (original)
+++ doctools/trunk/sphinx/directives.py Sat Apr 12 23:23:35 2008
@@ -140,12 +140,16 @@
if env.currclass:
if classname and classname.startswith(env.currclass):
fullname = classname + name
+ # class name is given again in the signature
classname = classname[len(env.currclass):].lstrip('.')
add_module = False
elif classname:
+ # class name is given in the signature, but different
fullname = env.currclass + '.' + classname + name
else:
+ # class name is not given in the signature
fullname = env.currclass + '.' + name
+ add_module = False
else:
fullname = classname and classname + name or name
@@ -384,7 +388,7 @@
subnode = addnodes.desc_content()
# needed for automatic qualification of members
clsname_set = False
- if desctype == 'class' and names:
+ if desctype in ('class', 'exception') and names:
env.currclass = names[0]
clsname_set = True
elif desctype in ('method', 'attribute') and clsname and not env.currclass:
Modified: doctools/trunk/sphinx/ext/autodoc.py
==============================================================================
--- doctools/trunk/sphinx/ext/autodoc.py (original)
+++ doctools/trunk/sphinx/ext/autodoc.py Sat Apr 12 23:23:35 2008
@@ -125,6 +125,10 @@
try:
if what == 'class':
args = inspect.formatargspec(*inspect.getargspec(todoc.__init__))
+ if args[1:7] == 'self, ':
+ args = '(' + args[7:]
+ elif args == '(self)':
+ args = '()'
elif what in ('function', 'method'):
args = inspect.formatargspec(*inspect.getargspec(todoc))
if what == 'method':
More information about the Python-checkins
mailing list