<commit_before>from flask import Flask
from flask_sockets import Sockets
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler

app = Flask(__name__)
app.debug = True
sockets = Sockets(app)


@app.route('/')
def main():
    return "Hello World"


@app.route('/candidates')
def candidates():
    return 'hi'


@sockets.route('/echo')
def echo_socket(ws):
    while not ws.closed:
        message = ws.receive()
        ws.send("fuck this shit")


if __name__ == '__main__':
    server = pywsgi.WSGIServer(('', 5000), app, handler_class=WebSocketHandler)
    server.serve_forever()
<commit_msg>websocket fake data<commit_after>from flask import Flask
from flask_sockets import Sockets
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
import json
import yaml

app = Flask(__name__)
app.debug = True
sockets = Sockets(app)

test_message = [
    [{"text":"while","flag": True}, {"text":"the","flag": False}, {"text":"final","flag": False}, {"text":"say","flag": False}],
    [{"text":"crazed","flag": False}, {"text":"monosyllables","flag": False}],
    [{"text":"modesto","flag": False}, {"text":"shallow","flag": False}]
]

@app.route('/')
def main():
    return "Hello World"


@app.route('/candidates')
def candidates():
    return 'hi'


@sockets.route('/twaiku')
def echo_socket(ws):
    while not ws.closed:
        message = ws.receive()
        message = yaml.safe_load(message)
        print message
        if (message["event"] == 'haiku'):
            ws.send(json.dumps(test_message))
        else:
            ws.send("fuck this shit")

if __name__ == '__main__':
    server = pywsgi.WSGIServer(('', 5000), app, handler_class=WebSocketHandler)
    server.serve_forever()

{'fraction_non_alphanumeric': 0.16138328530259366, 'fraction_numerical': 0.004610951008645533, 'mean_word_length': 4.197604790419161, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, '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': '5153280', 'n_tokens_mistral': 597, 'n_tokens_neox': 551, 'n_words': 138}