summaryrefslogtreecommitdiff
path: root/sphinx/ext/coverage.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-04 22:22:23 +0100
committerGeorg Brandl <georg@python.org>2011-01-04 22:22:23 +0100
commitdd6984b7a923344698c770e6f21432f62c8423ed (patch)
tree776f4ff178cf242a35a17e383969c1829dcf57f9 /sphinx/ext/coverage.py
parent9ac5f2b87382fbb9e261db714ea3d096366b9aac (diff)
parentb857b46be95c4eecf3f7dacb32d5c64a7d911a4e (diff)
downloadsphinx-git-dd6984b7a923344698c770e6f21432f62c8423ed.tar.gz
merge with bb://mbrochh/sphinx
Diffstat (limited to 'sphinx/ext/coverage.py')
-rw-r--r--sphinx/ext/coverage.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py
index fe34ac106..e7a7425f3 100644
--- a/sphinx/ext/coverage.py
+++ b/sphinx/ext/coverage.py
@@ -166,7 +166,7 @@ class CoverageBuilder(Builder):
if exp.match(name):
break
else:
- if full_name not in objects:
+ if full_name not in objects and not obj.__doc__:
# not documented at all
classes[name] = []
continue
@@ -174,16 +174,20 @@ class CoverageBuilder(Builder):
attrs = []
for attr_name in dir(obj):
+ if attr_name not in obj.__dict__:
+ continue
attr = getattr(obj, attr_name)
- for attr_name, attr in inspect.getmembers(
- obj, lambda x: inspect.ismethod(x) or \
- inspect.isfunction(x)):
+ if (not inspect.ismethod(attr)
+ and not inspect.isfunction(attr)):
+ continue
if attr_name[0] == '_':
# starts with an underscore, ignore it
continue
full_attr_name = '%s.%s' % (full_name, attr_name)
if full_attr_name not in objects:
+ if len(obj.__doc__) > 0:
+ continue
attrs.append(attr_name)
if attrs:
@@ -197,8 +201,8 @@ class CoverageBuilder(Builder):
op = open(output_file, 'w')
failed = []
try:
- write_header(op, 'Undocumented Python objects', '=')
-
+ if self.config.coverage_write_headline:
+ write_header(op, 'Undocumented Python objects', '=')
keys = self.py_undoc.keys()
keys.sort()
for name in keys:
@@ -248,3 +252,4 @@ def setup(app):
app.add_config_value('coverage_c_path', [], False)
app.add_config_value('coverage_c_regexes', {}, False)
app.add_config_value('coverage_ignore_c_items', {}, False)
+ app.add_config_value('coverage_write_headline', {}, False)