diff options
author | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-10 09:39:46 +0000 |
---|---|---|
committer | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-10 09:39:46 +0000 |
commit | 09d32a855b52efcef55e33bf11a87e7ddfdb84c9 (patch) | |
tree | 4219a83444739fefc078667e4368f68e965da878 /src/extras/sos-html-logs/lib/helpers.py | |
parent | 453bcc1ec4ec8afc9c46eb32605b2fd8316cc4c5 (diff) | |
download | sos-09d32a855b52efcef55e33bf11a87e7ddfdb84c9.tar.gz |
developement moved to http://code.google.com/p/logpox
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@465 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/extras/sos-html-logs/lib/helpers.py')
-rw-r--r-- | src/extras/sos-html-logs/lib/helpers.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/extras/sos-html-logs/lib/helpers.py b/src/extras/sos-html-logs/lib/helpers.py deleted file mode 100644 index 995cf16b..00000000 --- a/src/extras/sos-html-logs/lib/helpers.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -def ksort(d, func = None): - keys = d.keys() - keys.sort(func) - return keys - -class Memoize: - """Memoize(fn) - an instance which acts like fn but memoizes its arguments - Will only work on functions with non-mutable arguments - """ - def __init__(self, fn): - self.fn = fn - self.memo = {} - def __call__(self, *args): - if not self.memo.has_key(args): - self.memo[args] = self.fn(*args) - return self.memo[args] - -class SQL: - def __init__(self): - self.dbcon = sqlite.connect(":memory:", check_same_thread=False) - self.dbcur = self.dbcon.cursor() - - self.dbcon.execute("create table events(date, host, position, message, css_style)") - - def execute(self, query): - return self.dbcon.execute(query) - -def color_gradient(src, dst, percent): - csrc = [ col for col in src ] - cdst = [ col for col in dst ] - toret = [] - - for inc in range(0,3): - toret.append(csrc[inc] + ((cdst[inc] - csrc[inc]) * percent / 100)) - - return toret - -def rgb_to_hex(rgb): - return "%X%X%X" % (rgb[0], rgb[1], rgb[2]) |