[Epydoc-commits] SF.net SVN: epydoc: [1677] trunk/epydoc/src/epydoc
Brought to you by:
edloper
From: <ed...@us...> - 2008-01-29 17:17:05
|
Revision: 1677 http://epydoc.svn.sourceforge.net/epydoc/?rev=1677&view=rev Author: edloper Date: 2008-01-29 09:16:38 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Supress docstring warnings for any objects that are not included in the documented set. This includes inherited values and variables, *unless* they are overridden, in which case the docstring may be inherited. Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py trunk/epydoc/src/epydoc/docbuilder.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2008-01-29 17:14:05 UTC (rev 1676) +++ trunk/epydoc/src/epydoc/cli.py 2008-01-29 17:16:38 UTC (rev 1677) @@ -667,6 +667,7 @@ 7, # Merging parsed & introspected information 1, # Linking imported variables 3, # Indexing documentation + 1, # Checking for overridden methods 30, # Parsing Docstrings 1, # Inheriting documentation 2] # Sorting & Grouping Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2008-01-29 17:14:05 UTC (rev 1676) +++ trunk/epydoc/src/epydoc/docbuilder.py 2008-01-29 17:16:38 UTC (rev 1677) @@ -198,7 +198,8 @@ options = BuildOptions(parse=parse, introspect=introspect, exclude_introspect=exclude_introspect, exclude_parse=exclude_parse, add_submodules=add_submodules) - except Exception: + except Exception, e: + # log.error already reported by constructor. return None # Get the basic docs for each item. @@ -251,14 +252,27 @@ assign_canonical_names(val_doc, val_doc.canonical_name, docindex) log.end_progress() + # Set overrides pointers + log.start_progress('Checking for overridden methods') + for i, val_doc in enumerate(valdocs): + if isinstance(val_doc, ClassDoc): + percent = float(i)/len(valdocs) + log.progress(percent, val_doc.canonical_name) + find_overrides(val_doc) + log.end_progress() + # Parse the docstrings for each object. log.start_progress('Parsing docstrings') valdocs = sorted(docindex.reachable_valdocs( imports=False, submodules=False, packages=False, subclasses=False)) + supress_warnings = set(valdocs).difference( + docindex.reachable_valdocs( + imports=False, submodules=False, packages=False, subclasses=False, + bases=False, overrides=True)) for i, val_doc in enumerate(valdocs): _report_valdoc_progress(i, val_doc, valdocs) # the value's docstring - parse_docstring(val_doc, docindex) + parse_docstring(val_doc, docindex, supress_warnings) # the value's variables' docstrings if (isinstance(val_doc, NamespaceDoc) and val_doc.variables not in (None, UNKNOWN)): @@ -269,7 +283,7 @@ if (isinstance(var_doc.value, ValueDoc) and var_doc.value.defining_module is UNKNOWN): var_doc.value.defining_module = val_doc.defining_module - parse_docstring(var_doc, docindex) + parse_docstring(var_doc, docindex, supress_warnings) log.end_progress() # Take care of inheritance. @@ -1229,6 +1243,24 @@ ## Documentation Inheritance ###################################################################### +def find_overrides(class_doc): + """ + Set the C{overrides} attribute for all variables in C{class_doc}. + This needs to be done early (before docstring parsing), so we can + know which docstrings to supress warnings for. + """ + for base_class in list(class_doc.mro(warn_about_bad_bases=True)): + if base_class == class_doc: continue + if base_class.variables is UNKNOWN: continue + for name, var_doc in base_class.variables.items(): + if ( not (name.startswith('__') and not name.endswith('__')) and + base_class == var_doc.container and + name in class_doc.variables and + class_doc.variables[name].container==class_doc and + class_doc.variables[name].overrides is UNKNOWN ): + class_doc.variables[name].overrides = var_doc + + def inherit_docs(class_doc): for base_class in list(class_doc.mro(warn_about_bad_bases=True)): if base_class == class_doc: continue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |