Skip to content

Commit

Permalink
WV: paired votes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejs committed Jun 21, 2011
1 parent 909e90e commit b6d4e26
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions openstates/wv/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,35 @@ def scrape_vote(self, bill, url):
motion = lines[idx - 2].strip()
yes_count, no_count, other_count = [
int(g) for g in match.groups()]
passed = yes_count > (no_count + other_count)
continue

match = re.match(r'(YEAS|NAYS|NOT VOTING):\s+(\d+)\s*$',
match = re.match(r'(YEAS|NAYS|NOT VOTING|PAIRED):\s+(\d+)\s*$',
line)
if match:
vote_type = {'YEAS': 'yes',
'NAYS': 'no',
'NOT VOTING': 'other'}[match.group(1)]
'NOT VOTING': 'other',
'PAIRED': 'paired'}[match.group(1)]
continue

if vote_type:
if vote_type == 'paired':
if not line.strip():
continue
name, pair_type = re.match(
r'([^\(]+)\((YEA|NAY)\)', line).groups()
name = name.strip()
if pair_type == 'YEA':
votes['yes'].append(name)
elif pair_type == 'NAY':
votes['no'].append(name)
elif vote_type:
for name in line.split(' '):
name = name.strip()
if not name:
continue
votes[vote_type].append(name)

passed = yes_count > (no_count + other_count)
vote = Vote('lower', date, motion, passed,
yes_count, no_count, other_count)
vote.add_source(url)
Expand Down

0 comments on commit b6d4e26

Please sign in to comment.