in monitoring/nstv-rank.py [0:0]
def print_tally(args, output, blt):
votes = read_votes(args)
nominees = read_nominees(args[0])
nomkeys = sorted(nominees)
numseats = 9
if output:
try:
sys.stdout = open(a, 'w')
except:
print >> sys.stderr, "Cannot open output file: " + a
print >> sys.stderr, " Goodbye!"
sys.exit(2)
if blt:
numcands = len(nomkeys)
print "%d %d" % (numcands, numseats)
for id in votes.keys():
line = [ ]
for vote in votes[id]:
value = ord(vote) - ord('a') + 1
line.append(str(value))
line = "1 "+ " ".join(line) + " 0"
print line
print "0"
for id in nomkeys:
print '"%s"' % nominees[id]
print '"ASF STV Board Election"'
else:
print "rank order"
line = [ ]
for id in nomkeys:
line.append("%20.20s" % nominees[id])
line = "NAME, " + ", ".join(line)
print line
line = [ ]
for id in nomkeys:
line.append("%20.20s" % id)
line = "LABEL," + ", ".join(line)
print line
for id in votes.keys():
line = id + "," + ",".join(votes[id])
print line