tests: mypy lint pytest
mypy:
- python3 -m mypy --strict src
+ mypy --strict src
pytest:
- python3 -m pytest test/python
+ pytest test/python
lint:
- python3 -m pylint src
+ pylint src
bdd:
cd test/bdd; behave -DREMOVE_TEMPLATE=1
import sqlalchemy as sa
from nominatim_core.typing import SaFromClause, SaColumn, SaExpression
+from nominatim_core.utils.json_writer import JsonWriter
from .query import Token
from . import db_search_lookups as lookups
-from nominatim_core.utils.json_writer import JsonWriter
@dataclasses.dataclass
import sqlalchemy as sa
from .connection import SearchConnection
-from .version import NOMINATIM_API_VERSION, parse_version
+from .version import NOMINATIM_API_VERSION, NominatimVersion, parse_version
@dataclasses.dataclass
class StatusResult:
message: str
software_version = NOMINATIM_API_VERSION
data_updated: Optional[dt.datetime] = None
- database_version: Optional[str] = None
+ database_version: Optional[NominatimVersion] = None
async def get_status(conn: SearchConnection) -> StatusResult:
Version information for the Nominatim API.
"""
-from nominatim_core.version import NominatimVersion, parse_version
+# See also https://github.com/PyCQA/pylint/issues/6006
+# pylint: disable=useless-import-alias,unused-import
+
+from nominatim_core.version import (NominatimVersion as NominatimVersion,
+ parse_version as parse_version)
NOMINATIM_API_VERSION = '4.4.99'
import logging
import json
import sys
+from functools import reduce
+from nominatim_core.errors import UsageError
import nominatim_api as napi
import nominatim_api.v1 as api_output
from nominatim_api.v1.helpers import zoom_to_rank, deduplicate_results
"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.
"""
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:
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:
from typing import Optional, List, Dict, Any, Sequence, Tuple
import argparse
import logging
-from functools import reduce
from pathlib import Path
from nominatim_core.errors import UsageError
"""
from typing import Optional
-from nominatim_core.version import NominatimVersion, parse_version
+# See also https://github.com/PyCQA/pylint/issues/6006
+# pylint: disable=useless-import-alias,unused-import
+
+from nominatim_core.version import (NominatimVersion as NominatimVersion,
+ parse_version as parse_version)
NOMINATIM_VERSION = NominatimVersion(4, 4, 99, 1)