def add_shape(self, *args): shape = Shape(*args) assert valid_coord(shape.shape_pt_lat), 'Invalid coord' assert valid_coord(shape.shape_pt_lon), 'Invalid coord' assert valid_signed_int(shape.shape_pt_sequence), 'Invalid int' if shape.shape_dist_traveled: assert valid_signed_int(shape.shape_dist_traveled), 'Invalid int' self._shapes.append(shape)
def add_stop(self, *args): stop = Stop(*args) assert stop.stop_id not in get('stop_id', self._stops) assert valid_coord(stop.stop_lat), 'Invalid coord' assert valid_coord(stop.stop_lon), 'Invalid coord' if stop.stop_url: assert valid_url(stop.stop_url), 'Invalid URL' if stop.location_type: assert stop.location_type in srange(2), 'Out of range' if stop.stop_timezone: assert valid_timezone(stop.stop_timezone), 'Invalid timezone' if stop.wheelchair_boarding: assert stop.wheelchair_boarding in srange(3), 'Out of range' self._stops.append(stop)
def add_stop(self, *args): stop = Stop(*args) assert stop.stop_id not in get('stop_id', self._stops) assert valid_coord(stop.stop_lat), 'Invalid coord' assert valid_coord(stop.stop_lon), 'Invalid coord' if stop.stop_url: print('STOP URL', stop.stop_url) assert valid_url(stop.stop_url), 'Invalid URL' if stop.location_type: assert stop.location_type in xrange(2), 'Out of range' if stop.stop_timezone: assert valid_timezone(stop.stop_timezone), 'Invalid timezone' if stop.wheelchair_boarding: assert stop.wheelchair_boarding in xrange(3), 'Out of range' self._stops.append(stop)