<commit_before>#!flask/bin/python
from flask import Flask, jsonify
from flask import Flask, request
from flask_restful import Resource, Api

from controller.targets import TargetController, TargetsListController
from controller.configuration import ConfigurationController
from controller.defintions import DefinitionsListController, DefinitionController
from controller.experiments import ExperimentsListController, ExperimentController

app = Flask(__name__, static_folder="assets")


# Define Frontend Hosting
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
    return app.send_static_file('index.html')


@app.route('/control.module.chunk.js')
def control():
    return app.send_static_file('control.module.chunk.js')


@app.route('/landingpage.module.chunk.js')
def landingpage():
    return app.send_static_file('landingpage.module.chunk.js')


@app.route('/inline.module.chunk.js')
def inlinechunk():
    return app.send_static_file('inline.module.chunk.js')


@app.route('/polyfills.bundle.js')
def polyfills():
    return app.send_static_file('polyfills.bundle.js')


@app.route('/vendor.bundle.js')
def vendor():
    return app.send_static_file('vendor.bundle.js')


@app.route('/inline.bundle.js')
def inline():
    return app.send_static_file('inline.bundle.js')


@app.route('/main.bundle.js')
def main():
    return app.send_static_file('main.bundle.js')


@app.route('/styles.bundle.css')
def styles():
    return app.send_static_file('styles.bundle.css')


@app.route('/styles.bundle.js')
def stylesJS():
    return app.send_static_file('styles.bundle.js')


# Defining API Part
api = Api(app)
api.add_resource(ConfigurationController, '/api/configuration')
api.add_resource(DefinitionsListController, '/api/definitions')
api.add_resource(DefinitionController, '/api/definitions/<string:id>')
api.add_resource(ExperimentsListController, '/api/experiments')
api.add_resource(ExperimentController, '/api/experiments/<string:id>')
api.add_resource(TargetsListController, '/api/targets')
api.add_resource(TargetController, '/api/targets/<string:id>')

if __name__ == '__main__':
    from tornado.wsgi import WSGIContainer
    from tornado.httpserver import HTTPServer
    from tornado.ioloop import IOLoop
    from tornado.log import enable_pretty_logging

    http_server = HTTPServer(WSGIContainer(app))
    http_server.listen(5000)<commit_msg>fix cors<commit_after>#!flask/bin/python
from flask import Flask, jsonify
from flask import Flask, request
from flask_restful import Resource, Api

from controller.targets import TargetController, TargetsListController
from controller.configuration import ConfigurationController
from controller.defintions import DefinitionsListController, DefinitionController
from controller.experiments import ExperimentsListController, ExperimentController

app = Flask(__name__, static_folder="assets")


# Define Frontend Hosting
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
    return app.send_static_file('index.html')


@app.route('/control.module.chunk.js')
def control():
    return app.send_static_file('control.module.chunk.js')


@app.route('/landingpage.module.chunk.js')
def landingpage():
    return app.send_static_file('landingpage.module.chunk.js')


@app.route('/inline.module.chunk.js')
def inlinechunk():
    return app.send_static_file('inline.module.chunk.js')


@app.route('/polyfills.bundle.js')
def polyfills():
    return app.send_static_file('polyfills.bundle.js')


@app.route('/vendor.bundle.js')
def vendor():
    return app.send_static_file('vendor.bundle.js')


@app.route('/inline.bundle.js')
def inline():
    return app.send_static_file('inline.bundle.js')


@app.route('/main.bundle.js')
def main():
    return app.send_static_file('main.bundle.js')


@app.route('/styles.bundle.css')
def styles():
    return app.send_static_file('styles.bundle.css')


@app.route('/styles.bundle.js')
def stylesJS():
    return app.send_static_file('styles.bundle.js')


# Defining API Part
api = Api(app)
api.add_resource(ConfigurationController, '/api/configuration')
api.add_resource(DefinitionsListController, '/api/definitions')
api.add_resource(DefinitionController, '/api/definitions/<string:id>')
api.add_resource(ExperimentsListController, '/api/experiments')
api.add_resource(ExperimentController, '/api/experiments/<string:id>')
api.add_resource(TargetsListController, '/api/targets')
api.add_resource(TargetController, '/api/targets/<string:id>')

if __name__ == '__main__':
    from tornado.wsgi import WSGIContainer
    from tornado.httpserver import HTTPServer
    from tornado.ioloop import IOLoop
    from tornado.log import enable_pretty_logging
    from flask_cors import CORS
    cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
    http_server = HTTPServer(WSGIContainer(app))
    http_server.listen(5000)
{'fraction_non_alphanumeric': 0.1378533387955756, 'fraction_numerical': 0.0016386726751331422, 'mean_word_length': 5.965763195435093, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, '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': '5178887', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1493, 'n_words': 276}