<commit_before>from __future__ import unicode_literals

import json
import posixpath
from xml.sax.saxutils import quoteattr

from django.utils.module_loading import import_string
from django.utils.safestring import mark_safe

import django_cradmin
from django import template
from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
import warnings
from django.urls import reverse

from django_cradmin import crapp
from django_cradmin import crsettings
from django_cradmin import renderable
from django_cradmin.crinstance import reverse_cradmin_url

register = template.Library()


@register.simple_tag(takes_context=True)
def cradmin_titletext_for_role(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.get_titletext_for_role`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.get_titletext_for_role(role)


@register.assignment_tag(takes_context=True)
def cradmin_descriptionhtml_for_role(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.get_titletext_for_role`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.get_descriptionhtml_for_role(role)


@register.simple_tag(takes_context=True)
def cradmin_rolefrontpage_url(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.rolefrontpage_url`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.rolefrontpage_url(cradmin_instance.get_roleid(role))


@register.simple_tag(takes_context=True)
def cradmin_appurl(context, viewname, *args, **kwargs):<commit_msg>cradmin_tags: Use simple_tag instead of assignment_tag.<commit_after>from __future__ import unicode_literals

import json
import posixpath
from xml.sax.saxutils import quoteattr

from django.utils.module_loading import import_string
from django.utils.safestring import mark_safe

import django_cradmin
from django import template
from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
import warnings
from django.urls import reverse

from django_cradmin import crapp
from django_cradmin import crsettings
from django_cradmin import renderable
from django_cradmin.crinstance import reverse_cradmin_url

register = template.Library()


@register.simple_tag(takes_context=True)
def cradmin_titletext_for_role(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.get_titletext_for_role`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.get_titletext_for_role(role)


@register.simple_tag(takes_context=True)
def cradmin_descriptionhtml_for_role(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.get_titletext_for_role`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.get_descriptionhtml_for_role(role)


@register.simple_tag(takes_context=True)
def cradmin_rolefrontpage_url(context, role):
    """
    Template tag implementation of
    :meth:`django_cradmin.crinstance.BaseCrAdminInstance.rolefrontpage_url`.
    """
    request = context['request']
    cradmin_instance = request.cradmin_instance
    return cradmin_instance.rolefrontpage_url(cradmin_instance.get_roleid(role))


@register.simple_tag(takes_context=True)
def cradmin_appurl(context, viewname, *args, **kwargs):
{'fraction_non_alphanumeric': 0.07314468766684463, 'fraction_numerical': 0.0, 'mean_word_length': 6.247582205029014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '813736', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1125, 'n_words': 222}