<commit_before># -*- coding: UTF-8 -*-
from assopy import settings

from django import forms
from django import template
from django.conf import settings as dsettings
from django.core.urlresolvers import reverse

from urllib import quote_plus

register = template.Library()

_field_tpl = template.Template("""
    <div class="{{ classes|join:" " }}">
        <label for="{{ field.auto_id }}">{% if field.field.required %}<span class="show-tooltip required" title="required">*</span>{% endif %}{{ field.label }}</label>
        {{ field }}
        {% if field.help_text %}<div class="help-text">{{ field.help_text|safe }}</div>{% endif %}
        {{ field.errors }}
    </div>
""")
@register.filter()
def field(field, cls=None):
    classes = [ 'field' ]
    if field.field.required:
        classes.append('required')
    if cls:
        classes.extend(cls.split(','))
    classes.append(field.field.__class__.__name__.lower())
    if field.errors:
        classes.append('error')
    if isinstance(field.field.widget, (forms.HiddenInput,)):
        return str(field)
    else:
        return _field_tpl.render(template.Context(locals()))<commit_msg>sostituito l'* con la dicitura (required)<commit_after># -*- coding: UTF-8 -*-
from assopy import settings

from django import forms
from django import template
from django.conf import settings as dsettings
from django.core.urlresolvers import reverse

from urllib import quote_plus

register = template.Library()

_field_tpl = template.Template("""
    <div class="{{ classes|join:" " }}">
        <label for="{{ field.auto_id }}">{{ field.label }}{% if field.field.required %}<span class="required">(required)</span>{% endif %}</label>
        {{ field }}
        {% if field.help_text %}<div class="help-text">{{ field.help_text|safe }}</div>{% endif %}
        {{ field.errors }}
    </div>
""")
@register.filter()
def field(field, cls=None):
    classes = [ 'field' ]
    if field.field.required:
        classes.append('required')
    if cls:
        classes.extend(cls.split(','))
    classes.append(field.field.__class__.__name__.lower())
    if field.errors:
        classes.append('error')
    if isinstance(field.field.widget, (forms.HiddenInput,)):
        return str(field)
    else:
        return _field_tpl.render(template.Context(locals()))
{'fraction_non_alphanumeric': 0.16341569137407888, 'fraction_numerical': 0.0008669267446900737, 'mean_word_length': 3.552268244575937, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6324977', 'n_tokens_mistral': 699, 'n_tokens_neox': 692, 'n_words': 166}