<commit_before>import ast

def parse_request(request):
    d = {}
    for (k,v) in request.items():
        d[k] = ast.literal_eval(v) 
    return d<commit_msg>request may be json string or djagno QueryDict<commit_after>import ast
from django.http.request import QueryDict

def parse_request(request):
    d = {}
    if isinstance(request, unicode):
        d = ast.literal_eval(request)
    elif isinstance(request, QueryDict):
        for (k,v) in request.items():
            d[k] = ast.literal_eval(v)
    return d
{'fraction_non_alphanumeric': 0.11196911196911197, 'fraction_numerical': 0.0, 'mean_word_length': 3.152, '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': '6582180', 'n_tokens_mistral': 167, 'n_tokens_neox': 164, 'n_words': 44}