<commit_before># -*- coding: utf-8 -*-
from classytags.core import Tag, Options
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import simplejson
from django.utils.text import javascript_quote

register = template.Library()

@register.filter
def js(value):
    return simplejson.dumps(value, cls=DjangoJSONEncoder)

@register.filter
def bool(value):
    if value:
        return 'true'
    else:
        return 'false'

   
class JavascriptString(Tag):
    name = 'javascript_string'
    
    options = Options(
        blocks=[<commit_msg>Use json module instead of django.utils.simplejson for Django 1.5<commit_after># -*- coding: utf-8 -*-
from distutils.version import LooseVersion

from classytags.core import Tag, Options
import django
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.text import javascript_quote

DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')

if DJANGO_1_4:
    from django.utils import simplejson as json
else:
    import json

register = template.Library()

@register.filter
def js(value):
    return json.dumps(value, cls=DjangoJSONEncoder)

@register.filter
def bool(value):
    if value:
        return 'true'
    else:
        return 'false'

   
class JavascriptString(Tag):
    name = 'javascript_string'
    
    options = Options(
        blocks=[
{'fraction_non_alphanumeric': 0.09020436927413672, 'fraction_numerical': 0.007047216349541931, 'mean_word_length': 3.7972972972972974, 'pattern_counts': {'":': 0, '<': 4, '<?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': '1055032', 'n_tokens_mistral': 426, 'n_tokens_neox': 412, 'n_words': 121}