<commit_before>from django.http import HttpResponse
from django.core.cache import cache
from mixcloud.utils.decorators import staff_only
from mixcloud.speedbar.utils import DETAILS_PREFIX, TRACE_PREFIX
from mixcloud.utils.decorators import json_response
from gargoyle.decorators import switch_is_active

import json

@staff_only
@switch_is_active('speedbar:panel')
def panel(request, trace_id):
    details = cache.get(DETAILS_PREFIX + trace_id)
    if details:
        details_json = json.dumps(details, skipkeys=True, default=repr, indent=2) # Cannot use decorator as need default=repr
        return HttpResponse(content=details_json, mimetype='text/javascript; charset=utf-8')
    return HttpResponse(status=404)

@staff_only
@switch_is_active('speedbar:trace')
@json_response
def trace(request, trace_id):
    trace = cache.get(TRACE_PREFIX + trace_id)
    if trace:
        return trace
    return HttpResponse(status=404)<commit_msg>Remove mixcloud deps<commit_after>from django.http import HttpResponse
from django.core.cache import cache
from django.contrib.admin.views.decorators import staff_member_required
from mixcloud.speedbar.utils import DETAILS_PREFIX, TRACE_PREFIX
from gargoyle.decorators import switch_is_active

import json

@staff_member_required
@switch_is_active('speedbar:panel')
def panel(request, trace_id):
    details = cache.get(DETAILS_PREFIX + trace_id)
    if details:
        details_json = json.dumps(details, skipkeys=True, default=repr, indent=2) # Cannot use decorator as need default=repr
        return HttpResponse(content=details_json, mimetype='text/javascript; charset=utf-8')
    return HttpResponse(status=404)

@staff_member_required
@switch_is_active('speedbar:trace')
def trace(request, trace_id):
    trace = cache.get(TRACE_PREFIX + trace_id)
    if trace:
        return HttpResponse(json.dumps(trace))
    return HttpResponse(status=404)
{'fraction_non_alphanumeric': 0.08461131676361713, 'fraction_numerical': 0.008461131676361713, 'mean_word_length': 5.781362007168458, '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': '609944', 'n_tokens_mistral': 587, 'n_tokens_neox': 567, 'n_words': 136}