<commit_before>import json
from urllib.parse import parse_qs
from cgi import parse_multipart, parse_header
from io import BytesIO


def multipart_params_middleware(func):
    def wrapper(request):
        ctype, pdict = parse_header(request.headers.get('Content-Type', ''))
        if ctype == "multipart/form-data":
            if isinstance(pdict['boundary'], str):
                pdict['boundary'] = pdict['boundary'].encode()
            post_data = parse_multipart(BytesIO(request.body), pdict)
            print(post_data)
            request.multipart_params = {}
            for key, value in post_data.items():
                if len(value) == 1:
                    request.multipart_params[key] = value[0]
                else:
                    request.multipart_params[key] = value
        return func(request)
    return wrapper<commit_msg>Removed accidentally added debug line<commit_after>import json
from urllib.parse import parse_qs
from cgi import parse_multipart, parse_header
from io import BytesIO


def multipart_params_middleware(func):
    def wrapper(request):
        ctype, pdict = parse_header(request.headers.get('Content-Type', ''))
        if ctype == "multipart/form-data":
            if isinstance(pdict['boundary'], str):
                pdict['boundary'] = pdict['boundary'].encode()
            post_data = parse_multipart(BytesIO(request.body), pdict)
            request.multipart_params = {}
            for key, value in post_data.items():
                if len(value) == 1:
                    request.multipart_params[key] = value[0]
                else:
                    request.multipart_params[key] = value
        return func(request)
    return wrapper
{'fraction_non_alphanumeric': 0.10181392627267408, 'fraction_numerical': 0.0023405500292568754, 'mean_word_length': 2.406374501992032, 'pattern_counts': {'":': 2, '<': 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': '5201317', 'n_tokens_mistral': 482, 'n_tokens_neox': 459, 'n_words': 106}