Refactor. Deleted setup.py

This commit is contained in:
Jack Stdin 2016-02-23 22:29:12 +03:00
parent dc8e5d35a7
commit 86426d4803
8 changed files with 16 additions and 33 deletions

View File

@ -4,7 +4,7 @@ import logging
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)
app = Bottle()

View File

@ -8,7 +8,7 @@ from bottle import template
from aore.config import db_conf
from aore.dbutils.dbimpl import DBImpl
from aore.fias.search import SphinxSearch
from aore.search.search import SphinxSearch
class FiasFactory:

View File

@ -7,8 +7,8 @@ import sphinxapi
from aore.config import basic
from aore.config import sphinx_conf
from aore.fias.wordentry import WordEntry
from aore.fias.wordvariation import VariationType
from aore.search.wordentry import WordEntry
from aore.search.wordvariation import VariationType
from aore.miscutils.trigram import trigram
@ -130,8 +130,10 @@ class SphinxSearch:
if self.search_freq_words and freq_vars_word_count:
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)
del second_q
self.client_show.AddQuery(first_q, sphinx_conf.index_addjobj)
del first_q
start_t = time.time()
rs = self.client_show.RunQueries()
@ -144,13 +146,15 @@ class SphinxSearch:
parsed_ids = []
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:
break
if not ma['attrs']['aoid'] in parsed_ids:
parsed_ids.append(ma['attrs']['aoid'])
if not match['attrs']['aoid'] in parsed_ids:
parsed_ids.append(match['attrs']['aoid'])
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))
return results

View File

@ -2,7 +2,7 @@
import re
from aore.config import sphinx_conf
from aore.fias.wordvariation import WordVariation, VariationType
from aore.search.wordvariation import WordVariation, VariationType
class WordEntry:

View File

@ -5,9 +5,9 @@ from pysimplesoap.client import SoapClient
class SoapReceiver:
def __init__(self):
self.client = SoapClient(
location="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx",
action='http://fias.nalog.ru/WebServices/Public/DownloadService.asmx/',
namespace="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx",
location="http://search.nalog.ru/WebServices/Public/DownloadService.asmx",
action='http://search.nalog.ru/WebServices/Public/DownloadService.asmx/',
namespace="http://search.nalog.ru/WebServices/Public/DownloadService.asmx",
soap_ns='soap', trace=False, ns=False)
# return (intver, strver, url)

View File

@ -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']
)