Пример #1
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on FeedInfo

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return
        if key == "feed_publisher_name":
            self.feed_publisher_name = value
        elif key == "feed_publisher_url":
            self.feed_publisher_url = value
        elif key == "feed_lang":
            self.feed_lang = value
        elif key == "feed_start_date":
            self.feed_start_date = value
        elif key == "feed_end_date":
            self.feed_end_date = value
        elif key == "feed_version":
            self.feed_version = value
        elif key == "feed_contact_email":
            self.feed_contact_email = value
        elif key == "feed_contact_url":
            self.feed_contact_url = value
        elif key == "default_lang":
            self.default_lang = value
        else:
            raise InvalidKeyError(key)
Пример #2
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on Service

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "service_id":
            self.service_id = value
        elif key == "monday":
            self.monday = int(value)
        elif key == "tuesday":
            self.tuesday = int(value)
        elif key == "wednesday":
            self.wednesday = int(value)
        elif key == "thursday":
            self.thursday = int(value)
        elif key == "friday":
            self.friday = int(value)
        elif key == "saturday":
            self.saturday = int(value)
        elif key == "sunday":
            self.sunday = int(value)
        elif key == "start_date":
            self.start_date = value
        elif key == "end_date":
            self.end_date = value
        else:
            raise InvalidKeyError(key)
Пример #3
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on stop_time

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "trip_id":
            self.trip_id = value
        elif key == "arrival_time":
            self.arrival_time = value
        elif key == "departure_time":
            self.departure_time = value
        elif key == "stop_id":
            self.stop_id = value
        elif key == "stop_sequence":
            self.stop_sequence = int(value)
        elif key == "stop_headsign":
            self.stop_headsign = value
        elif key == "pickup_type":
            self.pickup_type = int(value)
        elif key == "drop_off_type":
            self.drop_off_type = int(value)
        elif key == "shape_dist_traveled":
            self.shape_dist_traveled = float(value)
        elif key == "timepoint":
            self.timepoint = int(value)
        else:
            raise InvalidKeyError(key)
Пример #4
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on fare_attribute

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "fare_id":
            self.fare_id = value
        elif key == "price":
            self.price = float(value)
        elif key == "currency_type":
            self.currency_type = value
        elif key == "payment_method":
            self.payment_method = int(value)
        elif key == "transfers":
            self.transfers = int(value)
        elif key == "agency_id":
            self.agency_id = value
        elif key == "transfer_duration":
            self.transfer_duration = int(value)
        else:
            raise InvalidKeyError(key)
Пример #5
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on transfer

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "from_stop_id":
            self.from_stop_id = value
        elif key == "to_stop_id":
            self.to_stop_id = value
        elif key == "transfer_type":
            self.transfer_type = int(value)
        elif key == "min_transfer_time":
            self.min_transfer_time = int(value)
        elif key == "from_route_id":
            self.from_route_id = value
        elif key == "to_route_id":
            self.to_route_id = value
        elif key == "from_trip_id":
            self.from_trip_id = value
        elif key == "to_trip_id":
            self.to_trip_id = value
        else:
            raise InvalidKeyError(key)
Пример #6
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on translation

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "table_name":
            self.table_name = value
        elif key == "field_name":
            self.field_name = value
        elif key == "language":
            self.language = value
        elif key == "translation":
            self.translation = value
        elif key == "record_id":
            self.record_id = value
        elif key == "record_sub_id":
            self.record_sub_id = value
        elif key == "field_value":
            self.field_value = value
        else:
            raise InvalidKeyError(key)
Пример #7
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on trip

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "route_id":
            self.route_id = value
        elif key == "service_id":
            self.service_id = value
        elif key == "trip_id":
            self.trip_id = value
        elif key == "trip_headsign":
            self.trip_headsign = value
        elif key == "trip_short_name":
            self.trip_short_name = value
        elif key == "direction_id":
            self.direction_id = int(value)
        elif key == "block_id":
            self.block_id = value
        elif key == "shape_id":
            self.shape_id = value
        elif key == "wheelchair_accessible":
            self.wheelchair_accessible = int(value)
        elif key == "bikes_allowed":
            self.bikes_allowed = int(value)
        elif key == "exceptional":
            self.exceptional = int(value)
        else:
            raise InvalidKeyError(key)
