Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CO: More vote updates.

  • Loading branch information...
commit 1e097064d1fe65c13e3b0694d64cff30ecfc848c 1 parent 7a9bbb3
@paultag paultag authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 openstates/co/votes.py
View
25 openstates/co/votes.py
@@ -43,16 +43,36 @@ def scrape_senate(self, session):
cur_bill_id = None
cur_vote_count = None
in_vote = False
+ cur_question = None
+ in_question = False
cur_vote = {}
for line in open(txt).readlines():
+ if in_question:
+ line = line.strip()
+ if re.match("\d+", line):
+ in_question = False
+ continue
+ try:
+ line, _ = line.rsplit(" ", 1)
+ line += cur_question
+ except ValueError:
+ in_question = False
+ continue
+
+ cur_question += line
if not in_vote:
summ = re.findall(vote_re, line)
if summ != []:
+ cur_vote = {}
cur_vote_count = summ[0]
in_vote = True
continue
+ if "The question being " in line:
+ cur_question, _ = line.strip().rsplit(" ", 1)
+ in_question = True
+
if line.strip() == "":
continue
first = line[0]
@@ -86,9 +106,14 @@ def scrape_senate(self, session):
# other)
print cur_vote
+ print cur_question
print cur_bill_id
print cur_vote_count
+
+ cur_vote, cur_question, cur_vote_count = (
+ None, None, None)
continue
+
vals = line.split()
vals = dict(zip(vals[0::2], vals[1::2]))
cur_vote.update(vals)
Please sign in to comment.
Something went wrong with that request. Please try again.