Exemple #1
0
        def __init__(self):
            Uri.__init__(self,
                         is_collection,
                         "pois",
                         output_type_serializer=api.PoisSerializer)
            self.collections = get_collections(self.collection)
            self.get_decorators.insert(1, get_obj_serializer(self))
            self.parsers["get"].add_argument(
                "original_id",
                type=six.text_type,
                help="original uri of the object you want to query")
            self.parsers["get"].add_argument(
                "bss_stands",
                type=BooleanType(),
                default=True,
                help="Show bss stands availability")
            self.parsers["get"].add_argument(
                "add_poi_infos[]",
                type=OptionValue(add_poi_infos_types),
                default=['bss_stands', 'car_park'],
                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")

            args = self.parsers["get"].parse_args()
            if args["add_poi_infos"] or args["bss_stands"]:
                self.get_decorators.insert(2,
                                           ManageParkingPlaces(self, 'pois'))
Exemple #2
0
    def __init__(self, **kwargs):
        ResourceUri.__init__(self, authentication=False, **kwargs)
        self.parsers["get"].add_argument("bss_stands",
                                         type=BooleanType(),
                                         default=True,
                                         help="Show bss stands availability")
        self.parsers["get"].add_argument(
            "add_poi_infos[]",
            type=OptionValue(add_poi_infos_types),
            default=['bss_stands', 'car_park'],
            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"
        )
        self.parsers['get'].add_argument(
            "disable_geojson",
            type=BooleanType(),
            default=False,
            help="remove geojson from the response")
        args = self.parsers["get"].parse_args()

        if args["add_poi_infos"] or args["bss_stands"]:
            self.get_decorators.insert(1, ManageParkingPlaces(self, 'places'))

        if args['disable_geojson']:
            g.disable_geojson = True

        self.parsers['get'].add_argument(
            "_autocomplete",
            type=six.text_type,
            hidden=True,
            help="name of the autocomplete service, used under the hood")
Exemple #3
0
 def __init__(self, *args, **kwargs):
     ResourceUri.__init__(self, output_type_serializer=PlacesNearbySerializer, *args, **kwargs)
     self.parsers["get"].add_argument("type[]", type=OptionValue(list(places_type.keys())),
                                      action="append",
                                      default=["stop_area", "stop_point", "poi"],
                                      help="Type of the objects to return")
     self.parsers["get"].add_argument("filter", type=six.text_type, default="",
                                      help="Filter your objects")
     self.parsers["get"].add_argument("distance", type=int, default=500,
                                      help="Distance range of the query in meters")
     self.parsers["get"].add_argument("count", type=default_count_arg_type, default=10,
                                      help="Elements per page")
     self.parsers["get"].add_argument("depth", type=depth_argument, default=1,
                                      help="Maximum depth on objects")
     self.parsers["get"].add_argument("start_page", type=int, default=0,
                                      help="The page number of the ptref result")
     self.parsers["get"].add_argument("bss_stands", type=BooleanType(), default=False, deprecated=True,
                                      help="DEPRECATED, Use add_poi_infos[]=bss_stands")
     self.parsers["get"].add_argument("add_poi_infos[]", type=OptionValue(add_poi_infos_types),
                                      default=['bss_stands', 'car_park'],
                                      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 the response")
     self.parsers["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.')
     self.parsers['get'].add_argument("disable_geojson", type=BooleanType(), default=False,
                                      help="remove geojson from the response")
     args = self.parsers["get"].parse_args()
     if handle_poi_infos(args["add_poi_infos"], args["bss_stands"]):
         self.get_decorators.insert(1, ManageParkingPlaces(self, 'places_nearby'))
Exemple #4
0
    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=int,
                                help='Minimum number of different suggested journeys')
        parser_get.add_argument("max_nb_journeys", type=int,
                                help='Maximum number of different suggested journeys')
        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="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("bss_stands", type=BooleanType(), default=False,
                                help="Show bss stands availability "
                                     "in the bicycle_rental pois of response")
        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")

        self.get_decorators.append(complete_links(self))

        if parser_get.parse_args().get("add_poi_infos") or parser_get.parse_args().get("bss_stands"):
            self.get_decorators.insert(1, ManageParkingPlaces(self, 'journeys'))
Exemple #5
0
    def __init__(self, *args, **kwargs):
        ResourceUri.__init__(self,
                             authentication=False,
                             output_type_serializer=PlacesSerializer,
                             *args,
                             **kwargs)
        self.parsers["get"].add_argument(
            "bss_stands",
            type=BooleanType(),
            default=False,
            deprecated=True,
            help="DEPRECATED, Use add_poi_infos[]=bss_stands",
        )
        self.parsers["get"].add_argument(
            "add_poi_infos[]",
            type=OptionValue(add_poi_infos_types),
            default=['bss_stands', 'car_park'],
            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 the response",
        )
        self.parsers['get'].add_argument(
            "disable_geojson",
            type=BooleanType(),
            default=False,
            help="remove geojson from the response")
        self.parsers['get'].add_argument(
            "disable_disruption",
            type=BooleanType(),
            default=False,
            help="remove disruptions from the response")
        args = self.parsers["get"].parse_args()

        if handle_poi_infos(args["add_poi_infos"], args["bss_stands"]):
            self.get_decorators.insert(1, ManageParkingPlaces(self, 'places'))

        if args['disable_geojson']:
            g.disable_geojson = True

        self.parsers['get'].add_argument(
            "_autocomplete",
            type=six.text_type,
            hidden=True,
            choices=['kraken', 'bragi', 'bragi7'],
            help="name of the autocomplete service, used under the hood",
        )
Exemple #6
0
        def __init__(self):
            Uri.__init__(self,
                         is_collection,
                         "pois",
                         output_type_serializer=api.PoisSerializer)
            self.collections = [
                ("pois", NonNullList(fields.Nested(poi, display_null=False))),
                ("pagination", PbField(pagination)), ("error", PbField(error)),
                ("disruptions",
                 fields.List(NonNullNested(disruption_marshaller),
                             attribute="impacts")),
                ("feed_publishers",
                 NonNullList(fields.Nested(feed_publisher,
                                           display_null=False)))
            ]
            self.get_decorators.insert(1, get_obj_serializer(self))
            self.parsers["get"].add_argument(
                "original_id",
                type=six.text_type,
                help="original uri of the object you want to query")
            self.parsers["get"].add_argument(
                "bss_stands",
                type=BooleanType(),
                default=True,
                help="Show bss stands availability")
            self.parsers["get"].add_argument(
                "add_poi_infos[]",
                type=OptionValue(add_poi_infos_types),
                default=['bss_stands', 'car_park'],
                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")

            args = self.parsers["get"].parse_args()
            if args["add_poi_infos"] or args["bss_stands"]:
                self.get_decorators.insert(2,
                                           ManageParkingPlaces(self, 'pois'))
Exemple #7
0
    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'))
Exemple #8
0
    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",
        )
Exemple #9
0
    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'))