[Epydoc-commits] SF.net SVN: epydoc: [1775] trunk/epydoc/src/epydoc
Brought to you by:
edloper
From: <ed...@us...> - 2008-02-24 06:09:56
|
Revision: 1775 http://epydoc.svn.sourceforge.net/epydoc/?rev=1775&view=rev Author: edloper Date: 2008-02-23 22:09:50 -0800 (Sat, 23 Feb 2008) Log Message: ----------- - Added --inherit-from-object. Default is now to not inherit methods & properties from object. 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-02-24 05:45:19 UTC (rev 1774) +++ trunk/epydoc/src/epydoc/cli.py 2008-02-24 06:09:50 UTC (rev 1775) @@ -152,7 +152,7 @@ external_api=[], external_api_file=[], external_api_root=[], redundant_details=False, src_code_tab_width=8, verbosity=0, include_timestamp=True, target={}, default_target=None, - pdfdriver='auto', show_submodule_list=True) + pdfdriver='auto', show_submodule_list=True, inherit_from_object=False) # append_const is not defined in py2.3 or py2.4, so use a callback # instead, with the following function: @@ -326,9 +326,19 @@ generation_group.add_option('--no-submodule-list', action='store_false', dest='show_submodule_list', - help="Do not nclude a list of submodules on package " + help="Do not include a list of submodules on package " "documentation pages.") + generation_group.add_option('--inherit-from-object', + action='store_true', dest='inherit_from_object', + help="Include methods & properties that are inherited from " + "\"object\".") + + generation_group.add_option('--no-inherit-from-object', + action='store_false', dest='inherit_from_object', + help="Do not include methods & properties that are inherited " + "from \"object\". (default)") + output_group = OptionGroup(optparser, 'Output Options') optparser.add_option_group(output_group) @@ -647,6 +657,8 @@ options.redundant_details = _str_to_bool(val, optname) elif optname in ('submodule-list', 'submodule_list'): options.show_submodule_list = _str_to_bool(val, optname) + elif optname in ('inherit-from-object', 'inherit_from_object'): + options.inherit_from_object = _str_to_bool(val, optname) # Output options elif optname == 'name': @@ -869,11 +881,13 @@ exclude_parse = '|'.join(options.exclude_parse+options.exclude) exclude_introspect = '|'.join(options.exclude_introspect+ options.exclude) + inherit_from_object = options.inherit_from_object docindex = build_doc_index(options.names, options.introspect, options.parse, add_submodules=(options.actions!=['text']), exclude_introspect=exclude_introspect, - exclude_parse=exclude_parse) + exclude_parse=exclude_parse, + inherit_from_object=inherit_from_object) if docindex is None: for logger in loggers: Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2008-02-24 05:45:19 UTC (rev 1774) +++ trunk/epydoc/src/epydoc/docbuilder.py 2008-02-24 06:09:50 UTC (rev 1775) @@ -147,7 +147,8 @@ def build_doc(item, introspect=True, parse=True, add_submodules=True, - exclude_introspect=None, exclude_parse=None): + exclude_introspect=None, exclude_parse=None, + inherit_from_object=False): """ Build API documentation for a given item, and return it as an L{APIDoc} object. @@ -170,11 +171,13 @@ """ docindex = build_doc_index([item], introspect, parse, add_submodules, exclude_introspect=exclude_introspect, - exclude_parse=exclude_parse) + exclude_parse=exclude_parse, + inherit_from_object=inherit_from_object) return docindex.root[0] def build_doc_index(items, introspect=True, parse=True, add_submodules=True, - exclude_introspect=None, exclude_parse=None): + exclude_introspect=None, exclude_parse=None, + inherit_from_object=False): """ Build API documentation for the given list of items, and return it in the form of a L{DocIndex}. @@ -298,7 +301,7 @@ if isinstance(val_doc, ClassDoc): percent = float(i)/len(valdocs) log.progress(percent, val_doc.canonical_name) - inherit_docs(val_doc) + inherit_docs(val_doc, inherit_from_object) log.end_progress() # Initialize the groups & sortedvars attributes. @@ -1321,9 +1324,10 @@ class_doc.variables[name].overrides = var_doc -def inherit_docs(class_doc): +def inherit_docs(class_doc, inherit_from_object): for base_class in list(class_doc.mro(warn_about_bad_bases=True)): if base_class == class_doc: continue + if base_class.pyval is object and not inherit_from_object: continue # Inherit any groups. Place them *after* this class's groups, # so that any groups that are important to this class come This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |