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

"""
Simplified json encoder filter for react_django_templatetags.

Example:
    {{ my_dict|react_json }}
"""

from __future__ import unicode_literals
import json

import django
from django import template
from django.utils.safestring import mark_safe

from django_react_templatetags.mixins import RepresentationMixin
from django_react_templatetags.encoders import ReactRepresentationJSONEncoder


register = template.Library()


@register.filter('react_json')
def json_filter(value):
    return mark_safe(json.dumps(value, cls=ReactRepresentationJSONEncoder))
<commit_msg>Remove unecessary imports<commit_after># -*- coding: utf-8 -*-

"""
Simplified json encoder filter for react_django_templatetags.

Example:
    {{ my_dict|react_json }}
"""

from __future__ import unicode_literals
import json

from django import template
from django.utils.safestring import mark_safe

from django_react_templatetags.encoders import ReactRepresentationJSONEncoder


register = template.Library()


@register.filter('react_json')
def json_filter(value):
    return mark_safe(json.dumps(value, cls=ReactRepresentationJSONEncoder))

{'fraction_non_alphanumeric': 0.08383751080380294, 'fraction_numerical': 0.001728608470181504, 'mean_word_length': 6.423076923076923, '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': '2401157', 'n_tokens_mistral': 355, 'n_tokens_neox': 350, 'n_words': 82}