def _get_mode_of_journey(self, journey): mode = FallbackModes.modes_str() & set(journey.tags) if len(mode) != 1: self.logger.error('Cannot determine the mode of direct path: {}'.format(mode)) return None return next(iter(mode))
def _set_specific_params(mod): if args.get('max_duration') is None: args['max_duration'] = mod.max_duration if args.get('_walking_transfer_penalty') is None: args[ '_walking_transfer_penalty'] = mod.walking_transfer_penalty if args.get('_night_bus_filter_base_factor') is None: args[ '_night_bus_filter_base_factor'] = mod.night_bus_filter_base_factor if args.get('_night_bus_filter_max_factor') is None: args[ '_night_bus_filter_max_factor'] = mod.night_bus_filter_max_factor if args.get('_max_additional_connections') is None: args[ '_max_additional_connections'] = mod.max_additional_connections if args.get('min_nb_journeys') is None: args['min_nb_journeys'] = mod.min_nb_journeys if args.get('max_nb_journeys') is None: args['max_nb_journeys'] = mod.max_nb_journeys if args.get('_min_journeys_calls') is None: args['_min_journeys_calls'] = mod.min_journeys_calls if args.get('_max_successive_physical_mode') is None: args[ '_max_successive_physical_mode'] = mod.max_successive_physical_mode if args.get('_final_line_filter') is None: args['_final_line_filter'] = mod.final_line_filter if args.get('max_extra_second_pass') is None: args['max_extra_second_pass'] = mod.max_extra_second_pass if args.get('additional_time_after_first_section_taxi') is None: args[ 'additional_time_after_first_section_taxi'] = mod.additional_time_after_first_section_taxi if args.get('additional_time_before_last_section_taxi') is None: args[ 'additional_time_before_last_section_taxi'] = mod.additional_time_before_last_section_taxi if args.get('_stop_points_nearby_duration') is None: args[ '_stop_points_nearby_duration'] = mod.stop_points_nearby_duration # we create a new arg for internal usage, only used by distributed scenario args[ 'max_nb_crowfly_by_mode'] = mod.max_nb_crowfly_by_mode # it's a dict of str vs int for mode in fallback_modes.all_fallback_modes: nb_crowfly = args.get('_max_nb_crowfly_by_{}'.format(mode)) if nb_crowfly is not None: args['max_nb_crowfly_by_mode'][mode] = nb_crowfly # activated only for distributed for mode in FallbackModes.modes_str(): tmp = 'max_{}_direct_path_duration'.format(mode) if args.get(tmp) is None: args[tmp] = getattr(mod, tmp)
def __init__(self): # journeys must have a custom authentication process super(Journeys, self).__init__(output_type_serializer=api.JourneysSerializer) parser_get = self.parsers["get"] parser_get.add_argument("count", type=default_count_arg_type, help='Fixed number of different journeys') parser_get.add_argument("_min_journeys_calls", type=int, hidden=True) parser_get.add_argument("_final_line_filter", type=BooleanType(), hidden=True) parser_get.add_argument( "is_journey_schedules", type=BooleanType(), default=False, help="True when '/journeys' is called to compute" "the same journey schedules and " "it'll override some specific parameters", ) parser_get.add_argument( "min_nb_journeys", type=UnsignedInteger(), help='Minimum number of different suggested journeys, must be >= 0', ) parser_get.add_argument( "max_nb_journeys", type=PositiveInteger(), help='Maximum number of different suggested journeys, must be > 0', ) parser_get.add_argument("_max_extra_second_pass", type=int, dest="max_extra_second_pass", hidden=True) parser_get.add_argument( "debug", type=BooleanType(), default=False, hidden=True, help='Activate debug mode.\n' 'No journeys are filtered in this mode.', ) parser_get.add_argument( "show_codes", type=BooleanType(), default=False, hidden=True, deprecated=True, help="DEPRECATED, show more identification codes", ) parser_get.add_argument( "_override_scenario", type=six.text_type, hidden=True, help="debug param to specify a custom scenario", ) parser_get.add_argument("_street_network", type=six.text_type, hidden=True, help="choose the streetnetwork component") parser_get.add_argument("_walking_transfer_penalty", hidden=True, type=int) parser_get.add_argument("_max_successive_physical_mode", hidden=True, type=int) parser_get.add_argument("_max_additional_connections", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_base_factor", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_max_factor", hidden=True, type=float) parser_get.add_argument("_min_car", hidden=True, type=int) parser_get.add_argument("_min_bike", hidden=True, type=int) parser_get.add_argument("_min_taxi", hidden=True, type=int) parser_get.add_argument( "bss_stands", type=BooleanType(), default=False, deprecated=True, help="DEPRECATED, Use add_poi_infos[]=bss_stands", ) parser_get.add_argument( "add_poi_infos[]", type=OptionValue(add_poi_infos_types), default=[], dest="add_poi_infos", action="append", help= "Show more information about the poi if it's available, for instance, show " "BSS/car park availability in the pois(BSS/car park) of response", ) parser_get.add_argument( "_no_shared_section", type=BooleanType(), default=False, hidden=True, dest="no_shared_section", help= "Shared section journeys aren't returned as a separate journey", ) parser_get.add_argument( "timeframe_duration", type=int, help="Minimum timeframe to search journeys.\n" "For example 'timeframe_duration=3600' will search for all " "interesting journeys departing within the next hour.\n" "Nota 1: Navitia can return journeys after that timeframe as it's " "actually a minimum.\n" "Nota 2: 'max_nb_journeys' parameter has priority over " "'timeframe_duration' parameter.", ) parser_get.add_argument( "_max_nb_crowfly_by_walking", type=int, hidden=True, help="limit nb of stop points accesible by walking crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_car", type=int, hidden=True, help="limit nb of stop points accesible by car crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_taxi", type=int, hidden=True, help="limit nb of stop points accesible by taxi crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bike", type=int, hidden=True, help="limit nb of stop points accesible by bike crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bss", type=int, hidden=True, help="limit nb of stop points accesible by bss crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "equipment_details", default=True, type=BooleanType(), help="enhance response with accessibility equipement details", ) for mode in FallbackModes.modes_str(): parser_get.add_argument( "max_{}_direct_path_duration".format(mode), type=int, help= "limit duration of direct path in {}, used ONLY in distributed scenario" .format(mode), ) parser_get.add_argument("depth", type=DepthArgument(), default=1, help="The depth of your object") args = self.parsers["get"].parse_args() self.get_decorators.append(complete_links(self)) if handle_poi_infos(args["add_poi_infos"], args["bss_stands"]): self.get_decorators.insert(1, ManageParkingPlaces(self, 'journeys'))
def __init__(self, output_type_serializer): ResourceUri.__init__(self, authentication=False, output_type_serializer=output_type_serializer) ResourceUtc.__init__(self) types = { "all": "All types", "best": "The best journey", "rapid": "A good trade off between duration, changes and constraint respect", 'no_train': "Journey without train", 'comfort': "A journey with less changes and walking", 'car': "A journey with car to get to the public transport", 'less_fallback_walk': "A journey with less walking", 'less_fallback_bike': "A journey with less biking", 'less_fallback_bss': "A journey with less bss", 'fastest': "A journey with minimum duration", 'non_pt_walk': "A journey without public transport, only walking", 'non_pt_bike': "A journey without public transport, only biking", 'non_pt_bss': "A journey without public transport, only bike sharing", } data_freshnesses = { 'base_schedule': 'Use theoric schedule information', 'realtime': 'Use all realtime information', 'adapted_schedule': 'Use of adapted schedule information (like strike adjusting, etc.). ' 'Prefer `realtime` for traveler information as it will also contain ' 'adapted information schedule.', } parser_get = self.parsers["get"] parser_get.add_argument( "from", type=six.text_type, dest="origin", help='The id of the departure of your journey. If not provided an isochrone is computed.', schema_metadata={'format': 'place'}, ) parser_get.add_argument( "to", type=six.text_type, dest="destination", help='The id of the arrival of your journey. If not provided an isochrone is computed.', schema_metadata={'format': 'place'}, ) parser_get.add_argument( "datetime", type=DateTimeFormat(), help='Date and time to go/arrive (see `datetime_represents`).\n' 'Note: the datetime must be in the coverage’s publication period.', ) parser_get.add_argument( "datetime_represents", dest="clockwise", type=DatetimeRepresents(), default=True, help="Determine how datetime is handled.\n\n" "Possible values:\n" " * 'departure' - Compute journeys starting after datetime\n" " * 'arrival' - Compute journeys arriving before datetime", ) parser_get.add_argument("max_transfers", type=int, default=42, hidden=True, deprecated=True) parser_get.add_argument( "max_nb_transfers", type=int, dest="max_transfers", help='Maximum number of transfers in each journey', ) parser_get.add_argument( "min_nb_transfers", type=int, default=0, help='Minimum number of transfers in each journey' ) parser_get.add_argument( "first_section_mode[]", type=OptionValue(fallback_modes.all_fallback_modes), dest="origin_mode", action="append", help='Force the first section mode ' 'if the first section is not a public transport one.\n' '`bss` stands for bike sharing system.\n' 'Note 1: It’s an array, you can give multiple modes.\n' 'Note 2: Choosing `bss` implicitly allows the walking mode since ' 'you might have to walk to the bss station.\n' 'Note 3: The parameter is inclusive, not exclusive, ' 'so if you want to forbid a mode, you need to add all the other modes. ' 'Eg: If you never want to use a car, you need: ' '`first_section_mode[]=walking&first_section_mode[]=bss&' 'first_section_mode[]=bike&last_section_mode[]=walking&' 'last_section_mode[]=bss&last_section_mode[]=bike`', ) parser_get.add_argument( "last_section_mode[]", type=OptionValue(fallback_modes.all_fallback_modes), dest="destination_mode", action="append", help='Same as first_section_mode but for the last section.', ) # for retrocompatibility purpose, we duplicate (without []): parser_get.add_argument( "first_section_mode", hidden=True, deprecated=True, type=OptionValue(fallback_modes.all_fallback_modes), action="append", ) parser_get.add_argument( "last_section_mode", hidden=True, deprecated=True, type=OptionValue(fallback_modes.all_fallback_modes), action="append", ) parser_get.add_argument( "max_duration_to_pt", type=int, help="Maximum allowed duration to reach the public transport (same limit used before and " "after public transport).\n" "Use this to limit the walking/biking part.\n" "Unit is seconds", ) parser_get.add_argument( "max_walking_duration_to_pt", type=int, help="Maximal duration of walking on public transport in second", ) parser_get.add_argument( "max_bike_duration_to_pt", type=int, help="Maximal duration of bike on public transport in second" ) parser_get.add_argument( "max_bss_duration_to_pt", type=int, help="Maximal duration of bss on public transport in second" ) parser_get.add_argument( "max_car_duration_to_pt", type=int, help="Maximal duration of car on public transport in second" ) parser_get.add_argument( "max_ridesharing_duration_to_pt", type=int, dest="max_ridesharing_duration_to_pt", help="Maximal duration of ridesharing on public transport in second", ) parser_get.add_argument( "max_car_no_park_duration_to_pt", type=int, help="Maximal duration of car no park on public transport in second", ) parser_get.add_argument( "max_taxi_duration_to_pt", type=int, dest="max_taxi_duration_to_pt", help="Maximal duration of taxi on public transport in second, only available in distributed scenario", ) for mode in FallbackModes.modes_str(): parser_get.add_argument( "max_{}_direct_path_distance".format(mode), type=int, hidden=True, help="limit distance of direct path in {}, used ONLY in distributed scenario".format(mode), ) parser_get.add_argument( "walking_speed", type=SpeedRange(), help='Walking speed for the fallback sections.\nSpeed unit must be in meter/second', ) parser_get.add_argument( "bike_speed", type=SpeedRange(), help='Biking speed for the fallback sections.\nSpeed unit must be in meter/second', ) parser_get.add_argument( "bss_speed", type=SpeedRange(), help='Speed while using a bike from a bike sharing system for the ' 'fallback sections.\n' 'Speed unit must be in meter/second', ) parser_get.add_argument( "car_speed", type=SpeedRange(), help='Driving speed for the fallback sections.\nSpeed unit must be in meter/second', ) parser_get.add_argument( "ridesharing_speed", type=SpeedRange(), dest="ridesharing_speed", help='ridesharing speed for the fallback sections.\nSpeed unit must be in meter/second', ) parser_get.add_argument( "car_no_park_speed", type=SpeedRange(), help='Driving speed without car park for the fallback sections.\n' 'Speed unit must be in meter/second', ) parser_get.add_argument( "taxi_speed", type=SpeedRange(), help='taxi speed speed for the fallback sections.\nSpeed unit must be in meter/second', ) parser_get.add_argument( "forbidden_uris[]", type=six.text_type, action="append", help='If you want to avoid lines, modes, networks, etc.\n' 'Note: the forbidden_uris[] concern only the public transport objects. ' 'You can’t for example forbid the use of the bike with them, ' 'you have to set the fallback modes for this ' '(first_section_mode[] and last_section_mode[])', schema_metadata={'format': 'pt-object'}, ) parser_get.add_argument( "allowed_id[]", type=six.text_type, action="append", help='If you want to use only a small subset of ' 'the public transport objects in your solution.\n' 'Note: The constraint intersects with forbidden_uris[]. ' 'For example, if you ask for ' '`allowed_id[]=line:A&forbidden_uris[]=physical_mode:Bus`, ' 'only vehicles of the line A that are not buses will be used.', schema_metadata={'format': 'pt-object'}, ) parser_get.add_argument( "type", type=DescribedOptionValue(types), default="all", deprecated=True, help='DEPRECATED, desired type of journey.', hidden=True, ) parser_get.add_argument( "disruption_active", type=BooleanType(), default=False, deprecated=True, help='DEPRECATED, replaced by `data_freshness`.\n' 'If true the algorithm takes the disruptions into account, ' 'and thus avoid disrupted public transport.\n' 'Nota: `disruption_active=true` <=> `data_freshness=realtime`', ) # no default value for data_freshness because we need to maintain retrocomp with disruption_active parser_get.add_argument( "data_freshness", type=DescribedOptionValue(data_freshnesses), help="Define the freshness of data to use to compute journeys.\n" "When using the following parameter `&data_freshness=base_schedule` " "you can get disrupted journeys in the response. " "You can then display the disruption message to the traveler and " "make a `realtime` request to get a new undisrupted solution.", ) parser_get.add_argument( "max_duration", type=UnsignedInteger(), help='Maximum duration of journeys in seconds (from `datetime` parameter).\n' 'More usefull when computing an isochrone (only `from` or `to` is provided).\n' 'On a classic journey (from-to), it will mostly speedup Navitia: You may have journeys a bit ' 'longer than that value (you would have to filter them).', ) parser_get.add_argument( "wheelchair", type=BooleanType(), default=None, help='If true the traveler is considered to be using a wheelchair, ' 'thus only accessible public transport are used.\n' 'Be warned: many data are currently too faint to provide ' 'acceptable answers with this parameter on.', ) parser_get.add_argument( "traveler_type", type=OptionValue(acceptable_traveler_types), help='Define speeds and accessibility values for different kind of people.\n' 'Each profile also automatically determines appropriate first and ' 'last section modes to the covered area.\n' 'Note: this means that you might get car, bike, etc. fallback routes ' 'even if you set `forbidden_uris[]`!\n' 'You can overload all parameters ' '(especially speeds, distances, first and last modes) by setting ' 'all of them specifically.\n' 'We advise that you don’t rely on the traveler_type’s fallback modes ' '(`first_section_mode[]` and `last_section_mode[]`) ' 'and set them yourself.', ) parser_get.add_argument( "_current_datetime", type=DateTimeFormat(), schema_metadata={'default': 'now'}, hidden=True, default=datetime.utcnow(), help='The datetime considered as "now". Used for debug, default is ' 'the moment of the request. It will mainly change the output ' 'of the disruptions.', ) parser_get.add_argument( "direct_path", type=OptionValue(['indifferent', 'only', 'none', 'only_with_alternatives']), default='indifferent', help="Specify if direct path should be suggested", ) parser_get.add_argument( "free_radius_from", type=int, default=0, help="Radius length (in meters) around the coordinates of departure " "in which the stop points are considered free to go (crowfly=0)", ) parser_get.add_argument( "free_radius_to", type=int, default=0, help="Radius length (in meters) around the coordinates of arrival " "in which the stop points are considered free to go (crowfly=0)", ) parser_get.add_argument( "direct_path_mode[]", type=OptionValue(fallback_modes.all_fallback_modes), default=[], dest="direct_path_mode", action="append", help="Force the direct-path modes." "If this list is not empty, we only compute direct_path for modes in this list" "And filter all the direct_paths of modes in first_section_mode[]", ) parser_get.add_argument( "_stop_points_nearby_duration", type=int, hidden=True, help="define the duration to reach stop points by crow fly", ) parser_get.add_argument( "partner_services[]", type=OptionValue(partner_services.all_partner_services), dest="partner_services", action="append", help='Expose only the partner type into the response.', ) parser_get.add_argument( "_asynchronous_ridesharing", type=BooleanType(), hidden=True, help="active the asynchronous mode for the ridesharing services", ) parser_get.add_argument( "_access_points", type=BooleanType(), hidden=True, help="use/disuse the entrance/exit in journeys computation", ) parser_get.add_argument( "additional_time_after_first_section_taxi", type=int, help="the additional time added to the taxi section, right after riding the taxi but before hopping on the public transit", ) parser_get.add_argument( "additional_time_before_last_section_taxi", type=int, help="the additional time added to the taxi section, right before riding the taxi but after hopping off the public transit", ) parser_get.add_argument( "_pt_planner", type=OptionValue(['kraken', 'loki']), hidden=True, help="choose which pt engine to compute the pt journey", ) # Advanced parameters for valhalla bike parser_get.add_argument( "bike_use_roads", type=FloatRange(0, 1), hidden=True, default=0.5, help="only available for Asgard: A cyclist's propensity to use roads alongside other vehicles.", ) parser_get.add_argument( "bike_use_hills", type=FloatRange(0, 1), hidden=True, default=0.5, help="only available for Asgard: A cyclist's desire to tackle hills in their routes.", ) parser_get.add_argument( "bike_use_ferry", type=FloatRange(0, 1), hidden=True, default=0.5, help="only available for Asgard: This value indicates the willingness to take ferries.", ) parser_get.add_argument( "bike_avoid_bad_surfaces", type=FloatRange(0, 1), hidden=True, default=0.25, help="only available for Asgard: This value is meant to represent how much a cyclist wants to avoid roads with poor surfaces relative to the bicycle type being used.", ) parser_get.add_argument( "bike_shortest", type=BooleanType(), hidden=True, default=False, help="only available for Asgard: Changes the metric to quasi-shortest, i.e. purely distance-based costing.", ) parser_get.add_argument( "bicycle_type", type=OptionValue(BICYCLE_TYPES), hidden=True, default='hybrid', help="only available for Asgard: The type of bicycle.", ) parser_get.add_argument( "bike_use_living_streets", type=FloatRange(0, 1), hidden=True, default=0.5, help="only available for Asgard: This value indicates the willingness to take living streets.", ) parser_get.add_argument( "bike_maneuver_penalty", type=float, hidden=True, default=5, help="only available for Asgard: A penalty applied when transitioning between roads that do not have consistent naming–in other words, no road names in common. This penalty can be used to create simpler routes that tend to have fewer maneuvers or narrative guidance instructions.", ) parser_get.add_argument( "bike_service_penalty", type=float, hidden=True, default=0, help="only available for Asgard: A penalty applied for transition to generic service road. ", ) parser_get.add_argument( "bike_service_factor", type=float, hidden=True, default=1, help="only available for Asgard: A factor that modifies (multiplies) the cost when generic service roads are encountered. ", ) parser_get.add_argument( "bike_country_crossing_cost", type=float, hidden=True, default=600, help="only available for Asgard: A cost applied when encountering an international border. This cost is added to the estimated and elapsed times. ", ) parser_get.add_argument( "bike_country_crossing_penalty", type=float, hidden=True, default=0, help="only available for Asgard: A penalty applied for a country crossing. ", )
def __init__(self): # journeys must have a custom authentication process super(Journeys, self).__init__(output_type_serializer=api.JourneysSerializer) parser_get = self.parsers["get"] parser_get.add_argument("count", type=default_count_arg_type, help='Fixed number of different journeys') parser_get.add_argument("_min_journeys_calls", type=int, hidden=True) parser_get.add_argument("_final_line_filter", type=BooleanType(), hidden=True) parser_get.add_argument( "is_journey_schedules", type=BooleanType(), default=False, help="True when '/journeys' is called to compute" "the same journey schedules and " "it'll override some specific parameters", ) parser_get.add_argument( "min_nb_journeys", type=UnsignedInteger(), help='Minimum number of different suggested journeys, must be >= 0', ) parser_get.add_argument( "max_nb_journeys", type=PositiveInteger(), help='Maximum number of different suggested journeys, must be > 0', ) parser_get.add_argument("_max_extra_second_pass", type=int, dest="max_extra_second_pass", hidden=True) parser_get.add_argument( "debug", type=BooleanType(), default=False, hidden=True, help='Activate debug mode.\nNo journeys are filtered in this mode.', ) parser_get.add_argument( "_filter_odt_journeys", type=BooleanType(), hidden=True, help= 'Filter journeys that uses On Demand Transport if they arrive later/depart earlier than a pure public transport journey.', ) parser_get.add_argument( "show_codes", type=BooleanType(), default=True, hidden=True, deprecated=True, help="DEPRECATED (always True), show more identification codes", ) parser_get.add_argument( "_override_scenario", type=six.text_type, hidden=True, help="debug param to specify a custom scenario", ) parser_get.add_argument("_street_network", type=six.text_type, hidden=True, help="choose the streetnetwork component") parser_get.add_argument("_walking_transfer_penalty", hidden=True, type=int) parser_get.add_argument("_arrival_transfer_penalty", hidden=True, type=int) parser_get.add_argument("_max_successive_physical_mode", hidden=True, type=int) parser_get.add_argument("_max_additional_connections", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_base_factor", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_max_factor", hidden=True, type=float) parser_get.add_argument("_min_car", hidden=True, type=int) parser_get.add_argument("_min_bike", hidden=True, type=int) parser_get.add_argument("_min_taxi", hidden=True, type=int) parser_get.add_argument("_min_ridesharing", hidden=True, type=int) parser_get.add_argument( "bss_stands", type=BooleanType(), default=False, deprecated=True, help="DEPRECATED, Use add_poi_infos[]=bss_stands", ) parser_get.add_argument( "add_poi_infos[]", type=OptionValue(add_poi_infos_types), default=[], dest="add_poi_infos", action="append", help= "Show more information about the poi if it's available, for instance, show " "BSS/car park availability in the pois(BSS/car park) of response", ) parser_get.add_argument( "_no_shared_section", type=BooleanType(), default=False, hidden=True, dest="no_shared_section", help= "Shared section journeys aren't returned as a separate journey", ) parser_get.add_argument( "timeframe_duration", type=int, help="Minimum timeframe to search journeys.\n" "For example 'timeframe_duration=3600' will search for all " "interesting journeys departing within the next hour.\n" "Nota 1: Navitia can return journeys after that timeframe as it's " "actually a minimum.\n" "Nota 2: 'max_nb_journeys' parameter has priority over " "'timeframe_duration' parameter.", ) parser_get.add_argument( "_max_nb_crowfly_by_walking", type=int, hidden=True, help="limit nb of stop points accesible by walking crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_car", type=int, hidden=True, help="limit nb of stop points accesible by car crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_car_nor_park", type=int, hidden=True, help= "limit nb of stop points accesible by car no park crowfly, used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_taxi", type=int, hidden=True, help="limit nb of stop points accesible by taxi crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bike", type=int, hidden=True, help="limit nb of stop points accesible by bike crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bss", type=int, hidden=True, help="limit nb of stop points accesible by bss crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_car_park_duration", type=int, default=default_values.car_park_duration, hidden=True, help="how long it takes to park the car, " "used especially in distributed scenario", ) parser_get.add_argument( "_here_realtime_traffic", type=BooleanType(), default=True, hidden=True, help= "Here, Active or not the realtime traffic information (True/False)", ) parser_get.add_argument( "_here_language", type=OptionValue([ 'afrikaans', 'arabic', 'chinese', 'dutch', 'english', 'french', 'german', 'hebrew', 'hindi', 'italian', 'japanese', 'nepali', 'portuguese', 'russian', 'spanish', ]), hidden=True, help='Here, select a specific language for guidance instruction.\n' 'list available:\n' '- afrikaans = af\n' '- arabic = ar-sa\n' '- chinese = zh-cn\n' '- dutch = nl-nl\n' '- english = en-gb\n' '- french = fr-fr\n' '- german = de-de\n' '- hebrew = he\n' '- hindi = hi\n' '- italian = it-it\n' '- japanese = ja-jp\n' '- nepali = ne-np\n' '- portuguese = pt-pt\n' '- russian = ru-ru\n' '- spanish = es-es\n', ) parser_get.add_argument( "_here_matrix_type", type=six.text_type, hidden=True, help= "Here, street network matrix type (simple_matrix/multi_direct_path)", ) parser_get.add_argument( "_here_max_matrix_points", type=int, default=default_values.here_max_matrix_points, hidden=True, help= "Here, Max number of matrix points for the street network computation (limited to 100)", ) parser_get.add_argument( '_here_exclusion_area[]', type=six.text_type, case_sensitive=False, hidden=True, action='append', dest='_here_exclusion_area[]', help='Give 2 coords for an exclusion box. The format is like that:\n' 'Coord_1!Coord_2 with Coord=lat;lon\n' ' - exemple : _here_exclusion_area[]=2.40553;48.84866!2.41453;48.85677\n' ' - This is a list, you can add to the maximun 20 _here_exclusion_area[]\n', ) parser_get.add_argument( "_asgard_language", type=OptionValue([ 'bulgarian', 'catalan', 'czech', 'danish', 'german', 'greek', 'english_gb', 'english_pirate', 'english_us', 'spanish', 'estonian', 'finnish', 'french', 'hindi', 'hungarian', 'italian', 'japanese', 'bokmal', 'dutch', 'polish', 'portuguese_br', 'portuguese_pt', 'romanian', 'russian', 'slovak', 'slovenian', 'swedish', 'turkish', 'ukrainian', ]), hidden=True, help='Select a specific language for Asgard guidance instruction.\n' 'list available:\n' '- bulgarian = bg-BG\n' '- catalan = ca-ES\n' '- czech = cs-CZ\n' '- danish = da-DK\n' '- german = de-DE\n' '- greek = el-GR\n' '- english_gb = en-GB\n' '- english_pirate = en-US-x-pirate\n' '- english_us = en-US\n' '- spanish = es-ES\n' '- estonian = et-EE\n' '- finnish = fi-FI\n' '- french = fr-FR\n' '- hindi = hi-IN\n' '- hungarian = hu-HU\n' '- italian = it-IT\n' '- japanese = ja-JP\n' '- bokmal = nb-NO\n' '- dutch = nl-NL\n' '- polish = pl-PL\n' '- portuguese_br = pt-BR\n' '- portuguese_pt = pt-PT\n' '- romanian = ro-RO\n' '- russian = ru-RU\n' '- slovak = sk-SK\n' '- slovenian = sl-SI\n' '- swedish = sv-SE\n' '- turkish = tr-TR\n' '- ukrainian = uk-UA\n', ) parser_get.add_argument( "equipment_details", default=True, type=BooleanType(), help="enhance response with accessibility equipement details", ) parser_get.add_argument( "_enable_instructions", type=BooleanType(), default=True, hidden=True, help= "Enable/Disable the narrative instructions for street network sections", ) for mode in FallbackModes.modes_str(): parser_get.add_argument( "max_{}_direct_path_duration".format(mode), type=int, help= "limit duration of direct path in {}, used ONLY in distributed scenario" .format(mode), ) parser_get.add_argument("depth", type=DepthArgument(), default=1, help="The depth of your object") args = self.parsers["get"].parse_args() self.get_decorators.append(complete_links(self)) if handle_poi_infos(args["add_poi_infos"], args["bss_stands"]): self.get_decorators.insert(1, ManageParkingPlaces(self, 'journeys')) parser_get.add_argument( "max_waiting_duration", type=PositiveInteger(), help= 'A journey containing a waiting section with a duration greater or equal to max_waiting_duration ' 'will be discarded. Units : seconds. Must be > 0. Default value : 4h', ) parser_get.add_argument( "bss_rent_duration", type=int, hidden=True, help= "Only used in bss mode, how long it takes to rent a bike from bike share station", ) parser_get.add_argument( "bss_rent_penalty", type=int, hidden=True, help= "Only used in bss mode, how much the maneuver is penalized in the search algorithm", ) parser_get.add_argument( "bss_return_duration", type=int, hidden=True, help= "Only used in bss mode, how long it takes to return a bike to bike share station", ) parser_get.add_argument( "bss_return_penalty", type=int, hidden=True, help= "Only used in bss mode, how much the maneuver is penalized in the search algorithm", ) parser_get.add_argument( "_transfer_path", type=BooleanType(), hidden=True, help= "Compute pathways using the street_network engine for transfers between surface physical modes", ) parser_get.add_argument( "_asgard_max_walking_duration_coeff", type=PositiveFloat(), default=1.12, hidden=True, help= "used to adjust the search range in Asgard when computing matrix", ) parser_get.add_argument( "_asgard_max_bike_duration_coeff", type=PositiveFloat(), default=2.8, hidden=True, help= "used to adjust the search range in Asgard when computing matrix", ) parser_get.add_argument( "_asgard_max_bss_duration_coeff", type=PositiveFloat(), default=0.46, hidden=True, help= "used to adjust the search range in Asgard when computing matrix", ) parser_get.add_argument( "_asgard_max_car_duration_coeff", type=PositiveFloat(), default=1, hidden=True, help= "used to adjust the search range in Asgard when computing matrix", )
def __init__(self): # journeys must have a custom authentication process super(Journeys, self).__init__(output_type_serializer=api.JourneysSerializer) parser_get = self.parsers["get"] parser_get.add_argument("count", type=default_count_arg_type, help='Fixed number of different journeys') parser_get.add_argument("_min_journeys_calls", type=int, hidden=True) parser_get.add_argument("_final_line_filter", type=BooleanType(), hidden=True) parser_get.add_argument( "is_journey_schedules", type=BooleanType(), default=False, help="True when '/journeys' is called to compute" "the same journey schedules and " "it'll override some specific parameters", ) parser_get.add_argument( "min_nb_journeys", type=UnsignedInteger(), help='Minimum number of different suggested journeys, must be >= 0', ) parser_get.add_argument( "max_nb_journeys", type=PositiveInteger(), help='Maximum number of different suggested journeys, must be > 0', ) parser_get.add_argument("_max_extra_second_pass", type=int, dest="max_extra_second_pass", hidden=True) parser_get.add_argument( "debug", type=BooleanType(), default=False, hidden=True, help='Activate debug mode.\n' 'No journeys are filtered in this mode.', ) parser_get.add_argument( "show_codes", type=BooleanType(), default=False, hidden=True, deprecated=True, help="DEPRECATED, show more identification codes", ) parser_get.add_argument( "_override_scenario", type=six.text_type, hidden=True, help="debug param to specify a custom scenario", ) parser_get.add_argument( "_street_network", type=six.text_type, hidden=True, help="choose the streetnetwork component" ) parser_get.add_argument("_walking_transfer_penalty", hidden=True, type=int) parser_get.add_argument("_max_successive_physical_mode", hidden=True, type=int) parser_get.add_argument("_max_additional_connections", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_base_factor", hidden=True, type=int) parser_get.add_argument("_night_bus_filter_max_factor", hidden=True, type=float) parser_get.add_argument("_min_car", hidden=True, type=int) parser_get.add_argument("_min_bike", hidden=True, type=int) parser_get.add_argument("_min_taxi", hidden=True, type=int) parser_get.add_argument("_min_ridesharing", hidden=True, type=int) parser_get.add_argument( "bss_stands", type=BooleanType(), default=False, deprecated=True, help="DEPRECATED, Use add_poi_infos[]=bss_stands", ) parser_get.add_argument( "add_poi_infos[]", type=OptionValue(add_poi_infos_types), default=[], dest="add_poi_infos", action="append", help="Show more information about the poi if it's available, for instance, show " "BSS/car park availability in the pois(BSS/car park) of response", ) parser_get.add_argument( "_no_shared_section", type=BooleanType(), default=False, hidden=True, dest="no_shared_section", help="Shared section journeys aren't returned as a separate journey", ) parser_get.add_argument( "timeframe_duration", type=int, help="Minimum timeframe to search journeys.\n" "For example 'timeframe_duration=3600' will search for all " "interesting journeys departing within the next hour.\n" "Nota 1: Navitia can return journeys after that timeframe as it's " "actually a minimum.\n" "Nota 2: 'max_nb_journeys' parameter has priority over " "'timeframe_duration' parameter.", ) parser_get.add_argument( "_max_nb_crowfly_by_walking", type=int, hidden=True, help="limit nb of stop points accesible by walking crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_car", type=int, hidden=True, help="limit nb of stop points accesible by car crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_car_nor_park", type=int, hidden=True, help="limit nb of stop points accesible by car no park crowfly, used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_taxi", type=int, hidden=True, help="limit nb of stop points accesible by taxi crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bike", type=int, hidden=True, help="limit nb of stop points accesible by bike crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_max_nb_crowfly_by_bss", type=int, hidden=True, help="limit nb of stop points accesible by bss crowfly, " "used especially in distributed scenario", ) parser_get.add_argument( "_car_park_duration", type=int, default=default_values.car_park_duration, hidden=True, help="how long it takes to park the car, " "used especially in distributed scenario", ) parser_get.add_argument( "_here_realtime_traffic", type=BooleanType(), default=True, hidden=True, help="Here, Active or not the realtime traffic information (True/False)", ) parser_get.add_argument( "_here_language", type=OptionValue( [ 'afrikaans', 'arabic', 'chinese', 'dutch', 'english', 'french', 'german', 'hebrew', 'hindi', 'italian', 'japanese', 'nepali', 'portuguese', 'russian', 'spanish', ] ), hidden=True, help='Here, select a specific language for guidance instruction.\n' 'list available:\n' '- afrikaans = af\n' '- arabic = ar-sa\n' '- chinese = zh-cn\n' '- dutch = nl-nl\n' '- english = en-gb\n' '- french = fr-fr\n' '- german = de-de\n' '- hebrew = he\n' '- hindi = hi\n' '- italian = it-it\n' '- japanese = ja-jp\n' '- nepali = ne-np\n' '- portuguese = pt-pt\n' '- russian = ru-ru\n' '- spanish = es-es\n', ) parser_get.add_argument( "_here_matrix_type", type=six.text_type, hidden=True, help="Here, street network matrix type (simple_matrix/multi_direct_path)", ) parser_get.add_argument( "_here_max_matrix_points", type=int, default=default_values.here_max_matrix_points, hidden=True, help="Here, Max number of matrix points for the street network computation (limited to 100)", ) parser_get.add_argument( '_here_exclusion_area[]', type=six.text_type, case_sensitive=False, hidden=True, action='append', dest='_here_exclusion_area[]', help='Give 2 coords for an exclusion box. The format is like that:\n' 'Coord_1!Coord_2 with Coord=lat;lon\n' ' - exemple : _here_exclusion_area[]=2.40553;48.84866!2.41453;48.85677\n' ' - This is a list, you can add to the maximun 20 _here_exclusion_area[]\n', ) parser_get.add_argument( "equipment_details", default=True, type=BooleanType(), help="enhance response with accessibility equipement details", ) parser_get.add_argument( "_enable_instructions", type=BooleanType(), default=True, hidden=True, help="Enable/Disable the narrative instructions for street network sections", ) for mode in FallbackModes.modes_str(): parser_get.add_argument( "max_{}_direct_path_duration".format(mode), type=int, help="limit duration of direct path in {}, used ONLY in distributed scenario".format(mode), ) parser_get.add_argument("depth", type=DepthArgument(), default=1, help="The depth of your object") args = self.parsers["get"].parse_args() self.get_decorators.append(complete_links(self)) if handle_poi_infos(args["add_poi_infos"], args["bss_stands"]): self.get_decorators.insert(1, ManageParkingPlaces(self, 'journeys'))