<commit_before>import os
import signal

import fooster.web.query

import mcp.common.daemon
import mcp.common.http


class Restart(mcp.common.http.AuthHandler):
    def do_post(self):
        # send SIGUSR1 to main process
        os.kill(mcp.common.daemon.pid, signal.SIGUSR1)

        return 204, None


routes = {'/api/restart' + fooster.web.query.regex: Restart}<commit_msg>add more to mcp api<commit_after>import os
import signal

import fooster.web
import fooster.web.query

import mcp.config

import mcp.common.daemon
import mcp.common.http


class Features(mcp.common.http.AuthHandler):
    def do_get(self):
        # return enabled features
        return 200, {'creation': mcp.config.creation}

class Config(mcp.common.http.AuthHandler):
    def do_get(self):
        # get config
        with open(mcp.config.config + '/server_info.cfg', 'r') as conf:
            return 200, conf.read()

    def do_put(self):
        if not self.auth.admin:
            raise fooster.web.HTTPError(401)

        # update config
        with open(mcp.config.config + '/server_info.cfg', 'w') as conf:
            conf.write(config)

        return 204, None

class Restart(mcp.common.http.AuthHandler):
    def do_post(self):
        if not self.auth.admin:
            raise fooster.web.HTTPError(401)

        # send SIGUSR1 to main process
        os.kill(mcp.common.daemon.pid, signal.SIGUSR1)

        return 204, None


routes = {'/api/features' + fooster.web.query.regex: Features, '/api/config' + fooster.web.query.regex: Config, '/api/restart' + fooster.web.query.regex: Restart}
{'fraction_non_alphanumeric': 0.114971572962729, 'fraction_numerical': 0.015792798483891344, 'mean_word_length': 2.7985611510791366, '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': '6763691', 'n_tokens_mistral': 549, 'n_tokens_neox': 522, 'n_words': 119}