コード例 #1
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    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)
コード例 #2
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    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)
コード例 #3
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    def add_feed_info(self, *args):
        feed_info = FeedInfo(*args)

        assert valid_url(feed_info.feed_publisher_url), 'Invalid URL'
        assert valid_lang_tag(feed_info.feed_lang), 'Invalid BCP 47 tag'

        if feed_info.feed_start_date:
            assert valid_date(feed_info.feed_start_date), 'Invalid date'
            assert valid_date(feed_info.feed_end_date), 'Invalid date'

        self._feed_info(*args)
コード例 #4
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    def add_feed_info(self, *args):
        feed_info = FeedInfo(*args)

        assert valid_url(feed_info.feed_publisher_url), 'Invalid URL'
        assert valid_lang_tag(feed_info.feed_lang), 'Invalid BCP 47 tag'

        if feed_info.feed_start_date:
            assert valid_date(feed_info.feed_start_date), 'Invalid date'
            assert valid_date(feed_info.feed_end_date), 'Invalid date'

        self._feed_info(*args)
コード例 #5
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    def add_route(self, *args):
        route = Route(*args)

        assert route.route_id not in get('route_id', self._routes)
        # agency_id optional in agencies
        if route.agency_id:
            assert route.agency_id in get('agency_id', self._agency)

        assert route.route_type in xrange(8), 'Out of range'

        if route.route_url:
            assert valid_url(route.route_url), 'Invalid URL'

        if route.route_text_color:
            assert valid_hex(route.route_text_color), 'Invalid hex color'

        self._routes.append(route)
コード例 #6
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    def add_route(self, *args):
        route = Route(*args)

        assert route.route_id not in get('route_id', self._routes)
        # agency_id optional in agencies
        if route.agency_id:
            assert route.agency_id in get('agency_id', self._agency)

        assert route.route_type in xrange(8), 'Out of range'

        if route.route_url:
            assert valid_url(route.route_url), 'Invalid URL'

        if route.route_text_color:
            assert valid_hex(route.route_text_color), 'Invalid hex color'

        self._routes.append(route)
コード例 #7
0
ファイル: feed.py プロジェクト: surpr1ze/python-gtfs
    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)
コード例 #8
0
ファイル: feed.py プロジェクト: iceone/python-gtfs
    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)