<commit_before>from __future__ import absolute_import

from email.utils import parsedate, formatdate
import mimetypes
import os
import re
from wsgiref.headers import Headers


class StaticFile(object):
    def __init__(self, path):
        self.path = path
        self.headers = Headers([])


class WhiteNoise(object):

    BLOCK_SIZE = 16 * 4096
    GZIP_SUFFIX = '.gz'
    ACCEPT_GZIP_RE = re.compile(r'\bgzip\b')
    FONT_RE = re.compile(r'^.+\.(eot|otf|ttf|woff)$')

    attrs = ('max_age', 'gzip_enabled', 'fonts_allow_all_origins')
    max_age = None
    gzip_enabled = True
    # Set 'Access-Control-Allow-Orign: *' header on all font files
    # so they work in Firefox when served from a different domain
    fonts_allow_all_origins = True

    def __init__(self, application, root=None, prefix=None, **kwargs):
        for attr in self.attrs:
            try:
                setattr(self, attr, kwargs.pop(attr))
            except KeyError:
                pass
        if kwargs:
            raise TypeError("Unexpected keyword argument '{}'".format(
                kwargs.keys()[0]))
        self.application = application
        self.files = {}<commit_msg>Fix exception handling code in Py3<commit_after>from __future__ import absolute_import

from email.utils import parsedate, formatdate
import mimetypes
import os
import re
from wsgiref.headers import Headers


class StaticFile(object):
    def __init__(self, path):
        self.path = path
        self.headers = Headers([])


class WhiteNoise(object):

    BLOCK_SIZE = 16 * 4096
    GZIP_SUFFIX = '.gz'
    ACCEPT_GZIP_RE = re.compile(r'\bgzip\b')
    FONT_RE = re.compile(r'^.+\.(eot|otf|ttf|woff)$')

    # Attributes that can be set by keyword args in the constructor
    attrs = ('max_age', 'gzip_enabled', 'fonts_allow_all_origins')
    max_age = None
    gzip_enabled = True
    # Set 'Access-Control-Allow-Orign: *' header on all font files
    # so they work in Firefox when served from a different domain
    fonts_allow_all_origins = True

    def __init__(self, application, root=None, prefix=None, **kwargs):
        for attr in self.attrs:
            try:
                setattr(self, attr, kwargs.pop(attr))
            except KeyError:
                pass
        if kwargs:
            raise TypeError("Unexpected keyword argument '{}'".format(
                list(kwargs.keys())[0]))
        self.application = application
        self.files = {}
{'fraction_non_alphanumeric': 0.10192386410151454, 'fraction_numerical': 0.006139991813344249, 'mean_word_length': 2.691842900302115, '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': '4509907', 'n_tokens_mistral': 773, 'n_tokens_neox': 736, 'n_words': 206}