mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
modify import paths to helpers.py
This commit is contained in:
@@ -19,7 +19,7 @@ from ..localization import Locales
|
|||||||
from ..result_formatting import FormatDispatcher
|
from ..result_formatting import FormatDispatcher
|
||||||
from .classtypes import ICONS
|
from .classtypes import ICONS
|
||||||
from . import format_json, format_xml
|
from . import format_json, format_xml
|
||||||
from .format_json import _add_admin_level
|
from .helpers import _add_admin_level
|
||||||
from .. import logging as loglib
|
from .. import logging as loglib
|
||||||
from ..server import content_types as ct
|
from ..server import content_types as ct
|
||||||
|
|
||||||
|
|||||||
@@ -7,22 +7,15 @@
|
|||||||
"""
|
"""
|
||||||
Helper functions for output of results in json formats.
|
Helper functions for output of results in json formats.
|
||||||
"""
|
"""
|
||||||
from typing import Mapping, Any, Optional, Tuple, Dict, Union, List
|
from typing import Mapping, Any, Optional, Tuple, Union, List
|
||||||
|
|
||||||
from ..utils.json_writer import JsonWriter
|
from ..utils.json_writer import JsonWriter
|
||||||
from ..results import AddressLines, ReverseResults, SearchResults, BaseResult
|
from ..results import AddressLines, ReverseResults, SearchResults
|
||||||
from . import classtypes as cl
|
from . import classtypes as cl
|
||||||
|
from .helpers import _add_admin_level
|
||||||
from ..types import EntranceDetails
|
from ..types import EntranceDetails
|
||||||
|
|
||||||
|
|
||||||
def _add_admin_level(result: BaseResult) -> Optional[Dict[str, str]]:
|
|
||||||
tags = result.extratags
|
|
||||||
if result.category == ('boundary', 'administrative') and result.admin_level < 15:
|
|
||||||
tags = dict(tags) if tags else {}
|
|
||||||
tags['admin_level'] = str(result.admin_level)
|
|
||||||
return tags
|
|
||||||
|
|
||||||
|
|
||||||
def _write_osm_id(out: JsonWriter, osm_object: Optional[Tuple[str, int]]) -> None:
|
def _write_osm_id(out: JsonWriter, osm_object: Optional[Tuple[str, int]]) -> None:
|
||||||
if osm_object is not None:
|
if osm_object is not None:
|
||||||
out.keyval_not_none('osm_type', cl.OSM_TYPE_NAME.get(osm_object[0], None))\
|
out.keyval_not_none('osm_type', cl.OSM_TYPE_NAME.get(osm_object[0], None))\
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import xml.etree.ElementTree as ET
|
|||||||
from ..results import AddressLines, ReverseResult, ReverseResults, \
|
from ..results import AddressLines, ReverseResult, ReverseResults, \
|
||||||
SearchResult, SearchResults
|
SearchResult, SearchResults
|
||||||
from . import classtypes as cl
|
from . import classtypes as cl
|
||||||
from .format_json import _add_admin_level
|
from .helpers import _add_admin_level
|
||||||
from ..types import EntranceDetails
|
from ..types import EntranceDetails
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user