<commit_before>from django import template
from django.conf import settings

register = template.Library()


@register.simple_tag(takes_context=True, name='get_media_url')
def get_media_url(context):
    """For older generations of Django installs (Pre 1.3).

    Note: we avoid conflicts with the media Template Context Processor
    by prepending 'X_' to our custom setting.

    """
    return context.get('X_MEDIA_URL', settings.MEDIA_URL)


@register.simple_tag(takes_context=True, name='get_static_url')
def get_static_url(context):
    """If you're using staticfiles app use this."""
    return context.get('X_STATIC_URL', settings.STATIC_URL)<commit_msg>Changing to old-school template tag classes; context flummoxed me<commit_after>from django import template
from django.conf import settings

register = template.Library()


class MediaURLNode(template.Node):

    def render(self, context):
        return context.get('X_MEDIA_URL', settings.MEDIA_URL)


class StaticURLNode(template.Node):

    def render(self, context):
        return context.get('X_STATIC_URL', settings.STATIC_URL)


def get_media_url(parser, token):
    """For older generations of Django installs (Pre 1.3)."""
    return MediaURLNode()

def get_static_url(parser, token):
    """If you're using the staticfiles app: use this.

    .. note :: we avoid conflicts with the media Template Context Processor
    by prepending 'X_' to our custom setting.

    """
    return StaticURLNode()

get_media_url = register.tag(get_media_url)
get_static_url = register.tag(get_static_url)
{'fraction_non_alphanumeric': 0.09865470852017937, 'fraction_numerical': 0.0025624599615631004, 'mean_word_length': 4.721611721611722, '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': '4606500', 'n_tokens_mistral': 480, 'n_tokens_neox': 455, 'n_words': 136}