<commit_before>from __future__ import print_function, unicode_literals
from datetime import datetime
from itertools import chain
from six import iteritems, binary_type, next
from six.moves.http_client import responses


RFC1123_DATETIME_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
STATUS_LINE = b'{} {} {}\r\n'
CRLF = b'\r\n'


reasons = dict(responses)
reasons.update({
    100: 'Continue after ICAP Preview',
    204: 'No modifications needed',
    404: 'ICAP Service not found',
    405: 'Method not allowed for service',
    408: 'Request timeout',
    500: 'Server error',
})


class ICAPResponseHeaders(dict):

    def __setitem__(self, key, value):
        return super(ICAPResponseHeaders, self).__setitem__(key.title(), value)

    def write(self, wfile):
        for key, value in iteritems(self):
            if isinstance(value, list):
                line = '{}: {}\r\n'.format(key, ', '.join(value))
            else:
                line = '{}: {}\r\n'.format(key, value)
            wfile.write(line)
        wfile.write(CRLF)


def now_rfc1123():
    return datetime.utcnow().strftime(RFC1123_DATETIME_FORMAT)


class EndOnExit(object):

    def __init__(self, response):
        self.response = response

    def __enter__(self):
        return self.response

    def __exit__(self, *exc_info):
        if not any(exc_info):
            self.response.end()<commit_msg>Remove dead code<commit_after>from __future__ import print_function, unicode_literals
from datetime import datetime
from itertools import chain
from six import iteritems, binary_type, next
from six.moves.http_client import responses


RFC1123_DATETIME_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
STATUS_LINE = b'{} {} {}\r\n'
CRLF = b'\r\n'


reasons = dict(responses)
reasons.update({
    100: 'Continue after ICAP Preview',
    204: 'No modifications needed',
    404: 'ICAP Service not found',
    405: 'Method not allowed for service',
    408: 'Request timeout',
    500: 'Server error',
})


class ICAPResponseHeaders(dict):

    def __setitem__(self, key, value):
        return super(ICAPResponseHeaders, self).__setitem__(key.title(), value)

    def write(self, wfile):
        for key, value in iteritems(self):
            if isinstance(value, list):
                line = '{}: {}\r\n'.format(key, ', '.join(value))
            else:
                line = '{}: {}\r\n'.format(key, value)
            wfile.write(line)
        wfile.write(CRLF)


def now_rfc1123():
    return datetime.utcnow().strftime(RFC1123_DATETIME_FORMAT)
{'fraction_non_alphanumeric': 0.1285316354954238, 'fraction_numerical': 0.0238758456028651, 'mean_word_length': 3.114566284779051, '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': '5964153', 'n_tokens_mistral': 866, 'n_tokens_neox': 799, 'n_words': 215}