[Python-checkins] r62299 - in doctools/trunk: CHANGES sphinx/ext/autodoc.py
georg.brandl
python-checkins at python.org
Sat Apr 12 23:10:34 CEST 2008
Author: georg.brandl
Date: Sat Apr 12 23:10:33 2008
New Revision: 62299
Log:
Don't check __module__ for explicitly given members.
Modified:
doctools/trunk/CHANGES
doctools/trunk/sphinx/ext/autodoc.py
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Sat Apr 12 23:10:33 2008
@@ -5,6 +5,9 @@
It works like ``add_description_unit`` but the directive will only
create a target and no output.
+* sphinx.ext.autodoc: Don't check ``__module__`` for explicitly given
+ members.
+
* sphinx.environment: Don't swallow TOC entries when resolving subtrees.
* sphinx.directives: Allow giving a different title to documents
Modified: doctools/trunk/sphinx/ext/autodoc.py
==============================================================================
--- doctools/trunk/sphinx/ext/autodoc.py (original)
+++ doctools/trunk/sphinx/ext/autodoc.py Sat Apr 12 23:10:33 2008
@@ -71,7 +71,7 @@
def generate_rst(what, name, members, undoc, add_content, document, lineno,
- indent='', filename_set=None):
+ indent='', filename_set=None, check_module=False):
env = document.settings.env
# find out what to import
@@ -109,9 +109,11 @@
filename_set.add(modfile)
for part in objpath:
todoc = getattr(todoc, part)
- if hasattr(todoc, '__module__'):
- if todoc.__module__ != mod:
- return [], result
+ if check_module:
+ # only checking __module__ for members not given explicitly
+ if hasattr(todoc, '__module__'):
+ if todoc.__module__ != mod:
+ return [], result
docstring = todoc.__doc__
except (ImportError, AttributeError):
warning = document.reporter.warning(
@@ -174,7 +176,12 @@
warnings = []
# add members, if possible
_all = members == ['__all__']
+ members_check_module = False
if _all:
+ if what == 'module':
+ # for implicit module members, check __module__ to avoid documenting
+ # imported objects
+ members_check_module = True
all_members = sorted(inspect.getmembers(todoc))
else:
all_members = [(mname, getattr(todoc, mname)) for mname in members]
@@ -206,7 +213,8 @@
continue
full_membername = name + '.' + membername
subwarn, subres = generate_rst(memberwhat, full_membername, ['__all__'],
- undoc, None, document, lineno, indent)
+ undoc, None, document, lineno, indent,
+ check_module=members_check_module)
warnings.extend(subwarn)
result.extend(subres)
More information about the Python-checkins
mailing list