<commit_before>from django.core.handlers.base import BaseHandler
from django.utils import datastructures, httpwrappers
from pprint import pformat

STATUS_CODE_TEXT = {
    200: 'OK',
    404: 'NOT FOUND',
    500: 'INTERNAL SERVER ERROR',
}

class WSGIRequest(httpwrappers.HttpRequest):
    def __init__(self, environ):
        self.environ = environ
        self.path = environ['PATH_INFO']
        self.META = environ

    def __repr__(self):
        from pprint import pformat
        return '<DjangoRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
            (pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
            pformat(self.META))

    def get_full_path(self):
        return '%s%s' % (self.path, self.environ['QUERY_STRING'] and ('?' + self.environ['QUERY_STRING']) or '')

    def _load_post_and_files(self):
        # Populates self._post and self._files
        if self.environ['REQUEST_METHOD'] == 'POST':
            post_data = self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"]))
            if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
                header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
                self._post, self._files = httpwrappers.parse_file_upload(header_dict, post_data)
            else:
                self._post, self._files = httpwrappers.QueryDict(post_data), datastructures.MultiValueDict()
        else:
            self._post, self._files = httpwrappers.QueryDict(''), datastructures.MultiValueDict()

    def _get_request(self):
        if not hasattr(self, '_request'):
           self._request = datastructures.MergeDict(self.POST, self.GET)
        return self._request

    def _get_get(self):
        if not hasattr(self, '_get'):
            self._get = httpwrappers.QueryDict(self.environ['QUERY_STRING'])
        return self._get

    def _set_get(self, get):
        self._get = get

    def _get_post(self):
        if not hasattr(self, '_post'):<commit_msg>Fixed #192 -- File uploads now work with built-in Web server. Thanks, <EMAIL><commit_after>from django.core.handlers.base import BaseHandler
from django.utils import datastructures, httpwrappers
from pprint import pformat

STATUS_CODE_TEXT = {
    200: 'OK',
    404: 'NOT FOUND',
    500: 'INTERNAL SERVER ERROR',
}

class WSGIRequest(httpwrappers.HttpRequest):
    def __init__(self, environ):
        self.environ = environ
        self.path = environ['PATH_INFO']
        self.META = environ

    def __repr__(self):
        from pprint import pformat
        return '<DjangoRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
            (pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
            pformat(self.META))

    def get_full_path(self):
        return '%s%s' % (self.path, self.environ['QUERY_STRING'] and ('?' + self.environ['QUERY_STRING']) or '')

    def _load_post_and_files(self):
        # Populates self._post and self._files
        if self.environ['REQUEST_METHOD'] == 'POST':
            post_data = self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"]))
            if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
                header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
                header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
                self._post, self._files = httpwrappers.parse_file_upload(header_dict, post_data)
            else:
                self._post, self._files = httpwrappers.QueryDict(post_data), datastructures.MultiValueDict()
        else:
            self._post, self._files = httpwrappers.QueryDict(''), datastructures.MultiValueDict()

    def _get_request(self):
        if not hasattr(self, '_request'):
           self._request = datastructures.MergeDict(self.POST, self.GET)
        return self._request

    def _get_get(self):
        if not hasattr(self, '_get'):
            self._get = httpwrappers.QueryDict(self.environ['QUERY_STRING'])
        return self._get

    def _set_get(self, get):
        self._get = get

    def _get_post(self):
        if not hasattr(self, '_post'):
{'fraction_non_alphanumeric': 0.13194941541398233, 'fraction_numerical': 0.005010737294201861, 'mean_word_length': 2.91044776119403, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1526260', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1328, 'n_words': 262}