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

__all__ = ['ENVIRON', 'FORM_DATA_CONTENT_TYPE', 'FORM_DATA_1', 'FORM_DATA_2',
           'PY3', 'handle_single_request']

ENVIRON = {
    'REQUEST_METHOD': 'GET',
    'PATH_INFO': '/',
    'QUERY_STRING': '',
    'CONTENT_TYPE': 'text/plain',
    'CONTENT_LENGTH': '',
    'HTTP_COOKIE': '',
}

# Samples from:
#   http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
FORM_DATA_CONTENT_TYPE = "multipart/form-data; boundary=AaB03x"
FORM_DATA_1 = b"""\
--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--AaB03x--"""
# Added "Content-Length: 268" to work around http://bugs.python.org/issue18013
FORM_DATA_2 = b"""\
--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"
Content-Type: multipart/mixed; boundary=BbC04y
Content-Length: 268

--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary

...contents of file2.gif...
--BbC04y--
--AaB03x--"""

try:
    PY3, basestring, native = False, basestring, str
except NameError:
    PY3, basestring, native = True, str, lambda s: s.decode('latin-1')


class WSGIErrors(object):
    __slots__ = ('response',)<commit_msg>Replace the NameError handling in tests._common<commit_after># -*- coding: utf-8 -*-
import fiole

__all__ = ['ENVIRON', 'FORM_DATA_CONTENT_TYPE', 'FORM_DATA_1', 'FORM_DATA_2',
           'PY3', 'handle_single_request']

ENVIRON = {
    'REQUEST_METHOD': 'GET',
    'PATH_INFO': '/',
    'QUERY_STRING': '',
    'CONTENT_TYPE': 'text/plain',
    'CONTENT_LENGTH': '',
    'HTTP_COOKIE': '',
}

# Samples from:
#   http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
FORM_DATA_CONTENT_TYPE = "multipart/form-data; boundary=AaB03x"
FORM_DATA_1 = b"""\
--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--AaB03x--"""
# Added "Content-Length: 268" to work around http://bugs.python.org/issue18013
FORM_DATA_2 = b"""\
--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"
Content-Type: multipart/mixed; boundary=BbC04y
Content-Length: 268

--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain

... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary

...contents of file2.gif...
--BbC04y--
--AaB03x--"""

PY3 = (''.encode() != '')
basestring = str if PY3 else basestring
native = str if PY3 else lambda s: s.decode('latin-1')


class WSGIErrors(object):
    __slots__ = ('response',)
{'fraction_non_alphanumeric': 0.17590759075907592, 'fraction_numerical': 0.037953795379537955, 'mean_word_length': 4.102693602693603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6565232', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1155, 'n_words': 225}