<commit_before>from flask import Blueprint, render_template, request, current_app, Response
from ..decorators import returns_json

from messages import test_message

import json

messenger = Blueprint('messenger', __name__, url_prefix='/messenger')

@messenger.route('/test/', methods=['GET'])
def message_test():
    return render_template('messenger/message_test.html')

@messenger.route('/test_ajax/', methods=['POST'])
@returns_json
def message_test_ajax():
    data_list = json.loads(request.data)
    data = {}
    for d in data_list:
        data[d['name']] = d['value']
    #decode form...

    try:
        msg = data.get('message').__str__()
        topic = data.get('topic').__str__()
        test_message(topic, msg)
        return {'status_code':200,'topic':topic,'message':msg}
    except Exception,e:
        import traceback; traceback.print_exc()
        return {'status_code':400, 'errors':str(e)}
<commit_msg>cleanup<commit_after>from flask import Blueprint, render_template, request, current_app, Response
from ..decorators import returns_json

from messages import test_message

import json

messenger = Blueprint('messenger', __name__, url_prefix='/messenger')

@messenger.route('/test/', methods=['GET'])
def message_test():
    return render_template('messenger/message_test.html')

@messenger.route('/test_ajax/', methods=['POST'])
@returns_json
def message_test_ajax():
    data_list = json.loads(request.data)
    data = {}
    for d in data_list:
        data[d['name']] = d['value']
    #decode form...

    try:
        msg = data.get('message').__str__()
        topic = data.get('topic').__str__()
        test_message(topic, msg)
        return {'status_code':200,'topic':topic,'message':msg}
    except Exception,e:
        return {'status_code':400, 'errors':str(e)}

{'fraction_non_alphanumeric': 0.14983351831298558, 'fraction_numerical': 0.006659267480577136, 'mean_word_length': 4.195965417867435, 'pattern_counts': {'":': 0, '<': 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': '7188860', 'n_tokens_mistral': 578, 'n_tokens_neox': 555, 'n_words': 119}