<commit_before># -*- coding: utf-8 -*-

from helpers import HTTPEventHandler
import looping
import buffer_event

class StatusClient(HTTPEventHandler):

    def __init__(self, server, sock, address, request_parser):
        HTTPEventHandler.__init__(self, server, sock, address, request_parser,
                                  204, b'No content')

class StreamClient(HTTPEventHandler):

    def __init__(self, server, source, sock, address, request_parser, content_type):
        HTTPEventHandler.__init__(self, server, sock, address, request_parser,
                                  200, b'OK', {b'Content-Length': None,
                                               b'Content-Type': content_type})
        self.source = source

    def add_packet(self, packet):
        self.output_buffer.add_buffer(packet)

    def close(self):
        self.server.remove_client(self)
        HTTPEventHandler.close(self)

    def flush_if_ready(self):
        # print 'buffer is ready: %s' % (self.output_buffer.ready)
        if self.output_buffer.ready:
            self.output_buffer.flush()

    def handle_event(self, eventmask):
        if eventmask & looping.POLLOUT:
            # print 'lol I can write, %d items in buffer' % (len(self.output_buffer.buffer_queue))
            self.output_buffer.flush()
        else:
            print 'Unexpected eventmask %s' % (eventmask)<commit_msg>Remove commented out debug print lines<commit_after># -*- coding: utf-8 -*-

from helpers import HTTPEventHandler
import looping
import buffer_event

class StatusClient(HTTPEventHandler):

    def __init__(self, server, sock, address, request_parser):
        HTTPEventHandler.__init__(self, server, sock, address, request_parser,
                                  204, b'No content')

class StreamClient(HTTPEventHandler):

    def __init__(self, server, source, sock, address, request_parser, content_type):
        HTTPEventHandler.__init__(self, server, sock, address, request_parser,
                                  200, b'OK', {b'Content-Length': None,
                                               b'Content-Type': content_type})
        self.source = source

    def add_packet(self, packet):
        self.output_buffer.add_buffer(packet)

    def close(self):
        self.server.remove_client(self)
        HTTPEventHandler.close(self)

    def flush_if_ready(self):
        if self.output_buffer.ready:
            self.output_buffer.flush()

    def handle_event(self, eventmask):
        if eventmask & looping.POLLOUT:
            self.output_buffer.flush()
        else:
            print 'Unexpected eventmask %s' % (eventmask)
{'fraction_non_alphanumeric': 0.09646790733004178, 'fraction_numerical': 0.005317128750474744, 'mean_word_length': 2.4386422976501305, '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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '554739', 'n_tokens_mistral': 751, 'n_tokens_neox': 725, 'n_words': 172}