コード例 #1
0
ファイル: smoke_test.py プロジェクト: rphilander/proteus
 def setUpClass(cls):
     cls.db = DB()
     cls.db.load(test_data)
     cls.atom_index = AtomIndex('smoke-test')
     for atom in rows2atoms.transform(cls.db.query('select * from medals')):
         cls.atom_index.write(atom)
     map(cls.atom_index.write, grammar.get_atoms())
     cls.atom_index.flush()
コード例 #2
0
ファイル: server.py プロジェクト: rphilander/proteus
from core import AtomIndex, interpret
from database import DB
import grammar
import rows2atoms

# initialize stuff
db = DB()
with open('raw_data/filtered.txt') as raw_data:
    db.load(raw_data)
atom_index = AtomIndex('web-ui')
for atom in rows2atoms.transform(db.query('select * from medals')):
    try:
        atom_index.write(atom)
    except UnicodeEncodeError:
        pass
map(atom_index.write, grammar.get_atoms())


@route('/')
def hello():
    return static_file('html/index.html', root='static')

@route('/static/<filepath:path>')
def server_static(filepath):
    return static_file(filepath, root='static')

@route('/search')
def search():
	query = request.query.q
	queries = interpret(atom_index, grammar, query)
	results = []