From b857b46be95c4eecf3f7dacb32d5c64a7d911a4e Mon Sep 17 00:00:00 2001 From: Martin Brochhaus Date: Tue, 7 Sep 2010 16:22:34 +0200 Subject: [PATCH] Removed a rather confusing method by a simpler call to .__doc__ It turned out that at this point we can safely check for .__doc__ wihtout producing exceptions or false positives. --- sphinx/ext/coverage.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py index 5bcd12b2c..8bff22487 100644 --- a/sphinx/ext/coverage.py +++ b/sphinx/ext/coverage.py @@ -187,8 +187,7 @@ class CoverageBuilder(Builder): full_attr_name = '%s.%s' % (full_name, attr_name) if full_attr_name not in objects: - if not self._is_func_undocumented( - obj, attr_name): + if len(obj.__doc__) > 0: continue attrs.append(attr_name) @@ -198,19 +197,6 @@ class CoverageBuilder(Builder): self.py_undoc[mod_name] = {'funcs': funcs, 'classes': classes} - def _is_func_undocumented(self, obj, attr_name): - """Last check looking at the source code. Is function really not documented?""" - obj_source = inspect.getsource(obj) or '' - obj_source = obj_source.replace(' ', '').replace('\n', '') - if not "def%s" % attr_name in obj_source: - # Funktion is not defined in this class. No documentation needed. - return False - m = re.search('def%s\([^\)]*\):"""' %attr_name, obj_source) - if not m: - return True - else: - return False - def write_py_coverage(self): output_file = path.join(self.outdir, 'python.txt') op = open(output_file, 'w')