"""
Implementation of classes for API access via libraries.
"""
-from typing import Mapping, Optional, TypeVar, Callable, Any
-import functools
+from typing import Mapping, Optional
import asyncio
from pathlib import Path
from sqlalchemy.engine.url import URL
from sqlalchemy.ext.asyncio import create_async_engine
-from nominatim.typing import StrPath
from nominatim.config import Configuration
from nominatim.apicmd.status import get_status, StatusResult
future=True)
+ async def close(self) -> None:
+ """ Close all active connections to the database. The NominatimAPIAsync
+ object remains usable after closing. If a new API functions is
+ called, new connections are created.
+ """
+ await self.engine.dispose()
+
+
async def status(self) -> StatusResult:
""" Return the status of the database.
"""
self.async_api = NominatimAPIAsync(project_dir, environ)
+ def close(self) -> None:
+ """ Close all active connections to the database. The NominatimAPIAsync
+ object remains usable after closing. If a new API functions is
+ called, new connections are created.
+ """
+ asyncio.get_event_loop().run_until_complete(self.async_api.close())
+
+
def status(self) -> StatusResult:
+ """ Return the status of the database.
+ """
return asyncio.get_event_loop().run_until_complete(self.async_api.status())