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.
This commit is contained in:
Martin Brochhaus 2010-09-07 16:22:34 +02:00
parent 8f2f4db5ac
commit b857b46be9

View File

@ -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')