def _make_attraction(self, ride, meta): attraction = Ride() attraction.setName(meta['name']) attraction.setStatus(meta['status']) #Check if Park is Open if not self.is_Open: attraction.setTime(0) attraction.setClosed() attraction.set_skip_line(meta['isFlashPassEligible']) self.addRide(attraction) return if meta['status'] == 'AttractionStatusOpen': attraction.setOpen() else: attraction.setClosed() try: int(ride['waitTime']) except ValueError: ride['waitTime'] = ''.join(c for c in ride['waitTime'] if c.isdigit()) except TypeError: if ride['waitTime']: raise ValueError else: ride['waitTime'] = 0 attraction.setTime(ride['waitTime']) attraction.set_skip_line(meta['isFlashPassEligible']) self.addRide(attraction)
def _build_attraction(self, attraction): attraction_obj = Ride() attraction_obj.setName(attraction['name']) if attraction['active']: attraction_obj.setOpen() attraction_obj.setTime(attraction['waitTime']) else: attraction_obj.setTime(0) attraction_obj.setClosed() attraction_obj.set_skip_line(attraction['fastPass']) attraction_obj.setSingleRider(attraction['meta']['singleRider']) self.addRide(attraction_obj)
def _build_attraction(self, attr, time, names): try: name = names[attr['text']] except: print(unicode(attr['text'])) name = attr['text'] attraction = Ride() attraction.setName(name) if time == 'CLOSED': attraction.setClosed() else: attraction.setOpen() attraction.setTime(time) self.addRide(attraction)
def _make_attraction(self, ride): # Create dictionary with attraction information attraction = Ride() attraction.setName(ride['Name']) if not self.is_Open: attraction.setTime(0) attraction.setClosed() self.addRide(attraction) return if ride['WaitTime'] is None: attraction.setClosed() else: attraction.setOpen() if ride['WaitTime'] == -1: attraction.setClosed() attraction.setTime(-1) attraction.setStatus(ride['Status']) else: attraction.setTime(ride['WaitTime']) attraction.setStatus('Operating') self.addRide(attraction)
def _build_attr(self, row, wait_page): # Create dictionary with attraction information result = Ride() result.setName(row['name']) result.setOpen() result.setTime(0) if 'wait' in wait_page: for wait_dict in wait_page['wait']: if wait_dict['id'] == row['id']: result.setTime(wait_dict['wait']) if 'closed' in wait_page: for wait in wait_page['closed']: if wait == row['id']: result.setClosed() if 'wait' in wait_page and len(wait_page['wait']) == 0: result.setClosed() self.addRide(result)
def test_setTimeInt(self): ride = Ride() test_time_str = '10' test_time_int = int(test_time_str) ride.setTime(test_time_int) self.assertEquals(ride['wait'], test_time_int)
def _make_attraction(self, ride): attraction = Ride() attraction.setName(ride['MblDisplayName']) if ride['WaitTime'] is None: attraction.setClosed() else: attraction.setOpen() if ride['WaitTime'] == -50: attraction.setTime(0) attraction.setStatus('No Times Left') attraction.setOpen() if ride['WaitTime'] == -9: attraction.setOpen() attraction.setTime(0) attraction.setStatus('Virtual Line Only') elif ride['WaitTime'] == -8: attraction.setClosed() attraction.setTime(-1) attraction.setStatus('Not Open Yet') elif ride['WaitTime'] == -7: attraction.setTime(0) attraction.setOpen() elif ride['WaitTime'] == -5: attraction.setClosed() attraction.setTime(-1) attraction.setStatus('Capacity') elif ride['WaitTime'] == -4: attraction.setClosed() attraction.setTime(-1) attraction.setStatus('Weather') elif ride['WaitTime'] < 0: attraction.setClosed() attraction.setTime(-1) attraction.setStatus('Closed') elif ride['WaitTime'] == 900: attraction.setClosed() attraction.setTime(-1) attraction.setStatus('Closed Temporarily') else: attraction.setTime(ride['WaitTime']) attraction.setStatus('Operating') attraction.set_skip_line(ride['VirtualLine']) self.addRide(attraction)