summaryrefslogtreecommitdiffstats
path: root/module/utils/__init__.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-06 17:54:53 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-06 17:54:53 +0100
commitb877847094b0ba03a098dff0fd769eb456b48dd1 (patch)
tree2d4a4e6b5c4dcba8eec952724a0dd065ef781ced /module/utils/__init__.py
parentxmpp: disconnect on unload / deactivate (diff)
downloadpyload-b877847094b0ba03a098dff0fd769eb456b48dd1.tar.xz
several improvements, also closes #486, #487
Diffstat (limited to 'module/utils/__init__.py')
-rw-r--r--module/utils/__init__.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py
index a237fde9b..46621c685 100644
--- a/module/utils/__init__.py
+++ b/module/utils/__init__.py
@@ -72,21 +72,10 @@ def freeSpace(folder):
return free_space(folder)
-def uniqify(seq, idfun=None):
-# order preserving
- if idfun is None:
- def idfun(x): return x
- seen = {}
- result = []
- for item in seq:
- marker = idfun(item)
- # in old Python versions:
- # if seen.has_key(marker)
- # but in new ones:
- if marker in seen: continue
- seen[marker] = 1
- result.append(item)
- return result
+def uniqify(seq): #by Dave Kirby
+ """ removes duplicates from list, preserve order """
+ seen = set()
+ return [x for x in seq if x not in seen and not seen.add(x)]
def parseFileSize(string, unit=None): #returns bytes