<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
MicroPsi server application.

This version of MicroPsi is meant to be deployed as a web server, and accessed through a browser.
For local use, simply start this server and point your browser to "http://localhost:6543".
The latter parameter is the default port and can be changed as needed.
"""

__author__ = 'joscha'
__date__ = '15.05.12'


from micropsi_core import runtime
from micropsi_core import tools
from micropsi_core import emoexpression

import micropsi_core.tools
from micropsi_server import usermanagement
from micropsi_server import bottle
from micropsi_server.bottle import Bottle, run, request, response, template, static_file, redirect
import argparse
import os
import json
import inspect
from micropsi_server import minidoc

from configuration import config as cfg

VERSION = cfg['micropsi2']['version']
APPTITLE = cfg['micropsi2']['apptitle']

APP_PATH = os.path.dirname(__file__)

micropsi_app = Bottle()

bottle.debug(False)  # devV

bottle.TEMPLATE_PATH.insert(0, os.path.join(APP_PATH, 'view', ''))
bottle.TEMPLATE_PATH.insert(1, os.path.join(APP_PATH, 'static', ''))

# runtime = micropsi_core.runtime.MicroPsiRuntime()
usermanager = usermanagement.UserManager()


def rpc(command, route_prefix="/rpc/", method="GET", permission_required=None):
    """Defines a decorator for accessing API calls. Use it by specifying the
    API method, followed by the permissions necessary to execute the method.
    Within the calling web page, use http://<url>/rpc/<method>(arg1="val1", arg2="val2", ...)
    Import these arguments into your decorated function:
        @rpc("my_method")
        def this_is_my_method(arg1, arg2):
            pass

    This will return a JSON object, containing `status` and `data`<commit_msg>optional debug config<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
MicroPsi server application.

This version of MicroPsi is meant to be deployed as a web server, and accessed through a browser.
For local use, simply start this server and point your browser to "http://localhost:6543".
The latter parameter is the default port and can be changed as needed.
"""

__author__ = 'joscha'
__date__ = '15.05.12'


from micropsi_core import runtime
from micropsi_core import tools
from micropsi_core import emoexpression

import micropsi_core.tools
from micropsi_server import usermanagement
from micropsi_server import bottle
from micropsi_server.bottle import Bottle, run, request, response, template, static_file, redirect
import argparse
import os
import json
import inspect
from micropsi_server import minidoc

from configuration import config as cfg

VERSION = cfg['micropsi2']['version']
APPTITLE = cfg['micropsi2']['apptitle']

APP_PATH = os.path.dirname(__file__)

micropsi_app = Bottle()

bottle.debug(cfg['micropsi2'].get('debug', False))  # devV

bottle.TEMPLATE_PATH.insert(0, os.path.join(APP_PATH, 'view', ''))
bottle.TEMPLATE_PATH.insert(1, os.path.join(APP_PATH, 'static', ''))

# runtime = micropsi_core.runtime.MicroPsiRuntime()
usermanager = usermanagement.UserManager()


def rpc(command, route_prefix="/rpc/", method="GET", permission_required=None):
    """Defines a decorator for accessing API calls. Use it by specifying the
    API method, followed by the permissions necessary to execute the method.
    Within the calling web page, use http://<url>/rpc/<method>(arg1="val1", arg2="val2", ...)
    Import these arguments into your decorated function:
        @rpc("my_method")
        def this_is_my_method(arg1, arg2):
            pass

    This will return a JSON object, containing `status` and `data`
{'fraction_non_alphanumeric': 0.10145324924595558, 'fraction_numerical': 0.011790512750205649, 'mean_word_length': 4.874396135265701, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '102354', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1070, 'n_words': 368}