[Epydoc-commits] SF.net SVN: epydoc: [1162] trunk/epydoc/src/epydoc
Brought to you by:
edloper
From: <ed...@us...> - 2006-04-05 01:58:45
|
Revision: 1162 Author: edloper Date: 2006-04-04 18:58:40 -0700 (Tue, 04 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1162&view=rev Log Message: ----------- - Added VariableDoc.defining_module property (based on its container) - Removed DocIndex.module_that_defines; use the defining_module property instead. Modified Paths: -------------- trunk/epydoc/src/epydoc/apidoc.py trunk/epydoc/src/epydoc/docstringparser.py trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/apidoc.py =================================================================== --- trunk/epydoc/src/epydoc/apidoc.py 2006-04-05 01:51:56 UTC (rev 1161) +++ trunk/epydoc/src/epydoc/apidoc.py 2006-04-05 01:58:40 UTC (rev 1162) @@ -612,6 +612,15 @@ container's cannonical name, and adding the variable's name to it.""") + def _get_defining_module(self): + if self.container is UNKNOWN: + return UNKNOWN + return self.container.defining_module + defining_module = property(_get_defining_module, doc=""" + A read-only property that can be used to get the variable's + defining module. This is defined as the defining module + of the variable's container.""") + def apidoc_links(self, **filters): if self.value in (None, UNKNOWN): return [] @@ -1602,23 +1611,6 @@ parent = api_doc.canonical_name.container() return self.get_valdoc(parent) - # [xx] this could be moved out of docindex and/or removed. - def module_that_defines(self, api_doc): - """ - Return the C{ModuleDoc} of the module that defines C{api_doc}, - or C{None} if that module is not in the index. If C{api_doc} - is itself a module, then C{api_doc} will be returned. - """ - if isinstance(api_doc, VariableDoc): - api_doc = api_doc.container - if api_doc.defining_module == UNKNOWN: return None - if not isinstance(api_doc.defining_module, ModuleDoc): - log.error("Internal error -- %r claims that its defining " - "module is %r, but the latter is not a module." % - (api_doc, api_doc.defining_module)) - return None - return api_doc.defining_module - ###################################################################### ## Pretty Printing ###################################################################### Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2006-04-05 01:51:56 UTC (rev 1161) +++ trunk/epydoc/src/epydoc/docstringparser.py 2006-04-05 01:58:40 UTC (rev 1162) @@ -250,7 +250,7 @@ # Get the name of the item containing the error, and the # filename of its containing module. name = api_doc.canonical_name - module = docindex.module_that_defines(api_doc) + module = api_doc.defining_module if module is not None and module.filename not in (None, UNKNOWN): try: filename = py_src_filename(module.filename) except: filename = module.filename @@ -627,7 +627,7 @@ parse the API documentation for the given object. """ # Find the module that defines api_doc. - module = docindex.module_that_defines(api_doc) + module = api_doc.defining_module # Look up its docformat. if module is not None and module.docformat not in (None, UNKNOWN): docformat = module.docformat Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-05 01:51:56 UTC (rev 1161) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2006-04-05 01:58:40 UTC (rev 1162) @@ -2758,8 +2758,8 @@ else: return None else: - module = self.docindex.module_that_defines(api_doc) - if module is None: return None + module = self.docindex.defining_module + if module == UNKNOWN: return None module_pysrc_url = self.pysrc_url(module) if module_pysrc_url is None: return None module_name = module.canonical_name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |