def _create_parameters(request, isochrone_center, request_type): from jormungandr.planner import JourneyParameters, GraphicalIsochronesParameters, StreetNetworkParameters if request_type == type_pb2.graphical_isochrone: # Yes, graphical_isochrones needs that... sn_params = StreetNetworkParameters( origin_mode=request["origin_mode"][0], destination_mode=request["destination_mode"][0], walking_speed=request["walking_speed"], bike_speed=request["bike_speed"], car_speed=request["car_speed"], bss_speed=request["bss_speed"], car_no_park_speed=request["car_no_park_speed"], ) journey_parameters = JourneyParameters( max_duration=request.get('max_duration', None), forbidden_uris=request['forbidden_uris[]'], allowed_id=request['allowed_id[]'], isochrone_center=isochrone_center, sn_params=sn_params, ) return GraphicalIsochronesParameters( journeys_parameters=journey_parameters, min_duration=request.get("min_duration"), boundary_duration=request.get("boundary_duration[]"), ) else: return JourneyParameters( max_duration=request['max_duration'], max_transfers=request['max_transfers'], wheelchair=request['wheelchair'] or False, realtime_level=request['data_freshness'], max_extra_second_pass=request['max_extra_second_pass'], walking_transfer_penalty=request['_walking_transfer_penalty'], forbidden_uris=request['forbidden_uris[]'], allowed_id=request['allowed_id[]'], night_bus_filter_max_factor=request[ '_night_bus_filter_max_factor'], night_bus_filter_base_factor=request[ '_night_bus_filter_base_factor'], min_nb_journeys=request['min_nb_journeys'], timeframe=request['timeframe_duration'], depth=request['depth'], isochrone_center=isochrone_center, current_datetime=date_to_timestamp( request['_current_datetime']), )
def create_parameters(request): return JourneyParameters(max_duration=request['max_duration'], max_transfers=request['max_transfers'], wheelchair=request['wheelchair'] or False, realtime_level=request['data_freshness'], max_extra_second_pass=request['max_extra_second_pass'], walking_transfer_penalty=request['_walking_transfer_penalty'], forbidden_uris=request['forbidden_uris[]'])
def test_journey_request_current_time(): origin = {"Kisio Digital": 42} destination = {"Somewhere": 666} datetime = str_to_time_stamp("20120614T080000") journey_parameters = JourneyParameters(current_datetime=123456789) planner = Kraken(None) req = planner._create_journeys_request(origin, destination, datetime, True, journey_parameters, False) assert req._current_datetime == 123456789
def _create_parameters(request): from jormungandr.planner import JourneyParameters return JourneyParameters( max_duration=request['max_duration'], max_transfers=request['max_transfers'], wheelchair=request['wheelchair'] or False, realtime_level=request['data_freshness'], max_extra_second_pass=request['max_extra_second_pass'], walking_transfer_penalty=request['_walking_transfer_penalty'], forbidden_uris=request['forbidden_uris[]'], allowed_id=request['allowed_id[]'])
def create_journeys_request_test(): origin = {"Kisio Digital": 42} destination = {"Somewhere": 666} journey_parameters = JourneyParameters() datetime = str_to_time_stamp("20120614T080000") planner = Kraken(None) req = planner._create_journeys_request(origin, destination, datetime, True, journey_parameters, False) assert req.requested_api == type_pb2.pt_planner check_basic_journeys_request(req.journeys)
def _create_parameters(request): from jormungandr.planner import JourneyParameters return JourneyParameters( max_duration=request['max_duration'], max_transfers=request['max_transfers'], wheelchair=request['wheelchair'] or False, realtime_level=request['data_freshness'], max_extra_second_pass=request['max_extra_second_pass'], walking_transfer_penalty=request['_walking_transfer_penalty'], forbidden_uris=request['forbidden_uris[]'], allowed_id=request['allowed_id[]'], night_bus_filter_max_factor=request['_night_bus_filter_max_factor'], night_bus_filter_base_factor=request['_night_bus_filter_base_factor'], min_nb_journeys=request['min_nb_journeys'], timeframe=request['timeframe_duration'], depth=request['depth'], )