aboutsummaryrefslogtreecommitdiff
path: root/scripts/utils.py
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-05-16 14:32:32 +0200
committerKarel Kočí <cynerd@email.cz>2015-05-16 14:32:32 +0200
commit599690760476bf7c9c2be226c40cc70c813aa60d (patch)
tree2c7582e38c83ba00444813e2f9f84adcd30212b3 /scripts/utils.py
parentf189512d1a531578a87a0743d8bc6422613a1e99 (diff)
downloadlinux-conf-perf-599690760476bf7c9c2be226c40cc70c813aa60d.tar.gz
linux-conf-perf-599690760476bf7c9c2be226c40cc70c813aa60d.tar.bz2
linux-conf-perf-599690760476bf7c9c2be226c40cc70c813aa60d.zip
Implement evaluate
Diffstat (limited to 'scripts/utils.py')
-rw-r--r--scripts/utils.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/utils.py b/scripts/utils.py
index 74cc80c..9c83065 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -103,12 +103,24 @@ def hash_config(cf):
hsh = hashlib.md5(bytes(str, sys.getdefaultencoding()))
return hsh.hexdigest()
-def config_strtoint(str):
+def config_strtoint(str, full):
"""Reads list of configured symbols from string
"""
rtn = []
- for s in str.rstrip().split(sep=' '):
- rtn.append(int(s))
+ if full:
+ for s in str.rstrip().split(sep=' '):
+ rtn.append(int(s))
+ else:
+ count = 0
+ with open(sf(conf.variable_count_file)) as f:
+ f.readline()
+ count = int(f.readline())
+ for s in str.rstrip().split(sep=' '):
+ val = int(s)
+ if abs(val) <= count:
+ rtn.append(val)
+ else:
+ break;
try:
rtn.remove(0)
except ValueError:
@@ -120,7 +132,7 @@ def get_config_from_hash(hash):
for line in f:
w = line.rstrip().split(sep=':')
if w[0] == hash:
- return config_strtoint(w[1])
+ return config_strtoint(w[1], True)
return None
def get_last_configuration():