Merge pull request #2275 from lonvia/switch-to-absolute-imports

Use absolute imports in Python code
This commit is contained in:
Sarah Hoffmann 2021-04-16 15:04:10 +02:00 committed by GitHub
commit a632b9f86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 67 additions and 67 deletions

View File

@ -8,12 +8,12 @@ import sys
import argparse
from pathlib import Path
from .config import Configuration
from .tools.exec_utils import run_legacy_script, run_php_server
from .errors import UsageError
from . import clicmd
from .clicmd.args import NominatimArgs
from .tools import tiger_data
from nominatim.config import Configuration
from nominatim.tools.exec_utils import run_legacy_script, run_php_server
from nominatim.errors import UsageError
from nominatim import clicmd
from nominatim.clicmd.args import NominatimArgs
from nominatim.tools import tiger_data
LOG = logging.getLogger()

View File

@ -2,12 +2,12 @@
Subcommand definitions for the command-line tool.
"""
from .setup import SetupAll
from .replication import UpdateReplication
from .api import APISearch, APIReverse, APILookup, APIDetails, APIStatus
from .index import UpdateIndex
from .refresh import UpdateRefresh
from .admin import AdminFuncs
from .freeze import SetupFreeze
from .transition import AdminTransition
from .special_phrases import ImportSpecialPhrases
from nominatim.clicmd.setup import SetupAll
from nominatim.clicmd.replication import UpdateReplication
from nominatim.clicmd.api import APISearch, APIReverse, APILookup, APIDetails, APIStatus
from nominatim.clicmd.index import UpdateIndex
from nominatim.clicmd.refresh import UpdateRefresh
from nominatim.clicmd.admin import AdminFuncs
from nominatim.clicmd.freeze import SetupFreeze
from nominatim.clicmd.transition import AdminTransition
from nominatim.clicmd.special_phrases import ImportSpecialPhrases

View File

@ -3,8 +3,8 @@ Implementation of the 'admin' subcommand.
"""
import logging
from ..tools.exec_utils import run_legacy_script
from ..db.connection import connect
from nominatim.tools.exec_utils import run_legacy_script
from nominatim.db.connection import connect
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -3,7 +3,7 @@ Subcommand definitions for API calls from the command line.
"""
import logging
from ..tools.exec_utils import run_api_script
from nominatim.tools.exec_utils import run_api_script
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -2,7 +2,7 @@
Implementation of the 'freeze' subcommand.
"""
from ..db.connection import connect
from nominatim.db.connection import connect
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -3,8 +3,8 @@ Implementation of the 'index' subcommand.
"""
import psutil
from ..db import status
from ..db.connection import connect
from nominatim.db import status
from nominatim.db.connection import connect
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -4,7 +4,7 @@ Implementation of 'refresh' subcommand.
import logging
from pathlib import Path
from ..db.connection import connect
from nominatim.db.connection import connect
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -6,9 +6,9 @@ import logging
import socket
import time
from ..db import status
from ..db.connection import connect
from ..errors import UsageError
from nominatim.db import status
from nominatim.db.connection import connect
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -6,11 +6,11 @@ from pathlib import Path
import psutil
from ..tools.exec_utils import run_legacy_script
from ..db.connection import connect
from ..db import status, properties
from ..version import NOMINATIM_VERSION
from ..errors import UsageError
from nominatim.tools.exec_utils import run_legacy_script
from nominatim.db.connection import connect
from nominatim.db import status, properties
from nominatim.version import NOMINATIM_VERSION
from nominatim.errors import UsageError
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -8,9 +8,9 @@ This module will be removed as soon as the transition phase is over.
import logging
from pathlib import Path
from ..db.connection import connect
from ..db import status
from ..errors import UsageError
from nominatim.db.connection import connect
from nominatim.db import status
from nominatim.errors import UsageError
# Do not repeat documentation of subcommand classes.
# pylint: disable=C0111

View File

@ -7,7 +7,7 @@ from pathlib import Path
from dotenv import dotenv_values
from .errors import UsageError
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -9,7 +9,7 @@ import psycopg2
import psycopg2.extensions
import psycopg2.extras
from ..errors import UsageError
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -5,8 +5,8 @@ import datetime as dt
import logging
import re
from ..tools.exec_utils import get_url
from ..errors import UsageError
from nominatim.tools.exec_utils import get_url
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -5,8 +5,8 @@ import subprocess
import logging
import gzip
from .connection import get_pg_env
from ..errors import UsageError
from nominatim.db.connection import get_pg_env
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -7,8 +7,8 @@ import select
import psycopg2
from .progress import ProgressLogger
from ..db.async_connection import DBConnection
from nominatim.indexer.progress import ProgressLogger
from nominatim.db.async_connection import DBConnection
LOG = logging.getLogger()

View File

@ -3,7 +3,7 @@ Functions for database analysis and maintenance.
"""
import logging
from ..errors import UsageError
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -6,8 +6,8 @@ from textwrap import dedent
import psycopg2
from ..db.connection import connect
from ..errors import UsageError
from nominatim.db.connection import connect
from nominatim.errors import UsageError
CHECKLIST = []

View File

@ -11,13 +11,13 @@ from pathlib import Path
import psutil
import psycopg2
from ..db.connection import connect, get_pg_env
from ..db import utils as db_utils
from ..db.async_connection import DBConnection
from ..db.sql_preprocessor import SQLPreprocessor
from .exec_utils import run_osm2pgsql
from ..errors import UsageError
from ..version import POSTGRESQL_REQUIRED_VERSION, POSTGIS_REQUIRED_VERSION
from nominatim.db.connection import connect, get_pg_env
from nominatim.db import utils as db_utils
from nominatim.db.async_connection import DBConnection
from nominatim.db.sql_preprocessor import SQLPreprocessor
from nominatim.tools.exec_utils import run_osm2pgsql
from nominatim.errors import UsageError
from nominatim.version import POSTGRESQL_REQUIRED_VERSION, POSTGIS_REQUIRED_VERSION
LOG = logging.getLogger()

View File

@ -6,8 +6,8 @@ import subprocess
import urllib.request as urlrequest
from urllib.parse import urlencode
from ..version import NOMINATIM_VERSION
from ..db.connection import get_pg_env
from nominatim.version import NOMINATIM_VERSION
from nominatim.db.connection import get_pg_env
LOG = logging.getLogger()

View File

@ -3,11 +3,11 @@ Functions for database migration to newer software versions.
"""
import logging
from ..db import properties
from ..db.connection import connect
from ..version import NOMINATIM_VERSION
from . import refresh, database_import
from ..errors import UsageError
from nominatim.db import properties
from nominatim.db.connection import connect
from nominatim.version import NOMINATIM_VERSION
from nominatim.tools import refresh, database_import
from nominatim.errors import UsageError
LOG = logging.getLogger()

View File

@ -7,9 +7,9 @@ from textwrap import dedent
from psycopg2.extras import execute_values
from ..db.utils import execute_file
from ..db.sql_preprocessor import SQLPreprocessor
from ..version import NOMINATIM_VERSION
from nominatim.db.utils import execute_file
from nominatim.db.sql_preprocessor import SQLPreprocessor
from nominatim.version import NOMINATIM_VERSION
LOG = logging.getLogger()

View File

@ -6,9 +6,9 @@ from enum import Enum
import logging
import time
from ..db import status
from .exec_utils import run_osm2pgsql
from ..errors import UsageError
from nominatim.db import status
from nominatim.tools.exec_utils import run_osm2pgsql
from nominatim.errors import UsageError
try:
from osmium.replication.server import ReplicationServer

View File

@ -6,9 +6,9 @@ import os
import tarfile
import selectors
from ..db.connection import connect
from ..db.async_connection import DBConnection
from ..db.sql_preprocessor import SQLPreprocessor
from nominatim.db.connection import connect
from nominatim.db.async_connection import DBConnection
from nominatim.db.sql_preprocessor import SQLPreprocessor
LOG = logging.getLogger()