<commit_before>#!/usr/bin/env python

import json

import tornado.ioloop
import tornado.web

from FetchStats.Plugins import *
import FetchStats

class StatsHandler(tornado.web.RequestHandler):
    """
    Gets and returns the stats.
    """


    _plugins = FetchStats.Fetcher.get_plugins()

    def get(self):
        result = {}
        # 1. load modules to run
        #     - handled in the '... Plugins import *' line

        # 2. Execute each (as a coroutine?)
        #     - currently handled during instantiation

        for plugin in self._plugins:
            context = plugin.context
            result[context] = plugin.dump()
        # 3. Return the json all together
        self.write(json.dumps(result))


application = tornado.web.Application([
    (r'/', StatsHandler),
])


if __name__ == "__main__":
    print "plugins loaded..."
    print "server listening on http://0.0.0.0:8888"
    try:
        application.listen(8888)
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        print "shutting down..."
        exit(0)
<commit_msg>Lets return a helpful content type now<commit_after>#!/usr/bin/env python

import json

import tornado.ioloop
import tornado.web

from FetchStats.Plugins import *
import FetchStats

class StatsHandler(tornado.web.RequestHandler):
    """
    Gets and returns the stats.
    """


    _plugins = FetchStats.Fetcher.get_plugins()

    def get(self):
        result = {}
        # 1. load modules to run
        #     - handled in the '... Plugins import *' line

        # 2. Execute each (as a coroutine?)
        #     - currently handled during instantiation

        for plugin in self._plugins:
            context = plugin.context
            result[context] = plugin.dump()
        # 3. Return the json all together
        self.set_header("Content-Type", "application/json")
        self.write(json.dumps(result))


application = tornado.web.Application([
    (r'/', StatsHandler),
])


if __name__ == "__main__":
    print "plugins loaded..."
    print "server listening on http://0.0.0.0:8888"
    try:
        application.listen(8888)
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        print "shutting down..."
        exit(0)

{'fraction_non_alphanumeric': 0.1133244798583444, 'fraction_numerical': 0.01416555998229305, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '39038', 'n_tokens_mistral': 703, 'n_tokens_neox': 664, 'n_words': 178}