Пример #8
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on route

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return
        if key == "route_id":
            self.route_id = value
        elif key == "agency_id":
            self.agency_id = value
        elif key == "route_short_name":
            self.route_short_name = value
        elif key == "route_long_name":
            self.route_long_name = value
        elif key == "route_desc":
            self.route_desc = value
        elif key == "route_type":
            self.route_type = int(value)
        elif key == "route_url":
            self.route_url = value
        elif key == "route_color":
            self.route_color = value
        elif key == "route_text_color":
            self.route_text_color = value
        elif key == "route_sort_order":
            self.route_sort_order = int(value)
        else:
            raise InvalidKeyError(key)
Пример #9
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on level

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return
        if key == "level_id":
            self.level_id = value
        elif key == "level_index":
            self.level_index = float(value)
        elif key == "level_name":
            self.level_name = value
        else:
            raise InvalidKeyError(key)
Пример #10
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on ServiceException

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "service_id":
            self.service_id = value
        elif key == "date":
            self.date = value
        elif key == "exception_type":
            self.exception_type = int(value)
        else:
            raise InvalidKeyError(key)
Пример #11
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on stop

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return
        if key == "stop_id":
            self.stop_id = value
        elif key == "stop_code":
            self.stop_code = value
        elif key == "stop_name":
            self.stop_name = value
        elif key == "stop_desc":
            self.stop_desc = value
        elif key == "stop_lat":
            self.stop_lat = float(value)
        elif key == "stop_lon":
            self.stop_lon = float(value)
        elif key == "zone_id":
            self.zone_id = value
        elif key == "stop_url":
            self.stop_url = value
        elif key == "location_type":
            self.location_type = int(value)
        elif key == "parent_station":
            self.parent_station = value
        elif key == "stop_timezone":
            self.stop_timezone = value
        elif key == "wheelchair_boarding":
            self.wheelchair_boarding = int(value)
        elif key == "level_id":
            self.level_id = value
        elif key == "platform_code":
            self.platform_code = value
        elif key == "vehicle_type":
            self.vehicle_type = int(value)
        else:
            raise InvalidKeyError(key)
Пример #12
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on pathway

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return


        if key == "pathway_id":
            self.pathway_id = value
        elif key == "from_stop_id":
            self.from_stop_id = value
        elif key == "to_stop_id":
            self.to_stop_id = value
        elif key == "pathway_mode":
            self.pathway_mode = int(value)
        elif key == "is_bidirectional":
            self.is_bidirectional = int(value)
        elif key == "length":
            self.length = float(value)
        elif key == "traversal_time":
            self.traversal_time = int(value)
        elif key == "stair_count":
            self.stair_count = int(value)
        elif key == "max_slope":
            self.max_slope = float(value)
        elif key == "min_width":
            self.min_width = float(value)
        elif key == "signposted_as":
            self.signposted_as = value
        elif key == "reversed_signposted_as":
            self.reversed_signposted_as = value
        else:
            raise InvalidKeyError(key)
Пример #13
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on fare_rule

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "fare_id":
            self.fare_id = value
        elif key == "route_id":
            self.route_id = value
        elif key == "origin_id":
            self.origin_id = value
        elif key == "destination_id":
            self.destination_id = value
        elif key == "contains_id":
            self.contains_id = value
        else:
            raise InvalidKeyError(key)
Пример #14
0
    def setkey(self, key, value):
        """
        Sets a class attribute depending on `key`, raising
        InvalidKeyError if the key does not belong on freqency

        Arguments:
        key, value: the key and value
        """
        if value == "":
            return

        if key == "trip_id":
            self.trip_id = value
        elif key == "start_time":
            self.start_time = value
        elif key == "end_time":
            self.end_time = value
        elif key == "headway_secs":
            self.headway_secs = int(value)
        elif key == "exact_times":
            self.exact_times = int(value)
        else:
            raise InvalidKeyError(key)