Пример #1
0
    def to_json(self):
        import services
        stop_name = services.get_stop_name(self.stop_id,self.stop_name)
        def remove_site(link):
            import re
            result = re.sub('http://.*?/','/',link)
            return result

        return {'index' : self.index,
                'stop_id' : self.stop_id,
                'stop_name' : stop_name,
                'actual_arrival' : self.actual_arrival.isoformat() if self.actual_arrival else None,
                'exp_arrival' : self.exp_arrival.isoformat() if self.exp_arrival else None,
                'delay_arrival' : self.delay_arrival,
                'actual_departure' : self.actual_departure.isoformat() if self.actual_departure else None,
                'exp_departure' : self.exp_departure.isoformat() if self.exp_departure else None,
                'delay_departure' : self.delay_departure,
                'link' : remove_site(self.data_file_link)
        }
Пример #2
0
    def to_json(self):
        import services

        stop_name = services.get_stop_name(self.stop_id, self.stop_name)

        def remove_site(link):
            import re

            result = re.sub('http://.*?/', '/', link)
            return result

        return {'index': self.index,
                'stop_id': self.stop_id,
                'stop_name': stop_name,
                'actual_arrival': self.actual_arrival.isoformat() if self.actual_arrival else None,
                'exp_arrival': self.exp_arrival.isoformat() if self.exp_arrival else None,
                'delay_arrival': self.delay_arrival,
                'actual_departure': self.actual_departure.isoformat() if self.actual_departure else None,
                'exp_departure': self.exp_departure.isoformat() if self.exp_departure else None,
                'delay_departure': self.delay_departure,
                'link': remove_site(self.data_file_link)
        }
Пример #3
0
 def print_nice(self):
     import services
     for idx,stop_id in enumerate(self.stop_ids):
         print '%2d %s' % (idx,services.get_stop_name(stop_id))
Пример #4
0
    def print_nice(self):
        import services

        for idx, stop_id in enumerate(self.stop_ids):
            print '%2d %s' % (idx, services.get_stop_name(stop_id))