<commit_before>from pi_gpio import app, socketio
from threading import Thread
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 = PinEventManager(socketio)


THREAD = None


import time
import RPi.GPIO as GPIO

def background_thread():
    while True:
        GPIO.wait_for_edge(23, GPIO.RISING)
        socketio.emit('pin:event', {"message":"woohoo!"})
        time.sleep(0.5)


@app.route('/', defaults={'path': ''})<commit_msg>Try it this way<commit_after>from pi_gpio import app, socketio
from threading import Thread
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 = PinEventManager(socketio)


THREAD = None


import time
import RPi.GPIO as GPIO

def background_thread():
    GPIO.add_event_detect(23, GPIO.RISING)
    while True:
        if GPIO.event_detected(23):
            socketio.emit('pin:event', {"message":"woohoo!"})
            time.sleep(0.5)


@app.route('/', defaults={'path': ''})
{'fraction_non_alphanumeric': 0.12179016874541453, 'fraction_numerical': 0.010271460014673514, 'mean_word_length': 4.613168724279835, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '7100671', 'n_tokens_mistral': 453, 'n_tokens_neox': 437, 'n_words': 111}