[Epydoc-commits] SF.net SVN: epydoc: [1392] branches/exp-args_in_class/epydoc/src/epydoc/ docstring
Brought to you by:
edloper
From: <dva...@us...> - 2006-09-15 23:36:31
|
Revision: 1392 http://svn.sourceforge.net/epydoc/?rev=1392&view=rev Author: dvarrazzo Date: 2006-09-15 16:36:23 -0700 (Fri, 15 Sep 2006) Log Message: ----------- - Be more lenient about types specified before matching objects. Modified Paths: -------------- branches/exp-args_in_class/epydoc/src/epydoc/docstringparser.py Modified: branches/exp-args_in_class/epydoc/src/epydoc/docstringparser.py =================================================================== --- branches/exp-args_in_class/epydoc/src/epydoc/docstringparser.py 2006-09-15 02:24:11 UTC (rev 1391) +++ branches/exp-args_in_class/epydoc/src/epydoc/docstringparser.py 2006-09-15 23:36:23 UTC (rev 1392) @@ -313,33 +313,44 @@ var = field fields.append(field) else: - warnings.append("there are more variables " - "named '%s'" % arg) + warnings.append( + "There is more than one variable named '%s'" + % arg) elif field.tag() in PARAM_TAGS: if par is None: par = field init_fields.append(field) else: - warnings.append("there are more parameters " - "named '%s'" % arg) + warnings.append( + "There is more than one parameter named '%s'" + % arg) elif field.tag() == 'type': - gone = False - if var is not None and tvar is None: - tvar = field - fields.append(field) - gone = True - if par is not None and tpar is None: - tpar = field - init_fields.append(field) - gone = True - if not gone: - warnings.append("type for '%s' doesn't apply " - "to any variable or argument" % arg) + if var is None and par is None: + # type before obj + tvar = tpar = field + else: + if var is not None and tvar is None: + tvar = field + if par is not None and tpar is None: + tpar = field else: # Unespected field fields.append(field) + # Put selected types into the proper output lists + if tvar is not None: + if var is not None: + fields.append(tvar) + else: + pass # [xx] warn about type w/o object? + + if tpar is not None: + if par is not None: + init_fields.append(tpar) + else: + pass # [xx] warn about type w/o object? + def report_errors(api_doc, docindex, parse_errors, field_warnings): """A helper function for L{parse_docstring()} that reports any markup warnings and field warnings that we encountered while @@ -754,15 +765,9 @@ def set_var_type(api_doc, ident, descr): if ident not in api_doc.variables: - # [xx] If there is a type w/o matching var, this would create - # a new var. The behavior is to be decied consistently also in other - # places in this sources (grep for [xx]). - # Currently disable the creation or else each "type" used in the - # class docstring to describe an __init__ parameter also generates - # an extra class variable. - #api_doc.variables[ident] = VariableDoc( - #container=api_doc, name=ident, - #canonical_name=api_doc.canonical_name+ident) + api_doc.variables[ident] = VariableDoc( + container=api_doc, name=ident, + canonical_name=api_doc.canonical_name+ident) return var_doc = api_doc.variables[ident] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |