forked from organicmaps/organicmaps
[generator][python] Refactored imports.
This commit is contained in:
parent
349dea385d
commit
341abdc9f2
22 changed files with 110 additions and 108 deletions
|
@ -6,9 +6,9 @@ import sys
|
|||
|
||||
from tqdm import tqdm
|
||||
|
||||
from .api.booking_api import LIMIT_REQUESTS_PER_MINUTE
|
||||
from .download_hotels import download
|
||||
from .download_test_data import download_test_data
|
||||
from booking.api.booking_api import LIMIT_REQUESTS_PER_MINUTE
|
||||
from booking.download_hotels import download
|
||||
from booking.download_test_data import download_test_data
|
||||
|
||||
|
||||
def process_options():
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import logging
|
||||
import statistics
|
||||
from collections import defaultdict
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from concurrent.futures import as_completed
|
||||
from functools import partial
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
||||
|
@ -9,8 +10,9 @@ import math
|
|||
from eviltransform import gcj2wgs_exact
|
||||
from tqdm import tqdm
|
||||
|
||||
from .api.booking_api import BookingApi, BookingListApi
|
||||
from .api.exceptions import GettingMinPriceError
|
||||
from booking.api.booking_api import BookingApi
|
||||
from booking.api.booking_api import BookingListApi
|
||||
from booking.api.exceptions import GettingMinPriceError
|
||||
|
||||
SUPPORTED_LANGUAGES = ("en", "ru", "ar", "cs", "da", "nl", "fi", "fr", "de",
|
||||
"hu", "id", "it", "ja", "ko", "pl", "pt", "ro", "es",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import logging
|
||||
import statistics
|
||||
from functools import partial
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
||||
import math
|
||||
from tqdm import tqdm
|
||||
|
||||
from .api.booking_api import BookingApi, BookingListApi
|
||||
from booking.api.booking_api import BookingApi, BookingListApi
|
||||
|
||||
SUPPORTED_LANGUAGES = ("en", "ru")
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@ import os
|
|||
|
||||
import wikipediaapi
|
||||
|
||||
from .descriptions_downloader import (log, check_and_get_checker,
|
||||
download_from_wikipedia_tags,
|
||||
download_from_wikidata_tags)
|
||||
from descriptions.descriptions_downloader import check_and_get_checker
|
||||
from descriptions.descriptions_downloader import download_from_wikidata_tags
|
||||
from descriptions.descriptions_downloader import download_from_wikipedia_tags
|
||||
from descriptions.descriptions_downloader import log
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
|
|
@ -15,7 +15,8 @@ import wikipediaapi
|
|||
from bs4 import BeautifulSoup
|
||||
from wikidata.client import Client
|
||||
|
||||
from .exceptions import GettingError, ParseError
|
||||
from descriptions.exceptions import GettingError
|
||||
from descriptions.exceptions import ParseError
|
||||
|
||||
"""
|
||||
This script downloads Wikipedia pages for different languages.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
|
||||
from .generator import settings
|
||||
from maps_generator.generator import settings
|
||||
|
||||
CONFIG_PATH = os.path.join(
|
||||
os.path.dirname(os.path.join(os.path.realpath(__file__))),
|
||||
|
|
|
@ -3,20 +3,20 @@ import os
|
|||
from argparse import ArgumentParser
|
||||
from argparse import RawDescriptionHelpFormatter
|
||||
|
||||
from .generator import settings
|
||||
from .generator import stages
|
||||
from .generator import stages_declaration as sd
|
||||
from .generator.env import Env
|
||||
from .generator.env import PathProvider
|
||||
from .generator.env import WORLDS_NAMES
|
||||
from .generator.env import find_last_build_dir
|
||||
from .generator.env import get_all_countries_list
|
||||
from .generator.exceptions import ContinueError
|
||||
from .generator.exceptions import SkipError
|
||||
from .generator.exceptions import ValidationError
|
||||
from .maps_generator import generate_coasts
|
||||
from .maps_generator import generate_maps
|
||||
from .utils.algo import unique
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator import stages
|
||||
from maps_generator.generator import stages_declaration as sd
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.env import PathProvider
|
||||
from maps_generator.generator.env import WORLDS_NAMES
|
||||
from maps_generator.generator.env import find_last_build_dir
|
||||
from maps_generator.generator.env import get_all_countries_list
|
||||
from maps_generator.generator.exceptions import ContinueError
|
||||
from maps_generator.generator.exceptions import SkipError
|
||||
from maps_generator.generator.exceptions import ValidationError
|
||||
from maps_generator.maps_generator import generate_coasts
|
||||
from maps_generator.maps_generator import generate_maps
|
||||
from maps_generator.utils.algo import unique
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import argparse
|
||||
|
||||
from .generator.statistics import diff
|
||||
from .generator.statistics import read_types
|
||||
from maps_generator.generator.statistics import diff
|
||||
from maps_generator.generator.statistics import read_types
|
||||
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -4,10 +4,10 @@ This file contains api for osmfilter and generator_tool to generate coastline.
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from . import settings
|
||||
from .env import Env
|
||||
from .gen_tool import run_gen_tool
|
||||
from .osmtools import osmfilter
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.gen_tool import run_gen_tool
|
||||
from maps_generator.generator.osmtools import osmfilter
|
||||
|
||||
|
||||
def filter_coastline(
|
||||
|
|
|
@ -16,13 +16,13 @@ from typing import Set
|
|||
from typing import Type
|
||||
from typing import Union
|
||||
|
||||
from . import settings
|
||||
from .osmtools import build_osmtools
|
||||
from .stages import Stage
|
||||
from .status import Status
|
||||
from ..utils.file import find_executable
|
||||
from ..utils.file import is_executable
|
||||
from ..utils.file import symlink_force
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator.osmtools import build_osmtools
|
||||
from maps_generator.generator.stages import Stage
|
||||
from maps_generator.generator.status import Status
|
||||
from maps_generator.utils.file import find_executable
|
||||
from maps_generator.utils.file import is_executable
|
||||
from maps_generator.utils.file import symlink_force
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@ import logging
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from . import settings
|
||||
from .exceptions import OptionNotFound
|
||||
from .exceptions import ValidationError
|
||||
from .exceptions import wait_and_raise_if_fail
|
||||
from maps_generator.generator.exceptions import OptionNotFound
|
||||
from maps_generator.generator.exceptions import ValidationError
|
||||
from maps_generator.generator.exceptions import wait_and_raise_if_fail
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ from typing import Union
|
|||
|
||||
import filelock
|
||||
|
||||
from . import settings
|
||||
from .env import Env
|
||||
from .exceptions import ContinueError
|
||||
from .stages import Stage
|
||||
from .stages import get_stage_name
|
||||
from .stages import stages
|
||||
from .status import Status
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.exceptions import ContinueError
|
||||
from maps_generator.generator.stages import Stage
|
||||
from maps_generator.generator.stages import get_stage_name
|
||||
from maps_generator.generator.stages import stages
|
||||
from maps_generator.generator.status import Status
|
||||
|
||||
|
||||
class Generation:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from . import settings
|
||||
from .exceptions import BadExitStatusError
|
||||
from .exceptions import wait_and_raise_if_fail
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator.exceptions import BadExitStatusError
|
||||
from maps_generator.generator.exceptions import wait_and_raise_if_fail
|
||||
|
||||
|
||||
def build_osmtools(path, output=subprocess.DEVNULL, error=subprocess.DEVNULL):
|
||||
|
|
|
@ -8,8 +8,8 @@ from pathlib import Path
|
|||
from typing import Any
|
||||
from typing import AnyStr
|
||||
|
||||
from ..utils.md5 import md5
|
||||
from ..utils.system import total_virtual_memory
|
||||
from maps_generator.utils.md5 import md5
|
||||
from maps_generator.utils.system import total_virtual_memory
|
||||
|
||||
parser = argparse.ArgumentParser(add_help=False)
|
||||
opt_config = "--config"
|
||||
|
|
|
@ -21,9 +21,9 @@ from typing import Optional
|
|||
from typing import Type
|
||||
from typing import Union
|
||||
|
||||
from .status import Status
|
||||
from ..utils.log import DummyObject
|
||||
from ..utils.log import create_file_logger
|
||||
from maps_generator.generator.status import Status
|
||||
from maps_generator.utils.log import DummyObject
|
||||
from maps_generator.utils.log import create_file_logger
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -20,32 +20,32 @@ from typing import Type
|
|||
from descriptions.descriptions_downloader import check_and_get_checker
|
||||
from descriptions.descriptions_downloader import download_from_wikidata_tags
|
||||
from descriptions.descriptions_downloader import download_from_wikipedia_tags
|
||||
from maps_generator.generator import coastline
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator import steps
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.env import PathProvider
|
||||
from maps_generator.generator.env import WORLDS_NAMES
|
||||
from maps_generator.generator.env import WORLD_COASTS_NAME
|
||||
from maps_generator.generator.env import WORLD_NAME
|
||||
from maps_generator.generator.exceptions import BadExitStatusError
|
||||
from maps_generator.generator.gen_tool import run_gen_tool
|
||||
from maps_generator.generator.stages import Stage
|
||||
from maps_generator.generator.stages import build_lock
|
||||
from maps_generator.generator.stages import country_stage
|
||||
from maps_generator.generator.stages import helper_stage_for
|
||||
from maps_generator.generator.stages import mwm_stage
|
||||
from maps_generator.generator.stages import outer_stage
|
||||
from maps_generator.generator.stages import planet_lock
|
||||
from maps_generator.generator.stages import production_only
|
||||
from maps_generator.generator.stages import stages
|
||||
from maps_generator.generator.statistics import get_stages_info
|
||||
from maps_generator.generator.statistics import make_stats
|
||||
from maps_generator.utils.file import download_files
|
||||
from maps_generator.utils.file import is_verified
|
||||
from post_generation.hierarchy_to_countries import hierarchy_to_countries
|
||||
from post_generation.inject_promo_ids import inject_promo_ids
|
||||
from post_generation.localads_mwm_to_csv import create_csv
|
||||
from . import coastline
|
||||
from . import settings
|
||||
from . import steps
|
||||
from .env import Env
|
||||
from .env import PathProvider
|
||||
from .env import WORLDS_NAMES
|
||||
from .env import WORLD_COASTS_NAME
|
||||
from .env import WORLD_NAME
|
||||
from .exceptions import BadExitStatusError
|
||||
from .gen_tool import run_gen_tool
|
||||
from .stages import Stage
|
||||
from .stages import build_lock
|
||||
from .stages import country_stage
|
||||
from .stages import helper_stage_for
|
||||
from .stages import mwm_stage
|
||||
from .stages import outer_stage
|
||||
from .stages import planet_lock
|
||||
from .stages import production_only
|
||||
from .stages import stages
|
||||
from .statistics import get_stages_info
|
||||
from .statistics import make_stats
|
||||
from ..utils.file import download_files
|
||||
from ..utils.file import is_verified
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ from typing import AnyStr
|
|||
from typing import Dict
|
||||
from typing import List
|
||||
|
||||
from .env import WORLDS_NAMES
|
||||
from .exceptions import ParseError
|
||||
from maps_generator.generator.env import WORLDS_NAMES
|
||||
from maps_generator.generator.exceptions import ParseError
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -8,20 +8,20 @@ import shutil
|
|||
import subprocess
|
||||
from typing import AnyStr
|
||||
|
||||
from . import settings
|
||||
from .env import Env
|
||||
from .env import PathProvider
|
||||
from .env import WORLDS_NAMES
|
||||
from .env import WORLD_NAME
|
||||
from .env import get_all_countries_list
|
||||
from .gen_tool import run_gen_tool
|
||||
from .osmtools import osmconvert
|
||||
from .osmtools import osmupdate
|
||||
from ..utils.file import download_file
|
||||
from ..utils.file import is_verified
|
||||
from ..utils.file import symlink_force
|
||||
from ..utils.md5 import md5
|
||||
from ..utils.md5 import write_md5sum
|
||||
from maps_generator.generator import settings
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.env import PathProvider
|
||||
from maps_generator.generator.env import WORLDS_NAMES
|
||||
from maps_generator.generator.env import WORLD_NAME
|
||||
from maps_generator.generator.env import get_all_countries_list
|
||||
from maps_generator.generator.gen_tool import run_gen_tool
|
||||
from maps_generator.generator.osmtools import osmconvert
|
||||
from maps_generator.generator.osmtools import osmupdate
|
||||
from maps_generator.utils.file import download_file
|
||||
from maps_generator.utils.file import is_verified
|
||||
from maps_generator.utils.file import symlink_force
|
||||
from maps_generator.utils.md5 import md5
|
||||
from maps_generator.utils.md5 import write_md5sum
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ import logging
|
|||
from typing import AnyStr
|
||||
from typing import Optional
|
||||
|
||||
from .generator import stages_declaration as sd
|
||||
from .generator.env import Env
|
||||
from .generator.generation import Generation
|
||||
from maps_generator.generator import stages_declaration as sd
|
||||
from maps_generator.generator.env import Env
|
||||
from maps_generator.generator.generation import Generation
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ from typing import AnyStr
|
|||
from typing import Dict
|
||||
from typing import Optional
|
||||
|
||||
from .md5 import check_md5
|
||||
from .md5 import md5
|
||||
from maps_generator.utils.md5 import check_md5
|
||||
from maps_generator.utils.md5 import md5
|
||||
|
||||
logger = logging.getLogger("maps_generator")
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import json
|
|||
import os
|
||||
import sys
|
||||
|
||||
from .hierarchy_to_countries import hierarchy_to_countries as hierarchy_to_countries_
|
||||
from .inject_promo_ids import inject_promo_ids
|
||||
from .localads_mwm_to_csv import create_csv
|
||||
from post_generation.hierarchy_to_countries import hierarchy_to_countries as hierarchy_to_countries_
|
||||
from post_generation.inject_promo_ids import inject_promo_ids
|
||||
from post_generation.localads_mwm_to_csv import create_csv
|
||||
|
||||
|
||||
class PostGeneration:
|
||||
|
|
|
@ -3,7 +3,9 @@ import ctypes
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
from multiprocessing import Pool, Queue, Process
|
||||
from multiprocessing import Pool
|
||||
from multiprocessing import Process
|
||||
from multiprocessing import Queue
|
||||
from zlib import adler32
|
||||
|
||||
from mwm import MetadataField
|
||||
|
|
Loading…
Add table
Reference in a new issue