<commit_before># -*- coding: utf-8 -*-
from datetime import date

from django import template
register = template.Library()

from ..models import Group
from ..utils import calculate_age


@register.filter
def age(value, target=None):
    return calculate_age(value, target=target)


@register.simple_tag
def designation_for(target, target_date=date.today()):
    if isinstance(target, Group):
        return target.designation_for(target=target_date).name
    return target.name


@register.simple_tag
def romanized_designation_for(target, target_date=date.today()):
    if isinstance(target, Group):
        return target.designation_for(target=target_date).romanized_name
    return target.romanized_name
<commit_msg>Don't assume that there's a romanized_name available.<commit_after># -*- coding: utf-8 -*-
from datetime import date

from django import template
register = template.Library()

from ..models import Group
from ..utils import calculate_age


@register.filter
def age(value, target=None):
    return calculate_age(value, target=target)


@register.simple_tag
def designation_for(target, target_date=date.today()):
    if isinstance(target, Group):
        return target.designation_for(target=target_date).name
    return target


@register.simple_tag
def romanized_designation_for(target, target_date=date.today()):
    if isinstance(target, Group):
        return target.designation_for(target=target_date).romanized_name
    return target

{'fraction_non_alphanumeric': 0.09807956104252401, 'fraction_numerical': 0.0013717421124828531, 'mean_word_length': 5.028925619834711, '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': '5440975', 'n_tokens_mistral': 428, 'n_tokens_neox': 416, 'n_words': 106}