refactor: remove unused python2 code, optimize imports
This commit is contained in:
parent
d03aa0a78c
commit
966bec093f
@ -1,4 +1 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from .common import *
|
from .common import *
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
||||||
class BasicConfig:
|
class BasicConfig:
|
||||||
logging = False
|
logging = False
|
||||||
debug_print = False
|
debug_print = False
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from traceback import format_exc
|
|
||||||
|
|
||||||
import psycopg2.extras
|
import psycopg2.extras
|
||||||
|
from traceback import format_exc
|
||||||
|
|
||||||
from aore.miscutils.exceptions import FiasException
|
from aore.miscutils.exceptions import FiasException
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
||||||
class DbSchema:
|
class DbSchema:
|
||||||
def __init__(self, name, fieldlist, unique_key, xmltag):
|
def __init__(self, name, fieldlist, unique_key, xmltag):
|
||||||
self.tablename = name
|
self.tablename = name
|
||||||
@ -29,4 +26,3 @@ db_shemas['AOTRIG'] = \
|
|||||||
None)
|
None)
|
||||||
|
|
||||||
allowed_tables = ["ADDROBJ", "SOCRBASE"]
|
allowed_tables = ["ADDROBJ", "SOCRBASE"]
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
||||||
class FiasException(Exception):
|
class FiasException(Exception):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.args[0])
|
return repr(self.args[0])
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
|
|
||||||
import Levenshtein
|
import Levenshtein
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def violet_ratio(pattern, candidate):
|
def violet_ratio(pattern, candidate):
|
||||||
@ -21,7 +19,7 @@ def violet_ratio(pattern, candidate):
|
|||||||
max_ratio = ratio
|
max_ratio = ratio
|
||||||
max_j = j
|
max_j = j
|
||||||
|
|
||||||
result.append(max_j*abs(max_ratio))
|
result.append(max_j * abs(max_ratio))
|
||||||
|
|
||||||
if max_j > -1:
|
if max_j > -1:
|
||||||
del allowed_nums[max_j]
|
del allowed_nums[max_j]
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from bottle import template
|
from bottle import template
|
||||||
|
|
||||||
from aore.config import Folders, DatabaseConfig, SphinxConfig
|
from aore.config import Folders, DatabaseConfig, SphinxConfig
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
||||||
def trigram(inp):
|
def trigram(inp):
|
||||||
inp = u"__"+inp+u"__"
|
inp = u"__" + inp + u"__"
|
||||||
output = []
|
output = []
|
||||||
|
|
||||||
for i in range(0, len(inp) - 2):
|
for i in range(0, len(inp) - 2):
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from borest import app, Route, Error
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
from borest import app, Route, Error
|
||||||
from bottle import response, request
|
from bottle import response, request
|
||||||
|
|
||||||
from aore.search.fiasfactory import FiasFactory
|
from aore.search.fiasfactory import FiasFactory
|
||||||
|
|
||||||
|
|
||||||
class App(object):
|
class App:
|
||||||
_factory = None
|
_factory = None
|
||||||
|
|
||||||
def __init__(self, log_filename):
|
def __init__(self, log_filename):
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import logging
|
import logging
|
||||||
|
import psycopg2
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
import psycopg2
|
|
||||||
from bottle import template
|
from bottle import template
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
from aore.config import DatabaseConfig, BasicConfig
|
from aore.config import DatabaseConfig, BasicConfig
|
||||||
from aore.dbutils.dbimpl import DBImpl
|
from aore.dbutils.dbimpl import DBImpl
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
import Levenshtein
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
|
|
||||||
import Levenshtein
|
|
||||||
import sphinxapi
|
import sphinxapi
|
||||||
|
import time
|
||||||
|
|
||||||
from aore.config import BasicConfig
|
from aore.config import BasicConfig
|
||||||
from aore.config import SphinxConfig
|
from aore.config import SphinxConfig
|
||||||
@ -108,7 +106,6 @@ class SphinxSearch:
|
|||||||
# text - текст найденного адресного объекта
|
# text - текст найденного адресного объекта
|
||||||
# ratio - рейтинг найденного пункта
|
# ratio - рейтинг найденного пункта
|
||||||
# cort - рейтинг количества совпавших слов
|
# cort - рейтинг количества совпавших слов
|
||||||
|
|
||||||
def find(self, text, strong):
|
def find(self, text, strong):
|
||||||
def split_phrase(phrase):
|
def split_phrase(phrase):
|
||||||
phrase = phrase.lower()
|
phrase = phrase.lower()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from aore.config import SphinxConfig
|
from aore.config import SphinxConfig
|
||||||
@ -148,8 +147,5 @@ class WordEntry:
|
|||||||
def get_type(self):
|
def get_type(self):
|
||||||
return ", ".join([x for x in self.match_types if self.__dict__[x]])
|
return ", ".join([x for x in self.match_types if self.__dict__[x]])
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return self.word
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.word)
|
return str(self.word)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from enum import Enum # Типы вариаций слова
|
from enum import Enum # Типы вариаций слова
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
import codecs
|
import codecs
|
||||||
|
import os
|
||||||
|
|
||||||
from aore.config import Folders
|
from aore.config import Folders
|
||||||
from aore.dbutils.dbschemas import db_shemas
|
from aore.dbutils.dbschemas import db_shemas
|
||||||
from aore.miscutils.exceptions import FiasException
|
from aore.miscutils.exceptions import FiasException
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
from traceback import format_exc
|
|
||||||
|
|
||||||
import rarfile
|
import rarfile
|
||||||
import requests
|
import requests
|
||||||
|
from traceback import format_exc
|
||||||
|
|
||||||
from aore.config import Folders, UnrarConfig
|
from aore.config import Folders, UnrarConfig
|
||||||
from aore.miscutils.exceptions import FiasException
|
from aore.miscutils.exceptions import FiasException
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
@ -42,8 +40,5 @@ class AoXmlTableEntry:
|
|||||||
def close(self):
|
def close(self):
|
||||||
self.file_descriptor.close()
|
self.file_descriptor.close()
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return "Entry for {} table {}".format(self.operation_type, self.table_name)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Entry for {} table {}".format(self.operation_type, self.table_name)
|
return "Entry for {} table {}".format(self.operation_type, self.table_name)
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
from bottle import template
|
from bottle import template
|
||||||
|
|
||||||
@ -66,4 +63,3 @@ class DbHandler:
|
|||||||
|
|
||||||
self.db.execute(sql_query)
|
self.db.execute(sql_query)
|
||||||
logging.info("All indexes was deleted.")
|
logging.info("All indexes was deleted.")
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from pysimplesoap.client import SoapClient
|
from pysimplesoap.client import SoapClient
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from os import walk, path
|
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
from os import walk, path
|
||||||
|
|
||||||
from aore.config import DatabaseConfig
|
from aore.config import DatabaseConfig
|
||||||
from aore.dbutils.dbimpl import DBImpl
|
from aore.dbutils.dbimpl import DBImpl
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import logging
|
import logging
|
||||||
import optparse
|
import optparse
|
||||||
import sys
|
import sys
|
||||||
@ -23,7 +22,7 @@ def print_fias_versions():
|
|||||||
all_versions = imp.get_update_list()
|
all_versions = imp.get_update_list()
|
||||||
|
|
||||||
print("Installed version: {}".format(current_version))
|
print("Installed version: {}".format(current_version))
|
||||||
print("Avaliable updates:")
|
print("Available updates:")
|
||||||
print("Number\t\tDate")
|
print("Number\t\tDate")
|
||||||
for upd in all_versions:
|
for upd in all_versions:
|
||||||
mark_current = (' ', '*')[int(upd['intver']) == current_version]
|
mark_current = (' ', '*')[int(upd['intver']) == current_version]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user