Exemple #1
0
    def add_stop_time(self, *args):
        stop_time = StopTime(*args)

        #assert stop_time.trip_id in get('trip_id', self._trips)

        assert valid_time(stop_time.arrival_time
                          ), 'Invalid time: %s' % stop_time.arrival_time
        assert valid_time(stop_time.departure_time
                          ), 'Invalid time: %s' % stop_time.departure_time

        assert stop_time.stop_id in get('stop_id', self._stops)
        assert valid_signed_int(stop_time.stop_sequence), 'Invalid int'

        if stop_time.pickup_type:
            assert stop_time.pickup_type in xrange(4), 'Out of range'

        if stop_time.drop_off_type:
            assert stop_time.drop_off_type in xrange(4), 'Out of range'

        if stop_time.shape_dist_traveled:
            assert valid_signed_int(
                stop_time.shape_dist_traveled), 'Invalid int'

        if stop_time.timepoint:
            assert stop_time.timepoint in xrange(2), 'Out of range'

        self._stop_times.append(stop_time)
Exemple #2
0
    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)
Exemple #3
0
    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)
Exemple #4
0
    def add_transfer(self, *args):
        transfer = Transfer(*args)

        stop_ids = get('stop_id', self._stops)
        assert transfer.from_stop_id in stop_ids
        assert transfer.to_stop_id in stop_ids

        assert transfer.transfer_type in xrange(4), 'Out of range'

        if transfer.min_transfer_time:
            assert valid_signed_int(transfer.min_transfer_time), 'Invalid int'

        self._transfers.append(transfer)
Exemple #5
0
    def add_transfer(self, *args):
        transfer = Transfer(*args)

        stop_ids = get('stop_id', self._stops)
        assert transfer.from_stop_id in stop_ids
        assert transfer.to_stop_id in stop_ids

        assert transfer.transfer_type in xrange(4), 'Out of range'

        if transfer.min_transfer_time:
            assert valid_signed_int(transfer.min_transfer_time), 'Invalid int'

        self._transfers.append(transfer)
Exemple #6
0
    def add_stop_time(self, *args):
        stop_time = StopTime(*args)

        #assert stop_time.trip_id in get('trip_id', self._trips)

        assert valid_time(stop_time.arrival_time), 'Invalid time: %s' % stop_time.arrival_time
        assert valid_time(stop_time.departure_time), 'Invalid time: %s' % stop_time.departure_time

        assert stop_time.stop_id in get('stop_id', self._stops)
        assert valid_signed_int(stop_time.stop_sequence), 'Invalid int'

        if stop_time.pickup_type:
            assert stop_time.pickup_type in xrange(4), 'Out of range'

        if stop_time.drop_off_type:
            assert stop_time.drop_off_type in xrange(4), 'Out of range'

        if stop_time.shape_dist_traveled:
            assert valid_signed_int(stop_time.shape_dist_traveled), 'Invalid int'

        if stop_time.timepoint:
            assert stop_time.timepoint in xrange(2), 'Out of range'

        self._stop_times.append(stop_time)