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()
from bottle import request from bottle import static_file from bottle import template from bottle import view 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')