@@ -67,12 +67,12 @@ def import_people_membership(self, mship, posts, orgs):
6767 return
6868
6969 if mship ["id" ] in self .membertopersonmap :
70- raise Exception , "Same member id %s appeared twice" % mship ["id" ]
70+ raise Exception ( "Same member id %s appeared twice" % mship ["id" ])
7171 self .membertopersonmap [mship ["id" ]] = mship ['person_id' ]
7272 self .persontomembermap .setdefault (mship ['person_id' ], []).append (mship ["id" ])
7373
7474 if self .members .get (mship ["id" ]):
75- raise Exception , "Repeated identifier %s in members JSON file" % mship ["id" ]
75+ raise Exception ( "Repeated identifier %s in members JSON file" % mship ["id" ])
7676 self .members [mship ["id" ]] = mship
7777
7878 if 'end_date' not in mship :
@@ -90,14 +90,14 @@ def import_people_membership(self, mship, posts, orgs):
9090 mship_start_date <= mship_end_date and
9191 mship_end_date <= cons ['end_date' ]):
9292 if consid and consid != cons ['id' ]:
93- raise Exception , "Two constituency ids %s %s overlap with MP %s" % (consid , cons ['id' ], mship ['id' ])
93+ raise Exception ( "Two constituency ids %s %s overlap with MP %s" % (consid , cons ['id' ], mship ['id' ]) )
9494 consid = cons ['id' ]
9595 if not consid :
96- raise Exception , "Constituency '%s' not found" % mship ["constituency" ]
96+ raise Exception ( "Constituency '%s' not found" % mship ["constituency" ])
9797 # check name in members file is same as default in cons file
9898 backformed_cons = self .considtonamemap [consid ]
9999 if backformed_cons != mship ["constituency" ]:
100- raise Exception , "Constituency '%s' in members file differs from first constituency '%s' listed in cons file" % (mship ["constituency" ], backformed_cons )
100+ raise Exception ( "Constituency '%s' in members file differs from first constituency '%s' listed in cons file" % (mship ["constituency" ], backformed_cons ) )
101101
102102 # check first date ranges don't overlap, MPs only
103103 # Only check modern MPs as we might have overlapping data previously
@@ -108,7 +108,7 @@ def import_people_membership(self, mship, posts, orgs):
108108 or cons ['start_date' ] <= mship ['end_date' ] <= cons ['end_date' ] \
109109 or mship ['start_date' ] <= cons ['start_date' ] <= mship ['end_date' ] \
110110 or mship ['start_date' ] <= cons ['end_date' ] <= mship ['end_date' ]:
111- raise Exception , "%s %s Two MP entries for constituency %s with overlapping dates" % (mship , cons , consid )
111+ raise Exception ( "%s %s Two MP entries for constituency %s with overlapping dates" % (mship , cons , consid ) )
112112 # then add in
113113 self .considtomembermap .setdefault (consid , []).append (mship )
114114
@@ -124,7 +124,7 @@ def import_people_names(self, person):
124124 if person ['id' ] not in self .persontomembermap :
125125 return
126126 self .persons [person ['id' ]] = person
127- memberships = map ( lambda x : self .members [x ], self .persontomembermap [person ['id' ]])
127+ memberships = [ self .members [x ] for x in self .persontomembermap [person ['id' ]]]
128128 for other_name in person .get ('other_names' , []):
129129 if other_name .get ('note' ) == 'Main' :
130130 self .import_people_main_name (other_name , memberships )
@@ -213,7 +213,7 @@ def name_on_date(self, person_id, date):
213213 if nm ['lordofname' ]:
214214 name += ' of %s' % nm ['lordofname' ]
215215 return name
216- raise Exception , 'No found for %s on %s' % (person ['id' ], date )
216+ raise Exception ( 'No found for %s on %s' % (person ['id' ], date ) )
217217
218218 def membertoperson (self , memberid ):
219219 return self .membertopersonmap [memberid ]
0 commit comments