some internal renaming to make more sense of the sorting algo,

no semantical changes.
This commit is contained in:
holger krekel 2013-06-28 12:54:10 +02:00
parent f9720a38fe
commit 469830fffa
1 changed files with 15 additions and 13 deletions

View File

@ -1747,29 +1747,31 @@ def getfuncargnames(function, startindex=None):
def parametrize_sorted(items, ignore, cache, scopenum): def parametrize_sorted(items, ignore, cache, scopenum):
if scopenum >= 3: if scopenum >= 3:
return items return items
newitems = [] similar_items = []
olditems = [] other_items = []
slicing_argparam = None slicing_argparam = None
for item in items: for item in items:
argparamlist = getfuncargparams(item, ignore, scopenum, cache) argparamlist = getfuncargparams(item, ignore, scopenum, cache)
if slicing_argparam is None and argparamlist: if slicing_argparam is None and argparamlist:
slicing_argparam = argparamlist[0] slicing_argparam = argparamlist[0]
slicing_index = len(olditems) slicing_index = len(other_items)
if slicing_argparam in argparamlist: if slicing_argparam in argparamlist:
newitems.append(item) similar_items.append(item)
else: else:
olditems.append(item) other_items.append(item)
if newitems: if similar_items:
newignore = ignore.copy() newignore = ignore.copy()
newignore.add(slicing_argparam) newignore.add(slicing_argparam)
newitems = parametrize_sorted(newitems + olditems[slicing_index:], part2 = parametrize_sorted(
similar_items + other_items[slicing_index:],
newignore, cache, scopenum) newignore, cache, scopenum)
old1 = parametrize_sorted(olditems[:slicing_index], newignore, part1 = parametrize_sorted(
other_items[:slicing_index], newignore,
cache, scopenum+1) cache, scopenum+1)
return old1 + newitems return part1 + part2
else: else:
olditems = parametrize_sorted(olditems, ignore, cache, scopenum+1) other_items = parametrize_sorted(other_items, ignore, cache, scopenum+1)
return olditems + newitems return other_items + similar_items
def getfuncargparams(item, ignore, scopenum, cache): def getfuncargparams(item, ignore, scopenum, cache):
""" return list of (arg,param) tuple, sorted by broader scope first. """ """ return list of (arg,param) tuple, sorted by broader scope first. """