mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-22 12:06:27 +03:00
fix linting issues
This commit is contained in:
parent
2bab0ca060
commit
63da70685a
6
Makefile
6
Makefile
@ -18,13 +18,13 @@ build-api:
|
||||
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
|
||||
|
@ -13,9 +13,9 @@ import dataclasses
|
||||
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
|
||||
|
@ -14,7 +14,7 @@ import dataclasses
|
||||
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:
|
||||
@ -24,7 +24,7 @@ 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:
|
||||
|
@ -8,6 +8,10 @@
|
||||
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'
|
||||
|
@ -12,7 +12,9 @@ import argparse
|
||||
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
|
||||
@ -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:
|
||||
|
@ -10,7 +10,6 @@ Provides custom functions over command-line arguments.
|
||||
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
|
||||
|
@ -9,7 +9,11 @@ Version information for Nominatim.
|
||||
"""
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user