<commit_before>from flask import Flask, render_template, request, jsonify ,json
from eval_py.apply_test import exec_sandbox

@app.route('/_execute', methods=['POST'])
def execute():
    rpc = request.json
    code = rpc["params"][0]
    out = exec_sandbox(code,test)
    return jsonify(result=out)

test = '''
import unittest, sys, json

class Test(unittest.TestCase):
    def setUp(self):
        pass

    def test_order(self):
        self.assertEqual(solution([2,6,1,5]),[1,2,5,6])

    def test_none(self):
        self.assertEqual(solution(None),[])

    #def test_hang(self):
    #    self.assertEqual(hang(), None)

class TestFoo(unittest.TestCase):
    def test_foo(self):
        from StringIO import StringIO

        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out
            foo()
            output = out.getvalue().strip()

            assert output == 'hello world!'
        finally:
            sys.stdout = saved_stdout
            print output


suite = unittest.TestLoader().loadTestsFromTestCase(Test)
test_result = unittest.TextTestRunner(descriptions=False, verbosity=0, stream=sys.stderr).run(suite)
'''

<commit_msg>redis_cola.worker<commit_after>from flask import Flask, render_template, request, jsonify ,json
from eval_py.apply_test import exec_sandbox

app = Flask(__name__)



@app.route('/_execute', methods=['POST'])
def execute():
    rpc = request.json
    code = rpc["params"][0]
    out = exec_sandbox(code,test)
    return jsonify(result=out)

if __name__ == "__main__":
    app.run(host='0.0.0.0')

test = '''
import unittest, sys, json

class Test(unittest.TestCase):
    def setUp(self):
        pass

    def test_order(self):
        self.assertEqual(solution([2,6,1,5]),[1,2,5,6])

    def test_none(self):
        self.assertEqual(solution(None),[])

    #def test_hang(self):
    #    self.assertEqual(hang(), None)

class TestFoo(unittest.TestCase):
    def test_foo(self):
        from StringIO import StringIO

        saved_stdout = sys.stdout
        try:
            out = StringIO()
            sys.stdout = out
            foo()
            output = out.getvalue().strip()

            assert output == 'hello world!'
        finally:
            sys.stdout = saved_stdout
            print output


suite = unittest.TestLoader().loadTestsFromTestCase(Test)
test_result = unittest.TextTestRunner(descriptions=False, verbosity=0, stream=sys.stderr).run(suite)
'''


{'fraction_non_alphanumeric': 0.12809079854073774, 'fraction_numerical': 0.009728415079043373, 'mean_word_length': 2.892744479495268, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '5234897', 'n_tokens_mistral': 786, 'n_tokens_neox': 760, 'n_words': 160}