X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2bab0ca060ff224091b20a0ac808a3febaba04b1..e3353deee028209447b46b107af27100f74ffc45:/src/nominatim_db/clicmd/api.py diff --git a/src/nominatim_db/clicmd/api.py b/src/nominatim_db/clicmd/api.py index 0f0d1ebd..fac88bdd 100644 --- a/src/nominatim_db/clicmd/api.py +++ b/src/nominatim_db/clicmd/api.py @@ -12,12 +12,14 @@ import argparse import logging import json import sys +from functools import reduce import nominatim_api as napi import nominatim_api.v1 as api_output from nominatim_api.v1.helpers import zoom_to_rank, deduplicate_results from nominatim_api.v1.format import dispatch as formatting import nominatim_api.logging as loglib +from ..errors import UsageError from .args import NominatimArgs # Do not repeat documentation of subcommand classes. @@ -61,7 +63,7 @@ def _add_api_output_arguments(parser: argparse.ArgumentParser) -> None: "Parameter is difference tolerance in degrees.")) -def _get_geometry_output(args) -> napi.GeometryFormat: +def _get_geometry_output(args: NominatimArgs) -> napi.GeometryFormat: """ Get the requested geometry output format in a API-compatible format. """ @@ -82,7 +84,7 @@ def _get_geometry_output(args) -> napi.GeometryFormat: raise UsageError(f"Unknown polygon output format '{args.polygon_output}'.") from exp -def _get_locales(args, default: Optional[str]) -> napi.Locales: +def _get_locales(args: NominatimArgs, default: Optional[str]) -> napi.Locales: """ Get the locales from the language parameter. """ if args.lang: @@ -93,7 +95,7 @@ def _get_locales(args, default: Optional[str]) -> napi.Locales: return napi.Locales() -def _get_layers(args, default: napi.DataLayer) -> Optional[napi.DataLayer]: +def _get_layers(args: NominatimArgs, default: napi.DataLayer) -> Optional[napi.DataLayer]: """ Get the list of selected layers as a DataLayer enum. """ if not args.layers: