diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-06 17:54:53 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-06 17:54:53 +0100 |
commit | b877847094b0ba03a098dff0fd769eb456b48dd1 (patch) | |
tree | 2d4a4e6b5c4dcba8eec952724a0dd065ef781ced /module/utils/__init__.py | |
parent | xmpp: disconnect on unload / deactivate (diff) | |
download | pyload-b877847094b0ba03a098dff0fd769eb456b48dd1.tar.xz |
Diffstat (limited to 'module/utils/__init__.py')
-rw-r--r-- | module/utils/__init__.py | 19 |
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 |