<commit_before>from calcthread import CalcThread
from flask import Flask, request
from flask_cors import CORS, cross_origin
from threading import Lock

app = Flask(__name__)
CORS(app)

lock = Lock()

@app.route("/")
@cross_origin()
def hello():
    return "Hello! I'm the server for geovibes"

@app.route("/events", methods=['GET'])
@cross_origin()
def get_events():
    news = []
    with lock:
        with open('events_write.txt', 'r') as f:
            for line in f:
                print line
                news.append(line)
    return str(news)

def start_calc():
    print "threads started"
    thread = CalcThread(lock)
    thread.start()

app.before_first_request(start_calc)

if __name__ == "__main__":
    print "hello i started"
    app.run()<commit_msg>try json<commit_after>from calcthread import CalcThread
from flask import Flask, request
from flask_cors import CORS, cross_origin
from threading import Lock
import json

app = Flask(__name__)
CORS(app)

lock = Lock()

@app.route("/")
@cross_origin()
def hello():
    return "Hello! I'm the server for geovibes"

@app.route("/events", methods=['GET'])
@cross_origin()
def get_events():
    news = []
    with lock:
        with open('events_write.txt', 'r') as f:
            for line in f:
                news.append(json.loads(line))
    return str(news)

def start_calc():
    print "threads started"
    thread = CalcThread(lock)
    thread.start()

app.before_first_request(start_calc)

if __name__ == "__main__":
    print "hello i started"
    app.run()
{'fraction_non_alphanumeric': 0.12222222222222222, 'fraction_numerical': 0.0, 'mean_word_length': 3.3618233618233617, 'pattern_counts': {'":': 2, '<': 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': '6907934', 'n_tokens_mistral': 510, 'n_tokens_neox': 501, 'n_words': 146}