Пример #1
0
    @marshal_with(route_schedules)
    @ManageError()
    def get(self, uri=None, region=None, lon=None, lat=None):
        return super(RouteSchedules, self).get(uri=uri,
                                               region=region,
                                               lon=lon,
                                               lat=lat)


stop_schedule = {
    "stop_point":
    PbField(stop_point),
    "route":
    PbField(route, attribute="route"),
    "additional_informations":
    enum_type(attribute="response_status"),
    "display_informations":
    PbField(display_informations_route, attribute='pt_display_informations'),
    "date_times":
    fields.List(fields.Nested(date_time)),
    "links":
    UrisToLinks()
}
stop_schedules = {
    "stop_schedules": fields.List(fields.Nested(stop_schedule)),
    "pagination": fields.Nested(pagination),
    "error": PbField(error, attribute='error'),
    "disruptions": DisruptionsField,
}

Пример #2
0
    "tuesday": fields.Boolean(),
    "wednesday": fields.Boolean(),
    "thursday": fields.Boolean(),
    "friday": fields.Boolean(),
    "saturday": fields.Boolean(),
    "sunday": fields.Boolean(),
}

calendar_period = {
    "begin": fields.String(),
    "end": fields.String(),
}

calendar_exception = {
    "datetime": fields.String(attribute="date"),
    "type": enum_type(),
}
validity_pattern = {
    'beginning_date': fields.String(),
    'days': fields.String(),
}
calendar = {
    "id": NonNullString(attribute="uri"),
    "name": NonNullString(),
    "week_pattern": NonNullNested(week_pattern),
    "active_periods": NonNullList(NonNullNested(calendar_period)),
    "exceptions": NonNullList(NonNullNested(calendar_exception)),
    "validity_pattern": NonNullProtobufNested(validity_pattern)
}

calendars = {
Пример #3
0
            pass
        return super(section_type, self).output("type", obj)


class section_place(PbField):

    def output(self, key, obj):
        enum_t = obj.DESCRIPTOR.fields_by_name['type'].enum_type.values_by_name
        if obj.type == enum_t['WAITING'].number:
            return None
        else:
            return super(PbField, self).output(key, obj)
section = {
    "type": section_type(),
    "id": fields.String(),
    "mode": enum_type(attribute="street_network.mode"),
    "duration": fields.Integer(),
    "from": section_place(place, attribute="origin"),
    "to": section_place(place, attribute="destination"),
    "links": SectionLinks(attribute="uris"),
    "display_informations": PbField(display_informations_vj,
                                    attribute='pt_display_informations'),
    "additional_informations": additional_informations_vj(),
    "geojson": SectionGeoJson(),
    "path": NonNullList(NonNullNested({"length": fields.Integer(),
                                       "name": fields.String(),
                                       "duration": fields.Integer(),
                                       "direction": fields.Integer()}),
                        attribute="street_network.path_items"),
    "transfer_type": enum_type(),
    "stop_date_times": NonNullList(NonNullNested(stop_date_time)),
Пример #4
0
class section_place(PbField):
    def output(self, key, obj):
        enum_t = obj.DESCRIPTOR.fields_by_name['type'].enum_type.values_by_name
        if obj.type == enum_t['WAITING'].number:
            return None
        else:
            return super(PbField, self).output(key, obj)


section = {
    "type":
    section_type(),
    "id":
    fields.String(),
    "mode":
    enum_type(attribute="street_network.mode"),
    "duration":
    fields.Integer(),
    "from":
    section_place(place, attribute="origin"),
    "to":
    section_place(place, attribute="destination"),
    "links":
    SectionLinks(attribute="uris"),
    "display_informations":
    PbField(display_informations_vj, attribute='pt_display_informations'),
    "additional_informations":
    additional_informations_vj(),
    "geojson":
    GeoJson(),
    "path":
Пример #5
0
class section_place(PbField):
    def output(self, key, obj):
        enum_t = obj.DESCRIPTOR.fields_by_name['type'].enum_type.values_by_name
        if obj.type == enum_t['WAITING'].number:
            return None
        else:
            return super(PbField, self).output(key, obj)


section = {
    "type":
    section_type(),
    "id":
    fields.String(),
    "mode":
    enum_type(attribute="street_network.mode"),
    "duration":
    fields.Integer(),
    "from":
    section_place(place, attribute="origin"),
    "to":
    section_place(place, attribute="destination"),
    "links":
    SectionLinks(attribute="uris"),
    "display_informations":
    PbField(display_informations_vj, attribute='pt_display_informations'),
    "additional_informations":
    NonNullList(PbEnum(response_pb2.SectionAdditionalInformationType)),
    "geojson":
    SectionGeoJson(),
    "path":