Source

hack2 / numready / numready.py

#!/usr/bin/env python

import sys
from flask import Flask, render_template
from _numready.process import read_all_numpy_funcs

SPLIT = 4

class Item(object):
    def __init__(self, name, is_present):
        self.name = name
        if is_present:
            self.cls = 'present'
        else:
            self.cls = 'nonpresent'

class Server(object):
    def index(self):
        python = read_all_numpy_funcs()
        pypy = read_all_numpy_funcs(sys.executable, 'numpypy')
        pypy_d = set(pypy)
        l = [Item(i, i in pypy_d) for i in python]
        l = [l[i*SPLIT:min((i + 1)*SPLIT, len(l))] for i in range(len(l)/SPLIT)]
        return render_template('index.html', table=l)

def main():
    app = Flask(__name__)
    server = Server()

    app.route('/')(server.index)
    app.run(debug=True, use_reloader=False)

if __name__ == '__main__':
    main()