mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-23 05:35:13 +03:00
mypy: minimal annotations to enable a clean run
This commit is contained in:
parent
b1903f0fbf
commit
9b636fdc10
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.
|
||||
"""
|
||||
from typing import Dict, Any
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
@ -18,7 +19,7 @@ from dotenv import dotenv_values
|
||||
from nominatim.errors import UsageError
|
||||
|
||||
LOG = logging.getLogger()
|
||||
CONFIG_CACHE = {}
|
||||
CONFIG_CACHE : Dict[str, Any] = {}
|
||||
|
||||
def flatten_config_list(content, section=''):
|
||||
""" Flatten YAML configuration lists that contain include sections
|
||||
|
@ -7,6 +7,7 @@
|
||||
"""
|
||||
Functions for database migration to newer software versions.
|
||||
"""
|
||||
from typing import List, Tuple, Callable
|
||||
import logging
|
||||
|
||||
from psycopg2 import sql as pysql
|
||||
@ -20,7 +21,7 @@ from nominatim.errors import UsageError
|
||||
|
||||
LOG = logging.getLogger()
|
||||
|
||||
_MIGRATION_FUNCTIONS = []
|
||||
_MIGRATION_FUNCTIONS : List[Tuple[str, Callable]] = []
|
||||
|
||||
def migrate(config, paths):
|
||||
""" Check for the current database version and execute migrations,
|
||||
|
@ -21,8 +21,8 @@ try:
|
||||
from osmium.replication.server import ReplicationServer
|
||||
from osmium import WriteHandler
|
||||
except ImportError as exc:
|
||||
logging.getLogger().fatal("pyosmium not installed. Replication functions not available.\n"
|
||||
"To install pyosmium via pip: pip3 install osmium")
|
||||
logging.getLogger().critical("pyosmium not installed. Replication functions not available.\n"
|
||||
"To install pyosmium via pip: pip3 install osmium")
|
||||
raise UsageError("replication tools not available") from exc
|
||||
|
||||
LOG = logging.getLogger()
|
||||
|
@ -33,7 +33,7 @@ class SPImporter():
|
||||
|
||||
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.db_connection = db_connection
|
||||
self.sp_loader = sp_loader
|
||||
|
Loading…
Reference in New Issue
Block a user