<commit_before>from pi_gpio import app, socketio
from flask.ext import restful
from flask import render_template
from handlers import PinList, PinDetail
from events import PinEventManager


api = restful.Api(app)
api.add_resource(PinList, '/api/v1/pin')
api.add_resource(PinDetail, '/api/v1/pin/<string:pin_num>')


@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def index(path):
    PinEventManager(socketio)
    return render_template('index.html')<commit_msg>Don't overload things on page refresh<commit_after>from pi_gpio import app, socketio
from flask.ext import restful
from flask import render_template
from handlers import PinList, PinDetail
from events import PinEventManager


api = restful.Api(app)
api.add_resource(PinList, '/api/v1/pin')
api.add_resource(PinDetail, '/api/v1/pin/<string:pin_num>')


EVENT_MANAGER = None


@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def index(path):
    global EVENT_MANAGER
    if EVENT_MANAGER is None:
        EVENT_MANAGER = PinEventManager(socketio)
    return render_template('index.html')
{'fraction_non_alphanumeric': 0.12915129151291513, 'fraction_numerical': 0.0036900369003690036, 'mean_word_length': 5.739130434782608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6461957', 'n_tokens_mistral': 364, 'n_tokens_neox': 352, 'n_words': 85}