Refactor. Deleted setup.py
This commit is contained in:
parent
dc8e5d35a7
commit
86426d4803
@ -4,7 +4,7 @@ import logging
|
|||||||
|
|
||||||
from bottle import Bottle, response
|
from bottle import Bottle, response
|
||||||
|
|
||||||
from aore.fias.fiasfactory import FiasFactory
|
from aore.search.fiasfactory import FiasFactory
|
||||||
|
|
||||||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
|
||||||
app = Bottle()
|
app = Bottle()
|
||||||
|
@ -8,7 +8,7 @@ from bottle import template
|
|||||||
|
|
||||||
from aore.config import db_conf
|
from aore.config import db_conf
|
||||||
from aore.dbutils.dbimpl import DBImpl
|
from aore.dbutils.dbimpl import DBImpl
|
||||||
from aore.fias.search import SphinxSearch
|
from aore.search.search import SphinxSearch
|
||||||
|
|
||||||
|
|
||||||
class FiasFactory:
|
class FiasFactory:
|
@ -7,8 +7,8 @@ import sphinxapi
|
|||||||
|
|
||||||
from aore.config import basic
|
from aore.config import basic
|
||||||
from aore.config import sphinx_conf
|
from aore.config import sphinx_conf
|
||||||
from aore.fias.wordentry import WordEntry
|
from aore.search.wordentry import WordEntry
|
||||||
from aore.fias.wordvariation import VariationType
|
from aore.search.wordvariation import VariationType
|
||||||
from aore.miscutils.trigram import trigram
|
from aore.miscutils.trigram import trigram
|
||||||
|
|
||||||
|
|
||||||
@ -130,8 +130,10 @@ class SphinxSearch:
|
|||||||
if self.search_freq_words and freq_vars_word_count:
|
if self.search_freq_words and freq_vars_word_count:
|
||||||
second_q = " @sname {}".format(" ".join(freq_var.text for freq_var in freq_vars))
|
second_q = " @sname {}".format(" ".join(freq_var.text for freq_var in freq_vars))
|
||||||
self.client_show.AddQuery(first_q + second_q, sphinx_conf.index_addjobj)
|
self.client_show.AddQuery(first_q + second_q, sphinx_conf.index_addjobj)
|
||||||
|
del second_q
|
||||||
|
|
||||||
self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj)
|
self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj)
|
||||||
|
del first_q
|
||||||
|
|
||||||
start_t = time.time()
|
start_t = time.time()
|
||||||
rs = self.client_show.RunQueries()
|
rs = self.client_show.RunQueries()
|
||||||
@ -144,13 +146,15 @@ class SphinxSearch:
|
|||||||
parsed_ids = []
|
parsed_ids = []
|
||||||
|
|
||||||
for i in range(0, len(rs)):
|
for i in range(0, len(rs)):
|
||||||
for ma in rs[i]['matches']:
|
for match in rs[i]['matches']:
|
||||||
if len(results) >= self.max_result:
|
if len(results) >= self.max_result:
|
||||||
break
|
break
|
||||||
if not ma['attrs']['aoid'] in parsed_ids:
|
if not match['attrs']['aoid'] in parsed_ids:
|
||||||
parsed_ids.append(ma['attrs']['aoid'])
|
parsed_ids.append(match['attrs']['aoid'])
|
||||||
results.append(
|
results.append(
|
||||||
dict(aoid=ma['attrs']['aoid'], text=unicode(ma['attrs']['fullname']), ratio=ma['attrs']['krank'],
|
dict(aoid=match['attrs']['aoid'],
|
||||||
|
text=unicode(match['attrs']['fullname']),
|
||||||
|
ratio=match['attrs']['krank'],
|
||||||
cort=i))
|
cort=i))
|
||||||
|
|
||||||
return results
|
return results
|
@ -2,7 +2,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from aore.config import sphinx_conf
|
from aore.config import sphinx_conf
|
||||||
from aore.fias.wordvariation import WordVariation, VariationType
|
from aore.search.wordvariation import WordVariation, VariationType
|
||||||
|
|
||||||
|
|
||||||
class WordEntry:
|
class WordEntry:
|
@ -5,9 +5,9 @@ from pysimplesoap.client import SoapClient
|
|||||||
class SoapReceiver:
|
class SoapReceiver:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.client = SoapClient(
|
self.client = SoapClient(
|
||||||
location="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx",
|
location="http://search.nalog.ru/WebServices/Public/DownloadService.asmx",
|
||||||
action='http://fias.nalog.ru/WebServices/Public/DownloadService.asmx/',
|
action='http://search.nalog.ru/WebServices/Public/DownloadService.asmx/',
|
||||||
namespace="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx",
|
namespace="http://search.nalog.ru/WebServices/Public/DownloadService.asmx",
|
||||||
soap_ns='soap', trace=False, ns=False)
|
soap_ns='soap', trace=False, ns=False)
|
||||||
|
|
||||||
# return (intver, strver, url)
|
# return (intver, strver, url)
|
||||||
|
21
setup.py
21
setup.py
@ -1,21 +0,0 @@
|
|||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='py-phias',
|
|
||||||
version='0.0.1',
|
|
||||||
packages=['aore', 'aore.fias', 'aore.config', 'aore.dbutils', 'aore.updater', 'aore.miscutils'],
|
|
||||||
url='https://github.com/jar3b/py-phias',
|
|
||||||
license='BSD',
|
|
||||||
author='hellotan',
|
|
||||||
author_email='hellotan@live.ru',
|
|
||||||
description='Python application that can operate with FIAS (Russian Address Object DB)',
|
|
||||||
install_requires=
|
|
||||||
['lxml',
|
|
||||||
'psycopg2>=2.6.0',
|
|
||||||
'bottle>=0.12.0',
|
|
||||||
'pysimplesoap',
|
|
||||||
'python-Levenshtein',
|
|
||||||
'enum34',
|
|
||||||
'rarfile',
|
|
||||||
'requests']
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user