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