From ffb4c1124d52e19128881c6d78a3009b191c8bbe Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 31 Jan 2011 15:39:03 +0100 Subject: fixed gui notification --- module/Utils.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'module/Utils.py') 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(".") -- cgit v1.2.3