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

from json import dumps

from circuits.web import Server, Controller


def json(f):
    def wrapper(self, *args, **kwargs):
        return dumps(f(self, *args, **kwargs))
    return wrapper


class Root(Controller):

    @json
    def getrange(self, limit=4):
        return range(int(limit))

app = Server(("0.0.0.0", 8000))
Root().register(app)
app.run()<commit_msg>fix python3 compatibility for jsontool web example (issue #67)<commit_after>#!/usr/bin/env python

from json import dumps

from circuits.web import Server, Controller


def json(f):
    def wrapper(self, *args, **kwargs):
        return dumps(f(self, *args, **kwargs))
    return wrapper


class Root(Controller):

    @json
    def getrange(self, limit=4):
        return list(range(int(limit)))

app = Server(("0.0.0.0", 8000))
Root().register(app)
app.run()
{'fraction_non_alphanumeric': 0.14913294797687862, 'fraction_numerical': 0.024277456647398842, 'mean_word_length': 3.8379888268156424, 'pattern_counts': {'":': 0, '<': 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': '481403', 'n_tokens_mistral': 303, 'n_tokens_neox': 283, 'n_words': 79}