mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
mypy: minimal annotations to enable a clean run
This commit is contained in:
16
.mypy.ini
Normal file
16
.mypy.ini
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[mypy]
|
||||||
|
|
||||||
|
[mypy-icu.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-psycopg2.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-psutil]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-osmium.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-datrie.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
"""
|
"""
|
||||||
Nominatim configuration accessor.
|
Nominatim configuration accessor.
|
||||||
"""
|
"""
|
||||||
|
from typing import Dict, Any
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -18,7 +19,7 @@ from dotenv import dotenv_values
|
|||||||
from nominatim.errors import UsageError
|
from nominatim.errors import UsageError
|
||||||
|
|
||||||
LOG = logging.getLogger()
|
LOG = logging.getLogger()
|
||||||
CONFIG_CACHE = {}
|
CONFIG_CACHE : Dict[str, Any] = {}
|
||||||
|
|
||||||
def flatten_config_list(content, section=''):
|
def flatten_config_list(content, section=''):
|
||||||
""" Flatten YAML configuration lists that contain include sections
|
""" Flatten YAML configuration lists that contain include sections
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
"""
|
"""
|
||||||
Functions for database migration to newer software versions.
|
Functions for database migration to newer software versions.
|
||||||
"""
|
"""
|
||||||
|
from typing import List, Tuple, Callable
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from psycopg2 import sql as pysql
|
from psycopg2 import sql as pysql
|
||||||
@@ -20,7 +21,7 @@ from nominatim.errors import UsageError
|
|||||||
|
|
||||||
LOG = logging.getLogger()
|
LOG = logging.getLogger()
|
||||||
|
|
||||||
_MIGRATION_FUNCTIONS = []
|
_MIGRATION_FUNCTIONS : List[Tuple[str, Callable]] = []
|
||||||
|
|
||||||
def migrate(config, paths):
|
def migrate(config, paths):
|
||||||
""" Check for the current database version and execute migrations,
|
""" Check for the current database version and execute migrations,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ try:
|
|||||||
from osmium.replication.server import ReplicationServer
|
from osmium.replication.server import ReplicationServer
|
||||||
from osmium import WriteHandler
|
from osmium import WriteHandler
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
logging.getLogger().fatal("pyosmium not installed. Replication functions not available.\n"
|
logging.getLogger().critical("pyosmium not installed. Replication functions not available.\n"
|
||||||
"To install pyosmium via pip: pip3 install osmium")
|
"To install pyosmium via pip: pip3 install osmium")
|
||||||
raise UsageError("replication tools not available") from exc
|
raise UsageError("replication tools not available") from exc
|
||||||
|
|
||||||
LOG = logging.getLogger()
|
LOG = logging.getLogger()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class SPImporter():
|
|||||||
|
|
||||||
Take a sp loader which load the phrases from an external source.
|
Take a sp loader which load the phrases from an external source.
|
||||||
"""
|
"""
|
||||||
def __init__(self, config, db_connection, sp_loader) -> None:
|
def __init__(self, config, db_connection, sp_loader):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.db_connection = db_connection
|
self.db_connection = db_connection
|
||||||
self.sp_loader = sp_loader
|
self.sp_loader = sp_loader
|
||||||
|
|||||||
Reference in New Issue
Block a user