def _build_attr(self, attraction): print attraction.contenttype.text if attraction.contenttype.text == 'USSShow': document = Show() document.setName(attraction.find('name').text) if 'ashx' in attraction.showtime.text: return showtimes = self.get_showtimes(attraction.showtime.text) for show in showtimes: try: time_obj = dateutil.parser.parse(show) document.addTime(time_obj) except: pass self.addShow(document) if attraction.contenttype.text == 'Ride': document = Ride() document.setName(attraction.find('name').text) document.setRide() if 'Guests' in attraction.queuetime.text: document.setTime(0) else: document.setTime(attraction.queuetime.text) if attraction.availability.text == 'True': document.setOpen() else: document.setClosed() self.addRide(document)
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_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 test_setOpen(self): ride = Ride() ride.setOpen() self.assertEqual(ride['isOpen'], True)
def test_isOpen(self): ride = Ride() ride.setClosed() self.assertEqual(ride.isOpen(), False)
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 test_setClosed(self): ride = Ride() ride.setClosed() self.assertEqual(ride['isOpen'], False)
def test_addRide(self): park = Park() ride = Ride() park.addRide(ride) self.assertEqual(len(park.rides()), 1)
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)
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_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)