faster list reordering function
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@419 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
+4
-4
@@ -31,7 +31,7 @@ from entropyConstants import *
|
||||
from clientConstants import *
|
||||
from outputTools import *
|
||||
from remoteTools import downloadData, getOnlineContent
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, dep_getcpv, isjustname, dep_getkey, compareVersions as entropyCompareVersions, catpkgsplit, filterDuplicatedEntries, extactDuplicatedEntries, isspecific, uncompressTarBz2, extractXpak
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, dep_getcpv, isjustname, dep_getkey, compareVersions as entropyCompareVersions, catpkgsplit, filterDuplicatedEntries, extactDuplicatedEntries, isspecific, uncompressTarBz2, extractXpak, filterDuplicatedEntries
|
||||
from databaseTools import etpDatabase
|
||||
import xpak
|
||||
import time
|
||||
@@ -1020,7 +1020,7 @@ def generateDependencyTree(atomInfo, emptydeps = False):
|
||||
except:
|
||||
pass
|
||||
# merge back remainingDeps into unsatisfiedDeps
|
||||
remainingDeps = list(set(remainingDeps))
|
||||
remainingDeps = filterDuplicatedEntries(remainingDeps)
|
||||
#cnt = 0
|
||||
#for x in tree:
|
||||
# cnt += len(tree[x])
|
||||
@@ -1049,7 +1049,7 @@ def generateDependencyTree(atomInfo, emptydeps = False):
|
||||
for y in tree[x]:
|
||||
newtree[x].append(atomMatch(y))
|
||||
if (newtree[x]):
|
||||
newtree[x] = list(set(newtree[x]))
|
||||
newtree[x] = filterDuplicatedEntries(newtree[x])
|
||||
# now filter newtree
|
||||
treelength = len(newtree)
|
||||
for count in range(treelength)[::-1]:
|
||||
@@ -1189,7 +1189,7 @@ def generateRemovalTree(atoms):
|
||||
|
||||
|
||||
print len(treeview)
|
||||
treeview = list(set(treeview))
|
||||
treeview = filterDuplicatedEntries(treeview)
|
||||
print len(treeview)
|
||||
print treeview
|
||||
for x in treeview:
|
||||
|
||||
@@ -461,23 +461,9 @@ def isnumber(x):
|
||||
# this functions removes duplicates without breaking the list order
|
||||
# nameslist: a list that contains duplicated names
|
||||
# @returns filtered list
|
||||
def filterDuplicatedEntries(nameslist):
|
||||
if nameslist == []:
|
||||
return nameslist
|
||||
_nameslist = nameslist[:]
|
||||
for name in _nameslist:
|
||||
try:
|
||||
first = _nameslist.index(name)
|
||||
_nameslist[first] = "x"+_nameslist[first]
|
||||
try:
|
||||
while 1:
|
||||
_nameslist.remove(name)
|
||||
except:
|
||||
pass
|
||||
_nameslist[first] = _nameslist[first][1:]
|
||||
except:
|
||||
pass
|
||||
return _nameslist
|
||||
def filterDuplicatedEntries(alist):
|
||||
set = {}
|
||||
return [set.setdefault(e,e) for e in alist if e not in set]
|
||||
|
||||
# this function returns a list of duplicated entries found in the input list
|
||||
def extactDuplicatedEntries(inputlist):
|
||||
|
||||
Reference in New Issue
Block a user