[Epydoc-commits] SF.net SVN: epydoc: [1298] trunk/epydoc/src/epydoc/docbuilder.py
Brought to you by:
edloper
From: <ed...@us...> - 2006-08-23 00:21:45
|
Revision: 1298 Author: edloper Date: 2006-08-22 17:21:43 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1298&view=rev Log Message: ----------- - Changed _unreachable_names to be a dictionary from name to integer id, which serves a minor optimization if a large number of unreachable names are used. Based on a patch provided by Daniel von Dincklage. Modified Paths: -------------- trunk/epydoc/src/epydoc/docbuilder.py Modified: trunk/epydoc/src/epydoc/docbuilder.py =================================================================== --- trunk/epydoc/src/epydoc/docbuilder.py 2006-08-22 21:46:27 UTC (rev 1297) +++ trunk/epydoc/src/epydoc/docbuilder.py 2006-08-23 00:21:43 UTC (rev 1298) @@ -952,9 +952,13 @@ L{assign_canonical_names()} finds a canonical name with a better score, then it will replace the old name.""" -_unreachable_names = set(DottedName(DottedName.UNREACHABLE)) +_unreachable_names = {DottedName(DottedName.UNREACHABLE):2} """The set of names that have been used for unreachable objects. This -is used to ensure there are no duplicate cannonical names assigned.""" +is used to ensure there are no duplicate cannonical names assigned. +C{_unreachable_names} is a dictionary mapping from dotted names to +integer ids, where the next unused unreachable name derived from +dotted name C{n} is +C{DottedName('%s-%s' % (n, str(_unreachable_names[n]))}""" def assign_canonical_names(val_doc, name, docindex, score=0): """ @@ -1070,11 +1074,10 @@ # Uniquify the name. if name in _unreachable_names: - n = 2 - while DottedName('%s-%s' % (name,n)) in _unreachable_names: - n += 1 - name = DottedName('%s-%s' % (name,n)) - _unreachable_names.add(name) + name = DottedName('%s-%s' % (name, _unreachable_names[name])) + _unreachable_names[name] += 1 + else: + _unreachable_names[name] = 2 return name, -10000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |