Beispiel #1
0
 def __init__(self,d):
     self.timestamp = getType(d,'timestamp',str)
     parts = self.timestamp.split(' ')
     self.date = "%s %s, %s" % (parts[1],parts[2],parts[5])
     self.session = getType(d,'session',str)
     if self.session:
         parts = self.session.split(' - ')
         self.type = parts[-1].split(' ')[0]
         if len(parts) == 3:
             self.session = '%s - %s' % (parts[2],parts[1])
     else:
         self.type = None
     self.text = getType(d,'text',str)
Beispiel #2
0
    def __init__(self,d):

        self.year = getType(d,'year',int)

        #More complications due to different names in different places
        self.id = getType(d, 'senateId', str) if 'senateId' in d else getType(d, 'id', str)

        self.title = getType(d, 'title', str)
        self.summary = getType(d, 'summary', str)
        self.sponsor = getType(d, 'sponsor', str)
        self.votes = [Vote(vote, billno=self.senateId) for vote in d.get('votes', [])]
        self.actions = sorted([Action(action) for action in d.get('actions',[])], cmp=lambda x, y:x.timestamp-y.timestamp)

        #Some complications because cosponsors is not a list if there is only one
        cosponsors = d.get('cosponsors', [])
        if isinstance(cosponsors, str) or isinstance(cosponsors, unicode):
            self.cosponsors = [senators[str(cosponsors).lower()]]
        else:
            self.cosponsors = [senators[co.get('cosponsor').lower()] for co in cosponsors]
Beispiel #3
0
 def __init__(self,d, billno=None):
     self.bill = billno if billno else getType(d, 'billno', str)
     self.votedata = dict([senator[voter.get('name')],voter.get('vote')] for voter in d.get('voters',[]))
     #Currently no indication of vote type, this is a hack, I think its accurate
     self.type = "floor" if len(self.votedata.keys()) > 40 else "committee"
     self.timestamp =  getType(d,'timestamp',int)/1000 if 'timestamp' in d else None
Beispiel #4
0
 def __init__(self,d):
     #The last section of an action is the date, split that off from the right
     self.action = str(d['action']).rsplit(' - ', 1)[0]
     self.timestamp = int(getType(d,'timestamp',int)/1000) if 'timestamp' in d else None