<commit_before>from flask_restful import Resource
from ubertool.ubertool.stir import stir
from flask import request
import pandas as pd


class StirHandler(Resource):
    def __init__(self):
        self.name = "stir"

    def get(self, jid):
        """
        STIR get handler.
        :param jid:
        :return:
        """
        return {
            'result': {
                'model: ' + self.name,
                'jid: %s' % jid
            }
        }

    def post(self, jid):
        """
        STIR post handler.
        :param jid:
        :return:
        """
        pd_obj = pd.DataFrame.from_dict(request.json["inputs"], dtype='float64')
        stir_obj = stir.Stir(pd_obj, None)
        stir_obj.execute_model()
        inputs_json, outputs_json, exp_out_json = stir_obj.get_dict_rep(stir_obj)

        return {
            'user_id': 'admin',
            'inputs': inputs_json,
            'outputs': outputs_json,
            'exp_out': exp_out_json,
            '_id': jid,
            'run_type': "single"
        }

    @staticmethod
    def get_model_inputs():
        """
        Return terrplant input class.
        :return:
        """
        return stir.StirInputs()

    @staticmethod
    def get_model_outputs():
        """
        Return terrplant output class.
        :return:
        """
        return stir.StirOutputs()<commit_msg>[flask] Route handler docstring fixes, cont.<commit_after>from flask_restful import Resource
from ubertool.ubertool.stir import stir
from flask import request
import pandas as pd


class StirHandler(Resource):
    def __init__(self):
        self.name = "stir"

    def get(self, jid):
        """
        STIR get handler.
        :param jid:
        :return:
        """
        return {
            'result': {
                'model: ' + self.name,
                'jid: %s' % jid
            }
        }

    def post(self, jid):
        """
        STIR post handler.
        :param jid:
        :return:
        """
        pd_obj = pd.DataFrame.from_dict(request.json["inputs"], dtype='float64')
        stir_obj = stir.Stir(pd_obj, None)
        stir_obj.execute_model()
        inputs_json, outputs_json, exp_out_json = stir_obj.get_dict_rep(stir_obj)

        return {
            'user_id': 'admin',
            'inputs': inputs_json,
            'outputs': outputs_json,
            'exp_out': exp_out_json,
            '_id': jid,
            'run_type': "single"
        }

    @staticmethod
    def get_model_inputs():
        """
        Return model's input class.
        :return:
        """
        return stir.StirInputs()

    @staticmethod
    def get_model_outputs():
        """
        Return model's output class.
        :return:
        """
        return stir.StirOutputs()
{'fraction_non_alphanumeric': 0.11147069399496584, 'fraction_numerical': 0.001438331535418914, 'mean_word_length': 1.6470028544243578, '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': '3373472', 'n_tokens_mistral': 860, 'n_tokens_neox': 833, 'n_words': 186}