epydoc-commits Mailing List for Python API documentation generation tool (Page 8)
Brought to you by:
edloper
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(77) |
May
|
Jun
(6) |
Jul
(8) |
Aug
(91) |
Sep
(67) |
Oct
(4) |
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(17) |
Feb
(135) |
Mar
(25) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(62) |
Oct
(1) |
Nov
(3) |
Dec
|
2008 |
Jan
(40) |
Feb
(102) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ed...@us...> - 2007-09-24 18:42:25
|
Revision: 1637 http://epydoc.svn.sourceforge.net/epydoc/?rev=1637&view=rev Author: edloper Date: 2007-09-24 11:42:16 -0700 (Mon, 24 Sep 2007) Log Message: ----------- backed out commit 1635 -- it didnt work as intended Modified Paths: -------------- trunk/epydoc/src/epydoc/docbuilder.py Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 17:53:47 UTC (rev 1636) +++ trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 18:42:16 UTC (rev 1637) @@ -665,6 +665,12 @@ # can actually use -- i.e., they take magic into account. 'canonical_name': 'introspect', + # Only fall-back on the parser for is_imported if the introspecter + # isn't sure. Otherwise, we can end up thinking that vars + # containing modules are not imported, which can cause external + # modules to show up in the docs (sf bug #1653486) + 'is_imported': 'introspect', + # The parser can tell if an assignment creates an alias or not. 'is_alias': 'parse', @@ -946,19 +952,6 @@ def merge_fdel(v1, v2, precedence, cyclecheck, path): return merge_value(v1, v2, precedence, cyclecheck, path+'.fdel') -def merge_is_imported(v1, v2, precedence, cyclecheck, path): - # Always assume that modules are imported. Other than that, - # give precedence to the parser over the introspector. - # This lets us avoid (sf bug #1653486), where external modules - # end up in our docs; and (sf bug #1685385), where decorated - # functions have the wrong module. - if isinstance(v1, ModuleDoc) or isinstance(v2, ModuleDoc): - return True - elif v2 in (None, UNKNOWN): - return v1 - else: - return v2 - def merge_proxy_for(v1, v2, precedence, cyclecheck, path): # Anything we got from introspection shouldn't have a proxy_for # attribute -- it should be the actual object's documentation. @@ -1034,7 +1027,6 @@ register_attribute_mergefunc('posarg_defaults', merge_posarg_defaults) register_attribute_mergefunc('docstring', merge_docstring) register_attribute_mergefunc('docs_extracted_by', merge_docs_extracted_by) -register_attribute_mergefunc('is_imported', merge_is_imported) ###################################################################### ## Import Linking This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 17:53:48
|
Revision: 1636 http://epydoc.svn.sourceforge.net/epydoc/?rev=1636&view=rev Author: edloper Date: 2007-09-24 10:53:47 -0700 (Mon, 24 Sep 2007) Log Message: ----------- - In the import list, show the name of the imported variable, and use a tooltip to show what value it stands for. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-24 17:44:39 UTC (rev 1635) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-24 17:53:47 UTC (rev 1636) @@ -2692,10 +2692,14 @@ def _import(self, var_doc, context): if var_doc.imported_from not in (None, UNKNOWN): - return self.href(var_doc.imported_from, context=context) + return self.href(var_doc.imported_from, + var_doc.name, context=context, + tooltip='%s' % var_doc.imported_from) elif (var_doc.value not in (None, UNKNOWN) and not isinstance(var_doc.value, GenericValueDoc)): - return self.href(var_doc.value, context=context) + return self.href(var_doc.value, + var_doc.name, context=context, + tooltip='%s' % var_doc.value.canonical_name) else: return plaintext_to_html(var_doc.name) @@ -3223,7 +3227,8 @@ return None # [xx] add code to automatically do <code> wrapping or the like? - def href(self, target, label=None, css_class=None, context=None): + def href(self, target, label=None, css_class=None, context=None, + tooltip=None): """ Return the HTML code for an HREF link to the given target (which can be a C{VariableDoc}, a C{ValueDoc}, or a @@ -3263,7 +3268,9 @@ # Get the url for the target. url = self.url(target) - if url is None: return label + if url is None: + if tooltip: return '<span title="%s">%s</span>' % (tooltip, label) + else: return label # Construct a string for the class attribute. if css_class is None: @@ -3278,8 +3285,13 @@ not self._val_is_public(target))): onclick = ' onclick="show_private();"' - return '<a href="%s"%s%s>%s</a>' % (url, css, onclick, label) + if tooltip: + tooltip = ' title="%s"' % tooltip + else: + tooltip = '' + return '<a href="%s"%s%s%s>%s</a>' % (url, css, onclick, tooltip, label) + def _attr_to_html(self, attr, api_doc, indent): if api_doc in (None, UNKNOWN): return '' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 17:44:50
|
Revision: 1635 http://epydoc.svn.sourceforge.net/epydoc/?rev=1635&view=rev Author: edloper Date: 2007-09-24 10:44:39 -0700 (Mon, 24 Sep 2007) Log Message: ----------- - the 'is_imported' field now has a custom merge func -- fixes sf bug 1685385. Modified Paths: -------------- trunk/epydoc/src/epydoc/docbuilder.py Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 15:58:38 UTC (rev 1634) +++ trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 17:44:39 UTC (rev 1635) @@ -661,19 +661,15 @@ MERGE_PRECEDENCE = { 'repr': 'parse', - # Why? + # The names we get from introspection match the names that users + # can actually use -- i.e., they take magic into account. 'canonical_name': 'introspect', - # Only fall-back on the parser for is_imported if the introspecter - # isn't sure. Otherwise, we can end up thinking that vars - # containing modules are not imported, which can cause external - # modules to show up in the docs (sf bug #1653486) - 'is_imported': 'introspect', - # The parser can tell if an assignment creates an alias or not. 'is_alias': 'parse', - # Why? + # The parser is better able to determine what text file something + # came from; e.g., it can't be fooled by 'covert' imports. 'docformat': 'parse', # The parse should be able to tell definitively whether a module @@ -941,17 +937,6 @@ assert value1 is not None and value2 is not None return merge_docs(value1, value2, cyclecheck, path) -# [xx] are these really necessary or useful?? -def merge_package(v1, v2, precedence, cyclecheck, path): - if v1 is None or v2 is None: - if precedence == 'introspect': return v1 - else: return v2 - return merge_value(v1, v2, precedence, cyclecheck, path+'.<package>') -def merge_container(v1, v2, precedence, cyclecheck, path): - if v1 is None or v2 is None: - if precedence == 'introspect': return v1 - else: return v2 - return merge_value(v1, v2, precedence, cyclecheck, path+'.<container>') def merge_overrides(v1, v2, precedence, cyclecheck, path): return merge_value(v1, v2, precedence, cyclecheck, path+'.<overrides>') def merge_fget(v1, v2, precedence, cyclecheck, path): @@ -961,6 +946,19 @@ def merge_fdel(v1, v2, precedence, cyclecheck, path): return merge_value(v1, v2, precedence, cyclecheck, path+'.fdel') +def merge_is_imported(v1, v2, precedence, cyclecheck, path): + # Always assume that modules are imported. Other than that, + # give precedence to the parser over the introspector. + # This lets us avoid (sf bug #1653486), where external modules + # end up in our docs; and (sf bug #1685385), where decorated + # functions have the wrong module. + if isinstance(v1, ModuleDoc) or isinstance(v2, ModuleDoc): + return True + elif v2 in (None, UNKNOWN): + return v1 + else: + return v2 + def merge_proxy_for(v1, v2, precedence, cyclecheck, path): # Anything we got from introspection shouldn't have a proxy_for # attribute -- it should be the actual object's documentation. @@ -1027,9 +1025,6 @@ register_attribute_mergefunc('variables', merge_variables) register_attribute_mergefunc('value', merge_value) -# [xx] are these useful/necessary? -#register_attribute_mergefunc('package', merge_package) -#register_attribute_mergefunc('container', merge_container) register_attribute_mergefunc('overrides', merge_overrides) register_attribute_mergefunc('fget', merge_fget) register_attribute_mergefunc('fset', merge_fset) @@ -1039,6 +1034,7 @@ register_attribute_mergefunc('posarg_defaults', merge_posarg_defaults) register_attribute_mergefunc('docstring', merge_docstring) register_attribute_mergefunc('docs_extracted_by', merge_docs_extracted_by) +register_attribute_mergefunc('is_imported', merge_is_imported) ###################################################################### ## Import Linking This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-09-24 15:59:47
|
Revision: 1632 http://epydoc.svn.sourceforge.net/epydoc/?rev=1632&view=rev Author: dvarrazzo Date: 2007-09-24 08:52:11 -0700 (Mon, 24 Sep 2007) Log Message: ----------- - Dropped extra paragraph in metadata values read from variables. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-09-24 01:36:56 UTC (rev 1631) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-09-24 15:52:11 UTC (rev 1632) @@ -318,7 +318,7 @@ else: elt = unicode(elt) elt = epytext.ParsedEpytextDocstring( - epytext.parse_as_para(elt)) + epytext.parse_as_para(elt), inline=True) # Add in the metadata and remove from the variables api_doc.metadata.append( (field, varname, elt) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-09-24 15:58:45
|
Revision: 1634 http://epydoc.svn.sourceforge.net/epydoc/?rev=1634&view=rev Author: dvarrazzo Date: 2007-09-24 08:58:38 -0700 (Mon, 24 Sep 2007) Log Message: ----------- - Links to API objects rendered in monotype font. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html_css.py Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-09-24 15:53:48 UTC (rev 1633) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-09-24 15:58:38 UTC (rev 1634) @@ -71,6 +71,8 @@ h3 { font-size: +110%; font-style: italic; font-weight: normal; } code { font-size: 100%; } +/* N.B.: class, not pseudoclass */ +a.link { font-family: monospace; } /* Page Header & Footer * - The standard page header consists of a navigation bar (with This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dva...@us...> - 2007-09-24 15:54:46
|
Revision: 1633 http://epydoc.svn.sourceforge.net/epydoc/?rev=1633&view=rev Author: dvarrazzo Date: 2007-09-24 08:53:48 -0700 (Mon, 24 Sep 2007) Log Message: ----------- - Generate anchors for index terms. Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/restructuredtext.py Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-09-24 15:52:11 UTC (rev 1632) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-09-24 15:53:48 UTC (rev 1633) @@ -676,7 +676,17 @@ self.body.append(doctest_to_html(pysrc)) raise SkipNode() + def visit_emphasis(self, node): + # Generate a corrent index term anchor + if 'term' in node.get('classes') and node.children: + doc = self.document.copy() + doc[:] = [node.children[0].copy()] + self.body.append( + self._linker.translate_indexterm(ParsedRstDocstring(doc))) + raise SkipNode() + HTMLTranslator.visit_emphasis(self, node) + def python_code_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 01:36:58
|
Revision: 1631 http://epydoc.svn.sourceforge.net/epydoc/?rev=1631&view=rev Author: edloper Date: 2007-09-23 18:36:56 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Fixed bug in parsedEpytextDocstring constructor if the given dom_tree is None. (caused when there's a parse error) Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/epytext.py Modified: trunk/epydoc/src/epydoc/markup/epytext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/epytext.py 2007-09-24 01:01:14 UTC (rev 1630) +++ trunk/epydoc/src/epydoc/markup/epytext.py 2007-09-24 01:36:56 UTC (rev 1631) @@ -1732,7 +1732,7 @@ self._html = self._latex = self._plaintext = None self._terms = None # inline option -- mark top-level children as inline. - if options.get('inline'): + if options.get('inline') and self._tree is not None: for elt in self._tree.children: elt.attribs['inline'] = True This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 01:01:15
|
Revision: 1630 http://epydoc.svn.sourceforge.net/epydoc/?rev=1630&view=rev Author: edloper Date: 2007-09-23 18:01:14 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Updated test to reflect that colorization of '\uaaaa' in a string now generates an xml charref in the output, not a python escape Modified Paths: -------------- trunk/epydoc/src/epydoc/test/pyval_repr.doctest Modified: trunk/epydoc/src/epydoc/test/pyval_repr.doctest =================================================================== --- trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-09-24 00:49:36 UTC (rev 1629) +++ trunk/epydoc/src/epydoc/test/pyval_repr.doctest 2007-09-24 01:01:14 UTC (rev 1630) @@ -6,7 +6,10 @@ >>> def color(v, linebreakok=True): ... colorizer = PyvalColorizer(linelen=40, linebreakok=linebreakok) ... pds = colorizer.colorize(v, None) - ... print pds.to_html(None).rstrip() + ... s = pds.to_html(None).rstrip() + ... if isinstance(s, unicode): + ... s = s.encode('ascii', 'xmlcharrefreplace') + ... print s Simple Types ============ @@ -78,7 +81,7 @@ >>> color(u"Hello world") <code class="variable-quote">u'</code><code class="variable-string">Hello world</code><code class="variable-quote">'</code> >>> color(u"\uaaaa And \ubbbb") - <code class="variable-quote">u'</code><code class="variable-string">\uaaaa And \ubbbb</code><code class="variable-quote">'</code> + <code class="variable-quote">u'</code><code class="variable-string">ꪪ And 뮻</code><code class="variable-quote">'</code> Lists, Tuples, etc. =================== @@ -263,15 +266,15 @@ repr: ['hello', 123] score: 3 (ok) - >>> color2(A()) + >>> color2(A()) # doctest: +ELLIPSIS repr: <__builtin__.A instance at ...> score: -4 (bad) - >>> color2([A()]) + >>> color2([A()]) # doctest: +ELLIPSIS repr: [<__builtin__.A instance at ...>] score: -3 (bad) - >>> color2([A(),1,2,3,4,5,6]) + >>> color2([A(),1,2,3,4,5,6]) # doctest: +ELLIPSIS repr: [<__builtin__.A instance at ...>, 1, 2, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 00:49:37
|
Revision: 1629 http://epydoc.svn.sourceforge.net/epydoc/?rev=1629&view=rev Author: edloper Date: 2007-09-23 17:49:36 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Changed all sites that expected DottedName to raise an exception to use the strict=True option, to make sure it does. Modified Paths: -------------- trunk/epydoc/src/epydoc/docbuilder.py trunk/epydoc/src/epydoc/docintrospecter.py trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 00:48:48 UTC (rev 1628) +++ trunk/epydoc/src/epydoc/docbuilder.py 2007-09-24 00:49:36 UTC (rev 1629) @@ -1213,7 +1213,7 @@ hasattr(val_doc.pyval, '__name__')): try: name = DottedName(DottedName.UNREACHABLE, - val_doc.pyval.__name__) + val_doc.pyval.__name__, strict=True) except DottedName.InvalidDottedName: name = DottedName(DottedName.UNREACHABLE) else: Modified: trunk/epydoc/src/epydoc/docintrospecter.py =================================================================== --- trunk/epydoc/src/epydoc/docintrospecter.py 2007-09-24 00:48:48 UTC (rev 1628) +++ trunk/epydoc/src/epydoc/docintrospecter.py 2007-09-24 00:49:36 UTC (rev 1629) @@ -157,7 +157,7 @@ pyid = id(value) val_doc = _valuedoc_cache.get(pyid) if val_doc is None: - try: canonical_name = get_canonical_name(value) + try: canonical_name = get_canonical_name(value, strict=True) except DottedName.InvalidDottedName: canonical_name = UNKNOWN val_doc = ValueDoc(pyval=value, canonical_name = canonical_name, docs_extracted_by='introspecter') @@ -592,7 +592,7 @@ name) return None -def get_canonical_name(value): +def get_canonical_name(value, strict=False): """ @return: the canonical name for C{value}, or C{UNKNOWN} if no canonical name can be found. Currently, C{get_canonical_name} @@ -606,30 +606,31 @@ # Get the name via introspection. if isinstance(value, ModuleType): - dotted_name = DottedName(value.__name__) + dotted_name = DottedName(value.__name__, strict=strict) elif isclass(value): if value.__module__ == '__builtin__': - dotted_name = DottedName(value.__name__) + dotted_name = DottedName(value.__name__, strict=strict) else: - dotted_name = DottedName(value.__module__, value.__name__) + dotted_name = DottedName(value.__module__, value.__name__, + strict=strict) elif (inspect.ismethod(value) and value.im_self is not None and value.im_class is ClassType and not value.__name__.startswith('<')): # class method. class_name = get_canonical_name(value.im_self) if class_name is UNKNOWN: return UNKNOWN - dotted_name = DottedName(class_name, value.__name__) + dotted_name = DottedName(class_name, value.__name__, strict=strict) elif (inspect.ismethod(value) and not value.__name__.startswith('<')): class_name = get_canonical_name(value.im_class) if class_name is UNKNOWN: return UNKNOWN - dotted_name = DottedName(class_name, value.__name__) + dotted_name = DottedName(class_name, value.__name__, strict=strict) elif (isinstance(value, FunctionType) and not value.__name__.startswith('<')): module_name = _find_function_module(value) if module_name is None: return UNKNOWN - dotted_name = DottedName(module_name, value.__name__) + dotted_name = DottedName(module_name, value.__name__, strict=strict) else: return UNKNOWN Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-09-24 00:48:48 UTC (rev 1628) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-09-24 00:49:36 UTC (rev 1629) @@ -693,7 +693,7 @@ """Record the fact that C{api_doc} can raise the exception named C{tag} in C{api_doc.exception_descrs}.""" _check(api_doc, tag, arg, context=RoutineDoc, expect_arg='single') - try: name = DottedName(arg) + try: name = DottedName(arg, strict=True) except DottedName.InvalidDottedName: name = arg api_doc.exception_descrs.append( (name, descr) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 00:49:05
|
Revision: 1628 http://epydoc.svn.sourceforge.net/epydoc/?rev=1628&view=rev Author: edloper Date: 2007-09-23 17:48:48 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Added 'strict' option to DottedName constructor -- if true, then raise an exception if we see an ill-formed name. Modified Paths: -------------- trunk/epydoc/src/epydoc/apidoc.py Modified: trunk/epydoc/src/epydoc/apidoc.py =================================================================== --- trunk/epydoc/src/epydoc/apidoc.py 2007-09-24 00:48:14 UTC (rev 1627) +++ trunk/epydoc/src/epydoc/apidoc.py 2007-09-24 00:48:48 UTC (rev 1628) @@ -83,7 +83,7 @@ """A cache of identifier strings that have been checked against _IDENTIFIER_RE and found to be acceptable.""" - def __init__(self, *pieces): + def __init__(self, *pieces, **options): """ Construct a new dotted name from the given sequence of pieces, each of which can be either a C{string} or a C{DottedName}. @@ -98,6 +98,9 @@ of values. In that case, that tuple will be used as the C{DottedName}'s identifiers; it will I{not} be checked to see if it's valid. + + @kwparam strict: if true, then raise an L{InvalidDottedName} + if the given name is invalid. """ if len(pieces) == 1 and isinstance(pieces[0], tuple): self._identifiers = pieces[0] # Optimization @@ -112,10 +115,14 @@ for subpiece in piece.split('.'): if piece not in self._ok_identifiers: if not self._IDENTIFIER_RE.match(subpiece): - #raise DottedName.InvalidDottedName( - # 'Bad identifier %r' % (piece,)) - log.warning("Identifier %r looks suspicious; " - "using it anyway." % piece) + if options.get('strict'): + raise DottedName.InvalidDottedName( + 'Bad identifier %r' % (piece,)) + else: + raise DottedName.InvalidDottedName( + 'Bad identifier %r' % (piece,)) + log.warning("Identifier %r looks suspicious; " + "using it anyway." % piece) self._ok_identifiers.add(piece) self._identifiers.append(subpiece) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 00:48:16
|
Revision: 1627 http://epydoc.svn.sourceforge.net/epydoc/?rev=1627&view=rev Author: edloper Date: 2007-09-23 17:48:14 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Use cProfiler, if it's available, for --profile-epydoc Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2007-09-24 00:33:58 UTC (rev 1626) +++ trunk/epydoc/src/epydoc/cli.py 2007-09-24 00:48:14 UTC (rev 1627) @@ -86,7 +86,7 @@ GRAPH_TYPES = ('classtree', 'callgraph', 'umlclasstree') ACTIONS = ('html', 'text', 'latex', 'dvi', 'ps', 'pdf', 'check') DEFAULT_DOCFORMAT = 'epytext' -PROFILER = 'hotshot' #: Which profiler to use: 'hotshot' or 'profile' +PROFILER = 'profile' #: Which profiler to use: 'hotshot' or 'profile' ###################################################################### #{ Help Topics @@ -992,16 +992,21 @@ # Standard 'profile' profiler. elif PROFILER == 'profile': - try: from profile import Profile + # cProfile module was added in Python 2.5 -- use it if its' + # available, since it's faster. + try: from cProfile import Profile except ImportError: - print >>sys.stderr, "Could not import profile module!" - return + try: from profile import Profile + except ImportError: + print >>sys.stderr, "Could not import profile module!" + return # There was a bug in Python 2.4's profiler. Check if it's # present, and if so, fix it. (Bug was fixed in 2.4maint: # <http://mail.python.org/pipermail/python-checkins/ # 2005-September/047099.html>) - if (Profile.dispatch['c_exception'] is + if (hasattr(Profile, 'dispatch') and + Profile.dispatch['c_exception'] is Profile.trace_dispatch_exception.im_func): trace_dispatch_return = Profile.trace_dispatch_return.im_func Profile.dispatch['c_exception'] = trace_dispatch_return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-24 00:34:01
|
Revision: 1626 http://epydoc.svn.sourceforge.net/epydoc/?rev=1626&view=rev Author: edloper Date: 2007-09-23 17:33:58 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - fixed sf bug [ 1675832 ] minor troubles with python properties in Html output -- links to private objects now include 'onclick="show_private()"', which shows private objects. (E.g., for property fget/fset/fdel functions) Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 19:44:06 UTC (rev 1625) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-24 00:33:58 UTC (rev 1626) @@ -1416,6 +1416,7 @@ def write_javascript(self, directory): jsfile = open(os.path.join(directory, 'epydoc.js'), 'w') print >> jsfile, self.TOGGLE_PRIVATE_JS + print >> jsfile, self.SHOW_PRIVATE_JS print >> jsfile, self.GET_COOKIE_JS print >> jsfile, self.SET_FRAME_JS print >> jsfile, self.HIDE_PRIVATE_JS @@ -1532,6 +1533,19 @@ } '''.strip() + SHOW_PRIVATE_JS = ''' + function show_private() { + var elts = document.getElementsByTagName("a"); + for(var i=0; i<elts.length; i++) { + if (elts[i].className == "privatelink") { + cmd = elts[i].innerHTML; + if (cmd && cmd.substr(0,4)=="show") + toggle_private(); + } + } + } + '''.strip() + GET_ANCHOR_JS = ''' function get_anchor() { var href = location.href; @@ -1744,10 +1758,9 @@ // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. - checkCookie() + checkCookie(); // --> </script> - </body> </html> ''') @@ -3258,8 +3271,15 @@ else: css = ' class="%s"' % css_class - return '<a href="%s"%s>%s</a>' % (url, css, label) + onclick = '' + if ((isinstance(target, VariableDoc) and not target.is_public) or + (isinstance(target, ValueDoc) and + not isinstance(target, GenericValueDoc) and + not self._val_is_public(target))): + onclick = ' onclick="show_private();"' + return '<a href="%s"%s%s>%s</a>' % (url, css, onclick, label) + def _attr_to_html(self, attr, api_doc, indent): if api_doc in (None, UNKNOWN): return '' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 19:44:10
|
Revision: 1625 http://epydoc.svn.sourceforge.net/epydoc/?rev=1625&view=rev Author: edloper Date: 2007-09-23 12:44:06 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - applied sf patch [ 1673945 ] html.py / crarr.png is broken -- use 'wb' when writing .png files. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 19:39:01 UTC (rev 1624) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 19:44:06 UTC (rev 1625) @@ -1674,7 +1674,7 @@ def write_images(self, directory): for (name, data) in self.IMAGES.items(): - f = open(os.path.join(directory, name), 'w') + f = open(os.path.join(directory, name), 'wb') f.write(base64.decodestring(data)) f.close() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 19:39:03
|
Revision: 1624 http://epydoc.svn.sourceforge.net/epydoc/?rev=1624&view=rev Author: edloper Date: 2007-09-23 12:39:01 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - fixed sf bug [ 1663578 ] Rendering of unicode default values -- unicode values are now displayed using unicode chars, not ascii. If this turns out not to be popular, it can be changed back with a single switch (PyvalColorize.ESCAPE_UNICODE) Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/pyval_repr.py Modified: trunk/epydoc/src/epydoc/markup/pyval_repr.py =================================================================== --- trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-09-23 19:25:54 UTC (rev 1623) +++ trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-09-23 19:39:01 UTC (rev 1624) @@ -133,6 +133,8 @@ GENERIC_OBJECT_RE = re.compile(r'^<.* at 0x[0-9a-f]+>$', re.IGNORECASE) + ESCAPE_UNICODE = False # should we escape non-ascii unicode chars? + #//////////////////////////////////////////////////////////// # Entry Point #//////////////////////////////////////////////////////////// @@ -184,7 +186,10 @@ elif pyval_type is str: self._colorize_str(pyval, state, '', 'string-escape') elif pyval_type is unicode: - self._colorize_str(pyval, state, 'u', 'unicode-escape') + if self.ESCAPE_UNICODE: + self._colorize_str(pyval, state, 'u', 'unicode-escape') + else: + self._colorize_str(pyval, state, 'u', None) elif pyval_type is list: self._multiline(self._colorize_iter, pyval, state, '[', ']') elif pyval_type is tuple: @@ -306,7 +311,8 @@ # Body for i, line in enumerate(lines): if i>0: self._output('\n', None, state) - self._output(line.encode(encoding), self.STRING_TAG, state) + if encoding: line = line.encode(encoding) + self._output(line, self.STRING_TAG, state) # Close quote. self._output(quote, self.QUOTE_TAG, state) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 19:25:58
|
Revision: 1623 http://epydoc.svn.sourceforge.net/epydoc/?rev=1623&view=rev Author: edloper Date: 2007-09-23 12:25:54 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - fixed sf bug [ 1658475 ] weird warning with property() -- applied patch supplied by dvarrazzo. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 19:18:08 UTC (rev 1622) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 19:25:54 UTC (rev 1623) @@ -774,11 +774,19 @@ api_doc.return_descr = descr def process_rtype_field(api_doc, docindex, tag, arg, descr): - _check(api_doc, tag, arg, context=RoutineDoc, expect_arg=False) - if api_doc.return_type is not None: - raise ValueError(REDEFINED % 'return value type') - api_doc.return_type = descr + _check(api_doc, tag, arg, + context=(RoutineDoc, PropertyDoc), expect_arg=False) + if isinstance(api_doc, RoutineDoc): + if api_doc.return_type is not None: + raise ValueError(REDEFINED % 'return value type') + api_doc.return_type = descr + elif isinstance(api_doc, PropertyDoc): + _check(api_doc, tag, arg, expect_arg=False) + if api_doc.type_descr is not None: + raise ValueError(REDEFINED % tag) + api_doc.type_descr = descr + def process_arg_field(api_doc, docindex, tag, arg, descr): _check(api_doc, tag, arg, context=RoutineDoc, expect_arg=True) idents = re.split('[:;, ] *', arg) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 19:18:11
|
Revision: 1622 http://epydoc.svn.sourceforge.net/epydoc/?rev=1622&view=rev Author: edloper Date: 2007-09-23 12:18:08 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Fixed svn bug 1700614 -- private known subclasses are shown always. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py trunk/epydoc/src/epydoc/docwriter/html_css.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 18:54:23 UTC (rev 1621) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 19:18:08 UTC (rev 1622) @@ -860,9 +860,15 @@ if (doc.subclasses not in (UNKNOWN, None) and len(doc.subclasses) > 0): out('<dl><dt>Known Subclasses:</dt>\n<dd>\n ') - out(',\n '.join([self.href(c, context=doc) - for c in doc.subclasses])) - out('\n</dd></dl>\n\n') + out(' <ul class="subclass-list">\n') + for i, subclass in enumerate(doc.subclasses): + href = self.href(subclass, context=doc) + if self._val_is_public(subclass): css = '' + else: css = ' class="private"' + if i > 0: href = ', '+href + out('<li%s>%s</li>' % (css, href)) + out(' </ul>\n') + out('</dd></dl>\n\n') out('<hr />\n') @@ -1444,7 +1450,7 @@ elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block"); } } - // Update all table rowss containing private objects. Note, we + // Update all table rows containing private objects. Note, we // use "" instead of "block" becaue IE & firefox disagree on what // this should be (block vs table-row), and "" just gives the // default for both browsers. @@ -1459,7 +1465,7 @@ for(var i=0; i<elts.length; i++) { if (elts[i].className == "private") { elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")? - "none":"list-item"); + "none":""); } } // Update all list items containing private objects. @@ -3028,6 +3034,16 @@ #{ Helper functions #//////////////////////////////////////////////////////////// + def _val_is_public(self, valdoc): + """Make a best-guess as to whether the given class is public.""" + container = self.docindex.container(valdoc) + if container is not None: + for vardoc in container.variables.values(): + if vardoc in (UNKNOWN, None): continue + if vardoc.value is valdoc: + return vardoc.is_public + return True + # [XX] Is it worth-while to pull the anchor tricks that I do here? # Or should I just live with the fact that show/hide private moves # stuff around? Modified: trunk/epydoc/src/epydoc/docwriter/html_css.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-09-23 18:54:23 UTC (rev 1621) +++ trunk/epydoc/src/epydoc/docwriter/html_css.py 2007-09-23 19:18:08 UTC (rev 1622) @@ -201,6 +201,11 @@ .summary-sig-arg { color: $summary_sig_arg; } .summary-sig-default { color: $summary_sig_default; } +/* Subclass list + */ +ul.subclass-list { display: inline; } +ul.subclass-list li { display: inline; } + /* To render variables, classes etc. like functions */ table.summary .summary-name { color: $summary_sig_name; font-weight: bold; font-family: monospace; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 18:54:26
|
Revision: 1621 http://epydoc.svn.sourceforge.net/epydoc/?rev=1621&view=rev Author: edloper Date: 2007-09-23 11:54:23 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Set parskip to 2ex. (including inside function descriptions) Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 18:28:23 UTC (rev 1620) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 18:54:23 UTC (rev 1621) @@ -38,6 +38,7 @@ "\\setlength{\\topmargin}{-\\headsep}", # By default, do not indent paragraphs. "\\setlength{\\parindent}{0ex}", + "\\setlength{\\parskip}{2ex}", # Double the standard size boxedminipage outlines. "\\setlength{\\fboxrule}{2\\fboxrule}", # Create a 'base class' length named BCL for use in base trees. @@ -272,9 +273,9 @@ # Add a table of contents. self.write_start_of(out, 'Table of Contents') - out('\\addtolength{\\parskip}{-1ex}\n') + out('\\addtolength{\\parskip}{-2ex}\n') out('\\tableofcontents\n') - out('\\addtolength{\\parskip}{1ex}\n') + out('\\addtolength{\\parskip}{2ex}\n') # Include documentation files. self.write_start_of(out, 'Includes') @@ -727,11 +728,12 @@ out(' \\rule{\\textwidth}{0.5\\fboxrule}\n') # Description + out("\\setlength{\\parskip}{2ex}\n") if func_doc.descr not in (None, UNKNOWN): out(self.docstring_to_latex(func_doc.descr, 4)) - out(' \\vspace{1ex}\n\n') # Parameters + out("\\setlength{\\parskip}{1ex}\n") if func_doc.arg_descrs or func_doc.arg_types: # Find the longest name. longest = max([0]+[len(n) for n in func_doc.arg_types]) @@ -739,6 +741,7 @@ longest = max([longest]+[len(n) for n in names]) # Table header. out(' '*6+'\\textbf{Parameters}\n') + out(' \\vspace{-1ex}\n\n') out(' '*6+'\\begin{quote}\n') out(' \\begin{Ventry}{%s}\n\n' % (longest*'x')) # Add params that have @type but not @param info: @@ -766,13 +769,13 @@ out('%s{\\it (%s=%s)}\n\n' % (' '*12, lhs, rhs)) out(' \\end{Ventry}\n\n') out(' '*6+'\\end{quote}\n\n') - out(' \\vspace{1ex}\n\n') # Returns rdescr = func_doc.return_descr rtype = func_doc.return_type if rdescr not in (None, UNKNOWN) or rtype not in (None, UNKNOWN): out(' '*6+'\\textbf{Return Value}\n') + out(' \\vspace{-1ex}\n\n') out(' '*6+'\\begin{quote}\n') if rdescr not in (None, UNKNOWN): out(self.docstring_to_latex(rdescr, 6)) @@ -782,11 +785,11 @@ elif rtype not in (None, UNKNOWN): out(self.docstring_to_latex(rtype, 6)) out(' '*6+'\\end{quote}\n\n') - out(' \\vspace{1ex}\n\n') # Raises if func_doc.exception_descrs not in (None, UNKNOWN, [], ()): out(' '*6+'\\textbf{Raises}\n') + out(' \\vspace{-1ex}\n\n') out(' '*6+'\\begin{quote}\n') out(' \\begin{description}\n\n') for name, descr in func_doc.exception_descrs: @@ -795,7 +798,6 @@ out(self.docstring_to_latex(descr, 10)) out(' \\end{description}\n\n') out(' '*6+'\\end{quote}\n\n') - out(' \\vspace{1ex}\n\n') ## Overrides if var_doc.overrides not in (None, UNKNOWN): @@ -913,7 +915,7 @@ out(self._VAR_GROUP_HEADER % (hdr)) out('\\cline{1-2}\n') for var_doc in grouped_inh_vars[base]: - if isinstance(var_doc, PropertyDoc): + if isinstance(var_doc.value3, PropertyDoc): self.write_property_list_line(out, var_doc) else: self.write_var_list_line(out, var_doc) @@ -947,7 +949,7 @@ out('\\cline{1-2}\n') # Write an entry for each normal var: for var_doc in normal_vars: - if isinstance(var_doc, PropertyDoc): + if isinstance(var_doc.value, PropertyDoc): self.write_property_list_line(out, var_doc) else: self.write_var_list_line(out, var_doc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 18:28:34
|
Revision: 1620 http://epydoc.svn.sourceforge.net/epydoc/?rev=1620&view=rev Author: edloper Date: 2007-09-23 11:28:23 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - method & var descriptions are now 'inset' a little bit -- makes it easier to read the page. - added support for inheritance options w/ latex. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 15:17:43 UTC (rev 1619) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 18:28:23 UTC (rev 1620) @@ -84,6 +84,25 @@ "% Exceptions", "\\newcommand{\\pysrcexcept}[1]{\\textcolor{py@exceptcolour}" "{\\small\\textbf{#1}}}", + # Size of the function description boxes. + "\\newlength{\\funcindent}", + "\\newlength{\\funcwidth}", + "\\setlength{\\funcindent}{1cm}", + "\\setlength{\\funcwidth}{\\textwidth}", + "\\addtolength{\\funcwidth}{-2\\funcindent}", + # Size of the var description tables. + "\\newlength{\\varindent}", + "\\newlength{\\varnamewidth}", + "\\newlength{\\vardescrwidth}", + "\\newlength{\\varwidth}", + "\\setlength{\\varindent}{1cm}", + "\\setlength{\\varnamewidth}{.3\\textwidth}", + "\\setlength{\\varwidth}{\\textwidth}", + "\\addtolength{\\varwidth}{-4\\tabcolsep}", + "\\addtolength{\\varwidth}{-3\\arrayrulewidth}", + "\\addtolength{\\varwidth}{-2\\varindent}", + "\\setlength{\\vardescrwidth}{\\varwidth}", + "\\addtolength{\\vardescrwidth}{-\\varnamewidth}", # Define new environment for displaying parameter lists. textwrap.dedent("""\ \\newenvironment{Ventry}[1]% @@ -124,7 +143,7 @@ #: the C{inputenc} LaTeX package. self._encoding = kwargs.get('encoding', 'utf-8') - self.valdocs = sorted(docindex.reachable_valdocs( + self.valdocs = valdocs = sorted(docindex.reachable_valdocs( imports=False, packages=False, bases=False, submodules=False, subclasses=False, private=self._show_private)) self._num_files = self.num_files() @@ -132,6 +151,11 @@ if self._show_private: self._public_filter = None else: self._public_filter = True + self.class_list = [d for d in valdocs if isinstance(d, ClassDoc)] + """The list of L{ClassDoc}s for the documented classes.""" + self.class_set = set(self.class_list) + """The set of L{ClassDoc}s for the documented classes.""" + def write(self, directory=None): """ Write the API documentation for the entire project to the @@ -591,8 +615,10 @@ #//////////////////////////////////////////////////////////// #{ Function List #//////////////////////////////////////////////////////////// + _FUNC_GROUP_HEADER = '\n\\large{\\textbf{\\textit{%s}}}\n\n' def write_func_list(self, out, heading, doc, value_type, seclevel=1): + # Divide all public variables of the given type into groups. groups = [(plaintext_to_latex(group_name), doc.select_variables(group=group_name, imported=False, value_type=value_type, @@ -607,16 +633,76 @@ self.write_start_of(out, heading) out(' '+self.section(heading, seclevel)) + # Write a section for each group. + grouped_inh_vars = {} for name, var_docs in groups: - if name: - out('\n%s\\large{%s}\n' % (self.HRULE, name)) - for var_doc in var_docs: - self.write_func_list_box(out, var_doc) - # [xx] deal with inherited methods better???? - #if (self._inheritance == 'listed' and - # isinstance(container, ClassDoc)): - # out(self._inheritance_list(group, container.uid())) + self.write_func_group(out, doc, name, var_docs, grouped_inh_vars) + + # Write a section for each inheritance pseudo-group (used if + # inheritance=='grouped') + if grouped_inh_vars: + for base in doc.mro(): + if base in grouped_inh_vars: + hdr = ('Inherited from %s' % + plaintext_to_latex('%s' % base.canonical_name)) + if self._crossref and base in self.class_set: + hdr += ('\\textit{(Section \\ref{%s})}' % + self.label(base)) + out(self._FUNC_GROUP_HEADER % (hdr)) + for var_doc in grouped_inh_vars[base]: + self.write_func_list_box(out, var_doc) + + def write_func_group(self, out, doc, name, var_docs, grouped_inh_vars): + # Split up the var_docs list, according to the way each var + # should be displayed: + # - listed_inh_vars -- for listed inherited variables. + # - grouped_inh_vars -- for grouped inherited variables. + # - normal_vars -- for all other variables. + listed_inh_vars = {} + normal_vars = [] + for var_doc in var_docs: + if var_doc.container != doc: + base = var_doc.container + if (base not in self.class_set or + self._inheritance == 'listed'): + listed_inh_vars.setdefault(base,[]).append(var_doc) + elif self._inheritance == 'grouped': + grouped_inh_vars.setdefault(base,[]).append(var_doc) + else: + normal_vars.append(var_doc) + else: + normal_vars.append(var_doc) + # Write a header for the group. + if name: + out(self._FUNC_GROUP_HEADER % name) + # Write an entry for each normal var: + for var_doc in normal_vars: + self.write_func_list_box(out, var_doc) + # Write a subsection for inherited vars: + if listed_inh_vars: + self.write_func_inheritance_list(out, doc, listed_inh_vars) + + def write_func_inheritance_list(self, out, doc, listed_inh_vars): + for base in doc.mro(): + if base not in listed_inh_vars: continue + #if str(base.canonical_name) == 'object': continue + var_docs = listed_inh_vars[base] + if self._public_filter: + var_docs = [v for v in var_docs if v.is_public] + if var_docs: + hdr = ('Inherited from %s' % + plaintext_to_latex('%s' % base.canonical_name)) + if self._crossref and base in self.class_set: + hdr += ('\\textit{(Section \\ref{%s})}' % + self.label(base)) + out(self._FUNC_GROUP_HEADER % hdr) + out('\\begin{quote}\n') + out('%s\n' % ', '.join( + ['%s()' % plaintext_to_latex(var_doc.name) + for var_doc in var_docs])) + out('\\end{quote}\n') + def write_func_list_box(self, out, var_doc): func_doc = var_doc.value is_inherited = (var_doc.overrides not in (None, UNKNOWN)) @@ -629,7 +715,8 @@ # Start box for this function. out(' \\vspace{0.5ex}\n\n') - out(' \\begin{boxedminipage}{\\textwidth}\n\n') + out('\\hspace{.8\\funcindent}') + out('\\begin{boxedminipage}{\\funcwidth}\n\n') # Function signature. out(' %s\n\n' % self.function_signature(var_doc)) @@ -767,6 +854,7 @@ #//////////////////////////////////////////////////////////// #{ Variable List #//////////////////////////////////////////////////////////// + _VAR_GROUP_HEADER = '\\multicolumn{2}{|l|}{\\textit{%s}}\\\\\n' # Also used for the property list. def write_var_list(self, out, heading, doc, value_type, seclevel=1): @@ -784,9 +872,13 @@ self.write_start_of(out, heading) out(' '+self.section(heading, seclevel)) + # [xx] without this, there's a huge gap before the table -- why?? + out(' \\vspace{-1cm}\n') + + out('\\hspace{\\varindent}') out('\\begin{longtable}') - out('{|p{.30\\textwidth}|') - out('p{.62\\textwidth}|l}\n') + out('{|p{\\varnamewidth}|') + out('p{\\vardescrwidth}|l}\n') out('\\cline{1-2}\n') # Set up the headers & footer (this makes the table span @@ -803,23 +895,87 @@ out('\\cline{1-2}\n') out('\\endlastfoot') + # Write a section for each group. + grouped_inh_vars = {} for name, var_docs in groups: - if name: - out('\\multicolumn{2}{|l|}{') - out('\\textbf{%s}}\\\\\n' % name) - out('\\cline{1-2}\n') - for var_doc in var_docs: - if isinstance(var_doc, PropertyDoc): - self.write_property_list_line(out, var_doc) + self.write_var_group(out, doc, name, var_docs, grouped_inh_vars) + + # Write a section for each inheritance pseudo-group (used if + # inheritance=='grouped') + if grouped_inh_vars: + for base in doc.mro(): + if base in grouped_inh_vars: + hdr = ('Inherited from %s' % + plaintext_to_latex('%s' % base.canonical_name)) + if self._crossref and base in self.class_set: + hdr += (' \\textit{(Section \\ref{%s})}' % + self.label(base)) + out(self._VAR_GROUP_HEADER % (hdr)) + out('\\cline{1-2}\n') + for var_doc in grouped_inh_vars[base]: + if isinstance(var_doc, PropertyDoc): + self.write_property_list_line(out, var_doc) + else: + self.write_var_list_line(out, var_doc) + + out('\\end{longtable}\n\n') + + def write_var_group(self, out, doc, name, var_docs, grouped_inh_vars): + # Split up the var_docs list, according to the way each var + # should be displayed: + # - listed_inh_vars -- for listed inherited variables. + # - grouped_inh_vars -- for grouped inherited variables. + # - normal_vars -- for all other variables. + listed_inh_vars = {} + normal_vars = [] + for var_doc in var_docs: + if var_doc.container != doc: + base = var_doc.container + if (base not in self.class_set or + self._inheritance == 'listed'): + listed_inh_vars.setdefault(base,[]).append(var_doc) + elif self._inheritance == 'grouped': + grouped_inh_vars.setdefault(base,[]).append(var_doc) else: - self.write_var_list_line(out, var_doc) - # [xx] deal with inherited methods better???? - #if (self._inheritance == 'listed' and - # isinstance(container, ClassDoc)): - # out(self._inheritance_list(group, container.uid())) + normal_vars.append(var_doc) + else: + normal_vars.append(var_doc) + + # Write a header for the group. + if name: + out(self._VAR_GROUP_HEADER % name) + out('\\cline{1-2}\n') + # Write an entry for each normal var: + for var_doc in normal_vars: + if isinstance(var_doc, PropertyDoc): + self.write_property_list_line(out, var_doc) + else: + self.write_var_list_line(out, var_doc) + # Write a subsection for inherited vars: + if listed_inh_vars: + self.write_var_inheritance_list(out, doc, listed_inh_vars) - out('\\end{longtable}\n\n') - + def write_var_inheritance_list(self, out, doc, listed_inh_vars): + for base in doc.mro(): + if base not in listed_inh_vars: continue + #if str(base.canonical_name) == 'object': continue + var_docs = listed_inh_vars[base] + if self._public_filter: + var_docs = [v for v in var_docs if v.is_public] + if var_docs: + hdr = ('Inherited from %s' % + plaintext_to_latex('%s' % base.canonical_name)) + if self._crossref and base in self.class_set: + hdr += (' \\textit{(Section \\ref{%s})}' % + self.label(base)) + out(self._VAR_GROUP_HEADER % hdr) + out('\\multicolumn{2}{|p{\\varwidth}|}{' + '\\raggedright %s}\\\\\n' % + ', '.join(['%s' % plaintext_to_latex(var_doc.name) + for var_doc in var_docs])) + out('\\cline{1-2}\n') + + def write_var_list_line(self, out, var_doc): out('\\raggedright ') out(plaintext_to_latex(var_doc.name, nbsp=True, breakany=True)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 15:17:45
|
Revision: 1619 http://epydoc.svn.sourceforge.net/epydoc/?rev=1619&view=rev Author: edloper Date: 2007-09-23 08:17:43 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Added FAQ: Why are some values listed in the details section, but not others? Modified Paths: -------------- trunk/epydoc/doc/faq.html Modified: trunk/epydoc/doc/faq.html =================================================================== --- trunk/epydoc/doc/faq.html 2007-09-23 15:07:34 UTC (rev 1618) +++ trunk/epydoc/doc/faq.html 2007-09-23 15:17:43 UTC (rev 1619) @@ -51,6 +51,8 @@ <li><a href="#redirect">Is there a way to link to the API documentation for objects using a simple URL based on the object's dotted name? </a></li> + <li><a href="#redundant-details">Why are some values listed in the details + section, but not others?</a></li> </ul></p> <p><b>Development of Epydoc</b> <ul class="nomargin"> @@ -368,6 +370,28 @@ classes, functions, varaibles, properties, etc. </p></dd> </dl> + <!-- QUESTION --><a name="redundant-details" /> + <dt><p><b>Q:</b> Why are some values listed in the details + section, but not others? + </p></dt> + + <dd><p>By default, epydoc will only list a value in the details + section if there's additional information beyond what's listed in + the summary section. For example, if you define a function but + don't give it a docstring, then all API information about that + function can be shown in the summary table, so no details entry will + be created for it. This helps keep the generated documentation + consise, and the information density high. However if you prefer, + the command-line option "<code>--redundant-details</code>" can be + used to tell epydoc to display all values in the details lists, even + if all info about them is already provided by the summary table. + The corresponding config file option is + <code>redundant-details</code>. <i>This option was added in svn + revision 1613, and is not yet available in the most recent + release.</i> + </p></dd> +</dl> + <!-- ==================== DEVELOPMENT ========================= --> <h2>Development of Epydoc</h2> <dl class="faq"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 15:07:38
|
Revision: 1618 http://epydoc.svn.sourceforge.net/epydoc/?rev=1618&view=rev Author: edloper Date: 2007-09-23 08:07:34 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Added --redundant-details option: "Include values in the details lists even if all info about them is already provided by the summary table." Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2007-09-23 14:33:08 UTC (rev 1617) +++ trunk/epydoc/src/epydoc/cli.py 2007-09-23 15:07:34 UTC (rev 1618) @@ -136,7 +136,8 @@ list_classes_separately=False, graph_font=None, graph_font_size=None, include_source_code=True, pstat_files=[], simple_term=False, fail_on=None, exclude=[], exclude_parse=[], exclude_introspect=[], - external_api=[],external_api_file=[],external_api_root=[]) + external_api=[],external_api_file=[],external_api_root=[], + redundant_details=False) def parse_arguments(): # Construct the option parser. @@ -285,6 +286,11 @@ action='store_true', dest='include_log', help=("Include a page with the process log (epydoc-log.html)")) + generation_group.add_option( + '--redundant-details', + action='store_true', dest='redundant_details', + help=("Include values in the details lists even if all info " + "about them is already provided by the summary table.")) output_group = OptionGroup(optparser, 'Output Options') optparser.add_option_group(output_group) @@ -547,6 +553,8 @@ options.include_source_code = _str_to_bool(val, optname) elif optname in ('include-log', 'include_log'): options.include_log = _str_to_bool(val, optname) + elif optname in ('redundant-details', 'redundant_details'): + options.redundant_details = _str_to_bool(val, optname) # Output options elif optname == 'name': Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 14:33:08 UTC (rev 1617) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 15:07:34 UTC (rev 1618) @@ -359,6 +359,10 @@ """Map the callgraph L{uid<DotGraph.uid>} to their HTML representation.""" + self._redundant_details = kwargs.get('redundant_details', False) + """If true, then include objects in the details list even if all + info about them is already provided by the summary table.""" + # For use with select_variables(): if self._show_private: self._public_filter = None @@ -2049,7 +2053,7 @@ else: tr_class = ' class="private"' # Decide an anchor or a link is to be generated. - link_name = var_doc.is_detailed() + link_name = self._redundant_details or var_doc.is_detailed() anchor = not link_name # Construct the HTML code for the type (cell 1) & description @@ -2131,16 +2135,20 @@ def write_details_list(self, out, heading, doc, value_type): # Get a list of the VarDocs we should describe. + if self._redundant_details: + detailed = None + else: + detailed = True if isinstance(doc, ClassDoc): var_docs = doc.select_variables(value_type=value_type, imported=False, inherited=False, public=self._public_filter, - detailed=True) + detailed=detailed) else: var_docs = doc.select_variables(value_type=value_type, imported=False, public=self._public_filter, - detailed=True) + detailed=detailed) if not var_docs: return # Write a header This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 14:33:10
|
Revision: 1617 http://epydoc.svn.sourceforge.net/epydoc/?rev=1617&view=rev Author: edloper Date: 2007-09-23 07:33:08 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Manually set the rst 'output_encoding' option to 'utf-8'. Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/restructuredtext.py Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-09-23 14:31:24 UTC (rev 1616) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-09-23 14:33:08 UTC (rev 1617) @@ -545,6 +545,7 @@ # Set the document's settings. if self.settings is None: settings = OptionParser([LaTeXWriter()]).get_default_values() + settings.output_encoding = 'utf-8' self.__class__.settings = settings document.settings = self.settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 14:31:26
|
Revision: 1616 http://epydoc.svn.sourceforge.net/epydoc/?rev=1616&view=rev Author: edloper Date: 2007-09-23 07:31:24 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - don't include the 'inputenc' package delclaration that is supplied by restructuredtext; it can conflict with our own. (utf8x vs utf8 -- how do these actually differ?) Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 14:08:40 UTC (rev 1615) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 14:31:24 UTC (rev 1616) @@ -279,7 +279,7 @@ out('\n') # Set the encoding. - out('\\usepackage[%s]{inputenc}' % self.get_latex_encoding()) + out('\\usepackage[%s]{inputenc}\n' % self.get_latex_encoding()) # If we're generating hyperrefs, add the appropriate packages. if self._hyperref: @@ -301,16 +301,17 @@ if 'restructuredtext' in epydoc.markup.MARKUP_LANGUAGES_USED: from epydoc.markup import restructuredtext rst_head = restructuredtext.latex_head_prefix() + rst_head = ''.join(rst_head).split('\n') for line in rst_head[1:]: m = re.match(r'\\usepackage(\[.*?\])?{(.*?)}', line) if m and m.group(2) in ( 'babel', 'hyperref', 'color', 'alltt', 'parskip', 'fancyhdr', 'boxedminipage', 'makeidx', 'multirow', 'longtable', 'tocbind', 'assymb', - 'fullpage'): + 'fullpage', 'inputenc'): pass else: - out(line) + out(line+'\n') #//////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 14:08:42
|
Revision: 1615 http://epydoc.svn.sourceforge.net/epydoc/?rev=1615&view=rev Author: edloper Date: 2007-09-23 07:08:40 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - If a param has a @type but no @param, then make sure it still gets listed in the function's details section. - Fixed sf bug 1720374 -- latex failed if type descr contained a newline, since \textit{...} is not allowed to include para breaks. (switched to use {\it ...} instead.) Also fixed some related bugs (e.g., by replacing \texttt{...} with {\tt ...}). Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 13:49:51 UTC (rev 1614) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 14:08:40 UTC (rev 1615) @@ -653,13 +653,20 @@ out(' '*6+'\\textbf{Parameters}\n') out(' '*6+'\\begin{quote}\n') out(' \\begin{Ventry}{%s}\n\n' % (longest*'x')) - # Params that have @type but not @param info: - unseen_types = set(func_doc.arg_types) - # List everything that has a @param: - for (arg_names, arg_descr) in func_doc.arg_descrs: + # Add params that have @type but not @param info: + arg_descrs = list(func_doc.arg_descrs) + args = set() + for arg_names, arg_descr in arg_descrs: + args.update(arg_names) + for arg in var_doc.value.arg_types: + if arg not in args: + arg_descrs.append( ([arg],None) ) + # Display params + for (arg_names, arg_descr) in arg_descrs: arg_name = plaintext_to_latex(', '.join(arg_names)) out('%s\\item[%s]\n\n' % (' '*10, arg_name)) - out(self.docstring_to_latex(arg_descr, 10)) + if arg_descr: + out(self.docstring_to_latex(arg_descr, 10)) for arg_name in arg_names: arg_typ = func_doc.arg_types.get(arg_name) if arg_typ is not None: @@ -668,7 +675,7 @@ else: lhs = 'type of %s' % arg_name rhs = self.docstring_to_latex(arg_typ).strip() - out('%s\\textit{(%s=%s)}\n\n' % (' '*12, lhs, rhs)) + out('%s{\\it (%s=%s)}\n\n' % (' '*12, lhs, rhs)) out(' \\end{Ventry}\n\n') out(' '*6+'\\end{quote}\n\n') out(' \\vspace{1ex}\n\n') @@ -682,7 +689,7 @@ if rdescr not in (None, UNKNOWN): out(self.docstring_to_latex(rdescr, 6)) if rtype not in (None, UNKNOWN): - out(' '*6+'\\textit{(type=%s)}\n\n' % + out(' '*6+'{\\it (type=%s)}\n\n' % self.docstring_to_latex(rtype, 6).strip()) elif rtype not in (None, UNKNOWN): out(self.docstring_to_latex(rtype, 6)) @@ -745,7 +752,7 @@ def func_arg(self, name, default): s = '\\textit{%s}' % plaintext_to_latex(self._arg_name(name)) if default is not None: - s += '=\\texttt{%s}' % default.summary_pyval_repr().to_latex(None) + s += '={\\tt %s}' % default.summary_pyval_repr().to_latex(None) return s def _arg_name(self, arg): @@ -829,7 +836,7 @@ var_doc.value.summary_pyval_repr().to_latex(None)) if has_type: ptype = self.docstring_to_latex(var_doc.type_descr, 12).strip() - out('%s\\textit{(type=%s)}' % (' '*12, ptype)) + out('%s{\\it (type=%s)}' % (' '*12, ptype)) out('&\\\\\n') out('\\cline{1-2}\n') @@ -847,7 +854,7 @@ if has_type: out('\n\n') if has_type: ptype = self.docstring_to_latex(prop_doc.type_descr, 12).strip() - out('%s\\textit{(type=%s)}' % (' '*12, ptype)) + out('%s{\\it (type=%s)}' % (' '*12, ptype)) # [xx] List the fget/fset/fdel functions? out('&\\\\\n') out('\\cline{1-2}\n') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 13:49:52
|
Revision: 1614 http://epydoc.svn.sourceforge.net/epydoc/?rev=1614&view=rev Author: edloper Date: 2007-09-23 06:49:51 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - If a param has a @type but no @param, then make sure it still gets listed in the ufnction's details section. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html.py Modified: trunk/epydoc/src/epydoc/docwriter/html.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 05:59:41 UTC (rev 1613) +++ trunk/epydoc/src/epydoc/docwriter/html.py 2007-09-23 13:49:51 UTC (rev 1614) @@ -2162,13 +2162,21 @@ rtype = self.return_type(var_doc, indent=10) rdescr = self.return_descr(var_doc, indent=10) arg_descrs = [] - # [xx] if we have a @type but no @param, this won't list it! - # [xx] put them in the right order?? + args = set() + # Find the description for each arg. (Leave them in the + # same order that they're listed in the docstring.) for (arg_names, arg_descr) in var_doc.value.arg_descrs: + args.update(arg_names) lhs = ', '.join([self.arg_name_to_html(var_doc.value, n) for n in arg_names]) rhs = self.docstring_to_html(arg_descr, var_doc.value, 10) arg_descrs.append( (lhs, rhs) ) + # Check for arguments for which we have @type but not @param; + # and add them to the arg_descrs list. + for arg in var_doc.value.arg_types: + if arg not in args: + argname = self.arg_name_to_html(var_doc.value, arg) + arg_descrs.append( (argname,'') ) self.write_function_details_entry(out, var_doc, descr, var_doc.value.callgraph_uid, @@ -2203,7 +2211,10 @@ lhs = m.group() + lhs rhs = rhs[m.end():] - return '<li>%s - %s</li>' % (lhs, rhs) + if rhs: + return '<li>%s - %s</li>' % (lhs, rhs) + else: + return '<li>%s</li>' % (lhs,) def property_accessor_to_html(self, val_doc, context=None): if val_doc not in (None, UNKNOWN): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ed...@us...> - 2007-09-23 05:59:57
|
Revision: 1613 http://epydoc.svn.sourceforge.net/epydoc/?rev=1613&view=rev Author: edloper Date: 2007-09-22 22:59:41 -0700 (Sat, 22 Sep 2007) Log Message: ----------- parse return type from signature using the current markup language Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 05:58:51 UTC (rev 1612) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 05:59:41 UTC (rev 1613) @@ -192,15 +192,19 @@ # Remove leading indentation from the docstring. api_doc.docstring = unindent_docstring(api_doc.docstring) + # Decide which docformat is used by this module. + docformat = get_docformat(api_doc, docindex) + + # A list of markup errors from parsing. + parse_errors = [] + # Extract a signature from the docstring, if it has one. This # overrides any signature we got via introspection/parsing. if isinstance(api_doc, RoutineDoc): - parse_function_signature(api_doc) + parse_function_signature(api_doc, None, docformat, parse_errors) # Parse the docstring. Any errors encountered are stored as # `ParseError` objects in the errors list. - docformat = get_docformat(api_doc, docindex) - parse_errors = [] parsed_docstring = markup.parse(api_doc.docstring, docformat, parse_errors) @@ -222,7 +226,8 @@ init_api_doc = initvar.value parse_docstring(init_api_doc, docindex) - parse_function_signature(init_api_doc, api_doc) + parse_function_signature(init_api_doc, api_doc, + docformat, parse_errors) init_fields = split_init_fields(fields, field_warnings) # Process fields @@ -981,7 +986,7 @@ """A regular expression that is used to extract signatures from docstrings.""" -def parse_function_signature(func_doc, doc_source=None): +def parse_function_signature(func_doc, doc_source, docformat, parse_errors): """ Construct the signature for a builtin function or method from its docstring. If the docstring uses the standard convention @@ -1061,7 +1066,8 @@ # Extract the return type/value from the signature if rtype: - func_doc.return_type = markup.parse(rtype, 'plaintext') + func_doc.return_type = markup.parse(rtype, docformat, parse_errors, + inline=True) # Add the self parameter, if it was specified. if selfparam: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |