define type for enivronment dictionaries

This commit is contained in:
Sarah Hoffmann
2022-07-03 17:38:11 +02:00
parent f12fe54d2b
commit c4928c646d
3 changed files with 9 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
"""
Specialised connection and cursor functions.
"""
from typing import List, Optional, Any, Callable, ContextManager, Dict, Mapping, cast, overload, Tuple
from typing import List, Optional, Any, Callable, ContextManager, Dict, cast, overload, Tuple
import contextlib
import logging
import os
@@ -17,7 +17,7 @@ import psycopg2.extensions
import psycopg2.extras
from psycopg2 import sql as pysql
from nominatim.typing import Query, T_cursor
from nominatim.typing import SysEnv, Query, T_cursor
from nominatim.errors import UsageError
LOG = logging.getLogger()
@@ -225,7 +225,7 @@ _PG_CONNECTION_STRINGS = {
def get_pg_env(dsn: str,
base_env: Optional[Mapping[str, str]] = None) -> Dict[str, str]:
base_env: Optional[SysEnv] = None) -> Dict[str, str]:
""" Return a copy of `base_env` with the environment variables for
PostgresSQL set up from the given database connection string.
If `base_env` is None, then the OS environment is used as a base