]> git.donarmstrong.com Git - neurodebian.git/blobdiff - survey/makestats
NF: parsing out those ratings questions
[neurodebian.git] / survey / makestats
index 69e689cad14822883dbbae26e14283ef2d6eb5ed..7f500d692773156983d7f8fa83fa640a30a59f7f 100755 (executable)
@@ -91,7 +91,13 @@ def load_list2dict(name):
     d = {}
     lfile = open(name)
     for line in lfile:
+        if line.strip() == "":
+            continue
         kv = line.split(':')
+        if kv[0] in d:
+            raise RuntimeError(
+                "Got a line %s with a duplicate key %s whenever value for it "
+                "is known already to be %r" % (line, kv[0], d[kv[0]]))
         d[kv[0]] = kv[1].strip().strip('"')
     return d
 
@@ -103,6 +109,7 @@ class DB(dict):
     sw_dict = load_list2dict('swlist.txt')
     position_dict = load_list2dict('position-dd-list.txt')
     employer_dict = load_list2dict('employer-dd-list.txt')
+    ratings_dict = load_list2dict('ratingslist.txt')
 
     def __init__(self, srcdir):
         # eats the whole directory