Ejemplo n.º 1
0
    def add_agency(self, *args):
        agency = Agency(*args)

        assert agency.agency_id not in get('agency_id', self._agency), 'Dup!'

        assert valid_url(agency.agency_url), 'Invalid agency URL'
        assert valid_timezone(agency.agency_timezone), 'Invalid timezone'

        if agency.agency_lang:
            assert valid_lang(agency.agency_lang), 'Invalid ISO 639-2 lang'

        if agency.agency_fare_url:
            assert valid_url(agency.agency_fare_url, scheme=1), 'Invalid URL'

        self._agency.append(agency)
Ejemplo n.º 2
0
    def add_agency(self, *args):
        agency = Agency(*args)

        assert agency.agency_id not in get('agency_id', self._agency), 'Dup!'

        assert valid_url(agency.agency_url), 'Invalid agency URL'
        assert valid_timezone(agency.agency_timezone), 'Invalid timezone'

        if agency.agency_lang:
            assert valid_lang(agency.agency_lang), 'Invalid ISO 639-2 lang'

        if agency.agency_fare_url:
            assert valid_url(agency.agency_fare_url, scheme=1), 'Invalid URL'

        self._agency.append(agency)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)