<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set sw=3 sts=3 ts=3

"""(Example) Web Hello

A simple example web server/application displaying "Hello World"
to the user's browser. This example demonstrates how to build a
simple but complete web server and application using circuits.
"""

from circuits import Component
from circuits.web import BaseServer, Response

class HelloWorld(Component):
    """HelloWorld Component

    A Component that will listen to "index" Events and return an appropiate
    HTTP Response with the message "Hello Worl!".
    """

    def request(self, request, response, *args, **kwargs):
        """Index Event Handler

        HTTP Request Handler that listens on the "index' channel which maps
        to http://localhost:8000/ When a Request is received, send back an
        appropiate HTTP Response with contens of the body being "Hello World!"
        """

        response.body = "Hello World!"
        self.send(Response(response), "response")

def main():
    server = BaseServer(8000)
    server += HelloWorld()
    server.run()

if __name__ == "__main__":
    main()
<commit_msg>examples/helloweb.py: Simplified and added psyco<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set sw=3 sts=3 ts=3

"""(Example) Web Hello

A simple example web server/application displaying "Hello World"
to the user's browser. This example demonstrates how to build a
simple but complete web server and application using circuits.
"""

import psyco; psyco.full()

from circuits import Component
from circuits.web import BaseServer

class Root(Component):

    def request(self, request, response):
        return "Hello World!"

def main():
    server = BaseServer(8000)
    server += Root()
    server.run()

if __name__ == "__main__":
    main()

{'fraction_non_alphanumeric': 0.10381004969630038, 'fraction_numerical': 0.011043622308117063, 'mean_word_length': 3.5642317380352644, 'pattern_counts': {'":': 2, '<': 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': '617321', 'n_tokens_mistral': 526, 'n_tokens_neox': 496, 'n_words': 204}