[generator] Python projects refactoring.

This commit is contained in:
Maksim Andrianov 2019-04-19 15:29:20 +03:00 committed by mpimenov
parent d74da60b83
commit 01ed204609
15 changed files with 36 additions and 31 deletions

0
tools/python/__init__.py Normal file
View file

View file

@ -14,8 +14,8 @@ import math
from eviltransform import gcj2wgs_exact
from tqdm import tqdm
from api.booking_api import BookingApi, BookingListApi, LIMIT_REQUESTS_PER_MINUTE
from api.exceptions import GettingMinPriceError
from .api.booking_api import BookingApi, BookingListApi, LIMIT_REQUESTS_PER_MINUTE
from .api.exceptions import GettingMinPriceError
SUPPORTED_LANGUAGES = ("en", "ru", "ar", "cs", "da", "nl", "fi", "fr", "de",
"hu", "id", "it", "ja", "ko", "pl", "pt", "ro", "es",

View file

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python
import sys
import mwm
import re
import sys
from . import mwm
if len(sys.argv) < 2:
print('This script unpacks maps.me OSM id to an OSM object link.')

View file

@ -1,7 +1,10 @@
#!/usr/bin/python
import sys, os.path, random
import json
from mwm import MWM
import os.path
import random
import sys
from .mwm import MWM
if len(sys.argv) < 2:
print('Dumps some MWM structures.')

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
import sys, os.path, json
from mwm import MWM
import json
import os.path
import sys
from .mwm import MWM
if len(sys.argv) < 4:
print('Finds features in an mwm file based on a query')

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
import sys
import mwm
from . import mwm
if len(sys.argv) < 3:
print('Finds an OSM object for a given feature id.')

View file

@ -1,8 +1,9 @@
# MWM Reader Module
import struct
import math
from datetime import datetime
import math
# Unprocessed sections: geomN, trgN, idx, sdx (search index), addr (search address), offs (feature offsets - succinct)
# Routing sections: mercedes (matrix), daewoo (edge data), infinity (edge id), skoda (shortcuts), chrysler (cross context), ftseg, node2ftseg
# (these mostly are succinct structures, except chrysler and node2ftseg, so no use trying to load them here)

View file

@ -1,12 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from mwm import MWM
import argparse
import os
import multiprocessing
import os
from .mwm import MWM
OMIM_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..')

View file

View file

View file

@ -15,12 +15,15 @@
# 3. Country ISO code (used for flags in the legacy format)
# 4. Comma-separated list of language ISO codes for the region
#
import sys, json, re
from optparse import OptionParser
import os.path
import base64
import codecs
import hashlib
import base64
import json
import os.path
import re
import sys
from optparse import OptionParser
class CountryDict(dict):
def __init__(self, *args, **kwargs):

View file

@ -1,22 +1,14 @@
#!/usr/bin/env python2.7
import os
import sys
# TODO: Make mwm an installable module.
sys.path.append(
os.path.join(
os.path.dirname(__file__), '..', 'mwm'
)
)
import argparse
import csv
import mwm
import logging
import ctypes
from zlib import adler32
import logging
import os
import sys
from multiprocessing import Pool, Queue, Process
from zlib import adler32
from ..mwm import mwm
HEADERS = {
'mapping': 'osmid fid mwm_id mwm_version source_type'.split(),

View file

@ -0,0 +1 @@
-r ../mwm/requirements.txt

View file

@ -225,9 +225,9 @@ else
PYTHON_SCRIPTS_PATH="$OMIM_PATH/tools/python"
fi
ROADS_SCRIPT="$PYTHON_SCRIPTS_PATH/road_runner.py"
HIERARCHY_SCRIPT="$PYTHON_SCRIPTS_PATH/hierarchy_to_countries.py"
HIERARCHY_SCRIPT="$PYTHON_SCRIPTS_PATH/post_generation/hierarchy_to_countries.py"
DESCRIPTIONS_DOWNLOADER="$PYTHON_SCRIPTS_PATH/descriptions/descriptions_downloader.py"
LOCALADS_SCRIPT="$PYTHON_SCRIPTS_PATH/local_ads/mwm_to_csv_4localads.py"
LOCALADS_SCRIPT="$PYTHON_SCRIPTS_PATH/post_generation/localads_mwm_to_csv.py"
UGC_FILE="${UGC_FILE:-$INTDIR/ugc_db.sqlite3}"
POPULAR_PLACES_FILE="${POPULAR_PLACES_FILE:-$INTDIR/popular_places.csv}"
WIKIDATA_FILE="${WIKIDATA_FILE:-$INTDIR/idToWikidata.csv}"