diff options
author | mkaay <mkaay@mkaay.de> | 2011-01-31 15:39:03 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-01-31 15:39:03 +0100 |
commit | ffb4c1124d52e19128881c6d78a3009b191c8bbe (patch) | |
tree | 6dae99495d1a96c56f33caaf622c09dd0639db98 /module/Utils.py | |
parent | closed #223 (diff) | |
download | pyload-ffb4c1124d52e19128881c6d78a3009b191c8bbe.tar.xz |
fixed gui notification
Diffstat (limited to 'module/Utils.py')
-rw-r--r-- | module/Utils.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/module/Utils.py b/module/Utils.py index b85f48210..de07a9450 100644 --- a/module/Utils.py +++ b/module/Utils.py @@ -42,5 +42,21 @@ def freeSpace(folder): s = statvfs(folder) return s.f_bsize * s.f_bavail / 1024 / 1024 #megabyte +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 + if __name__ == "__main__": - print freeSpace(".")
\ No newline at end of file + print freeSpace(".") |