<commit_before>from gevent import sleep

from spinoff.actor import Actor
from spinoff.contrib.http.server import HttpServer


class Main(Actor):
    def run(self):
        http_srv = self.spawn(HttpServer.using(address=('localhost', 8080), responders=[
            (r'^/$', IndexResponder),
            (r'^/foo$', FooResponder),
        ]))
        http_srv.join()


class IndexResponder(Actor):
    def run(self, request):
        request.start_response('200 OK', [('Content-Type', 'text/html')])
        request.write('index')
        request.close()


class FooResponder(Actor):
    def run(self, request):
        request.start_response('200 OK', [('Content-Type', 'text/html')])
        request.write('foo\n')
        self.spawn(SubResponder.using(request))


class SubResponder(Actor):
    def run(self, req):
        sleep(1.0)
        req.write('sub\n')
        req.close()
<commit_msg>Use shorter import in examples.005_http<commit_after>from gevent import sleep

from spinoff.actor import Actor
from spinoff.contrib.http import HttpServer


class Main(Actor):
    def run(self):
        http_srv = self.spawn(HttpServer.using(address=('localhost', 8080), responders=[
            (r'^/$', IndexResponder),
            (r'^/foo$', FooResponder),
        ]))
        http_srv.join()


class IndexResponder(Actor):
    def run(self, request):
        request.start_response('200 OK', [('Content-Type', 'text/html')])
        request.write('index')
        request.close()


class FooResponder(Actor):
    def run(self, request):
        request.start_response('200 OK', [('Content-Type', 'text/html')])
        request.write('foo\n')
        self.spawn(SubResponder.using(request))


class SubResponder(Actor):
    def run(self, req):
        sleep(1.0)
        req.write('sub\n')
        req.close()

{'fraction_non_alphanumeric': 0.15257048092868988, 'fraction_numerical': 0.014925373134328358, 'mean_word_length': 2.943355119825708, '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': '333673', 'n_tokens_mistral': 609, 'n_tokens_neox': 564, 'n_words': 114}