Пример #1
0
from jormungandr import i_manager
from jormungandr.interfaces.v1.fields import error,\
    PbField, NonNullList, NonNullNested,\
    feed_publisher, Links, JsonString, place, \
    ListLit, beta_endpoint, context
from jormungandr.timezone import set_request_timezone
from jormungandr.interfaces.v1.errors import ManageError
from jormungandr.utils import date_to_timestamp
from jormungandr.interfaces.parsers import UnsignedInteger
from jormungandr.interfaces.v1.journey_common import JourneyCommon
from jormungandr.interfaces.v1.fields import DateTime
from jormungandr.interfaces.v1.serializer.api import GraphicalIsrochoneSerializer
from jormungandr.interfaces.v1.decorators import get_serializer

graphical_isochrone = {
    "geojson": JsonString(),
    "max_duration": fields.Integer(),
    "min_duration": fields.Integer(),
    'from': PbField(place, attribute='origin'),
    "to": PbField(place, attribute="destination"),
    'requested_date_time': DateTime(),
    'min_date_time': DateTime(),
    'max_date_time': DateTime()
}


graphical_isochrones = {
    "isochrones": NonNullList(NonNullNested(graphical_isochrone), attribute="graphical_isochrones"),
    "error": PbField(error, attribute='error'),
    "feed_publishers": fields.List(NonNullNested(feed_publisher)),
    "links": fields.List(Links()),
Пример #2
0
from jormungandr import i_manager
from jormungandr.interfaces.v1.fields import error,\
    PbField, NonNullList, NonNullNested,\
    Links, JsonString, place,\
    ListLit, beta_endpoint, feed_publisher
from jormungandr.timezone import set_request_timezone
from jormungandr.interfaces.v1.errors import ManageError
from jormungandr.utils import date_to_timestamp
from jormungandr.interfaces.parsers import UnsignedInteger
from jormungandr.interfaces.v1.journey_common import JourneyCommon
from jormungandr.interfaces.v1.fields import DateTime, context
from jormungandr.interfaces.v1.serializer.api import HeatMapSerializer
from jormungandr.interfaces.v1.decorators import get_serializer

heat_map = {
    "heat_matrix": JsonString(),
    'from': PbField(place, attribute='origin'),
    "to": PbField(place, attribute="destination"),
    'requested_date_time': DateTime()
}


heat_maps = {
    "heat_maps": NonNullList(NonNullNested(heat_map)),
    "error": PbField(error, attribute='error'),
    "links": fields.List(Links()),
    "warnings": ListLit([fields.Nested(beta_endpoint)]),
    "feed_publishers": fields.List(NonNullNested(feed_publisher)),
    "context": context
}