summaryrefslogtreecommitdiffstats
path: root/module/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/utils.py')
-rw-r--r--module/utils.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/module/utils.py b/module/utils.py
index 424aeaf37..fa6b84095 100644
--- a/module/utils.py
+++ b/module/utils.py
@@ -136,21 +136,11 @@ def fs_bsize(path):
return os.statvfs(path).f_bsize
-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): #: Originally by Dave Kirby
+ """ removes duplicates from list, preserve order """
+ seen = set()
+ seen_add = seen.add
+ return [x for x in seq if x not in seen and not seen_add(x)]
def parseFileSize(string, unit=None): #returns bytes