<commit_before># -*- coding:utf-8 -*-

from django.template import Context, Template
from django import template
register = template.Library()

def dict_to_attribs(options):
    """
    Transforma un `dict` en atributos del estilo key="val" y devuelve un string
    """

    return " ".join([
        "%s=\"%s\"" % (key, val) 
        for key, val in options.iteritems()
        ])

def skeleton_get_html_attributes(context):
    pass

def skeleton_get_meta(context):
    pass

def skeleton_get_style(context):
    pass

def skeleton_get_head_scripts(context):
    pass

def skeleton_get_body_attributes(context):
    pass

def skeleton_get_header(context):
    pass

def skeleton_get_footer(context):
    pass

def skeleton_get_scripts(context):
    pass


def render_as_list(context, object_list, tag_wrapper='ul', \
        tag_wrapper_attribs='class="no-bullet"', tag_wrapper_element='li', \
        tag_wrapper_element_attribs='', tag_element='', tag_element_attribs=''):

    if isinstance(tag_wrapper_attribs, dict):
        tag_wrapper_attribs = dict_to_attribs(tag_wrapper_attribs)

    if isinstance(tag_wrapper_attribs, dict):
        tag_wrapper_element_attribs = dict_to_attribs(tag_wrapper_element_attribs)

    if isinstance(tag_element_attribs, dict):
        tag_element_attribs = dict_to_attribs(tag_element_attribs)

    element = '{{ object }}'

    if tag_element:
        element = "<%(tag)s %(attribs)s>{{ object }}</%(tag)s>" % {
                'tag':tag_element, 
                'attribs': tag_element_attribs
            }

    args = {
        'tag_wrapper': tag_wrapper,
        'tag_wrapper_attribs': tag_wrapper_attribs,
        'tag_wrapper_element': tag_wrapper_element,
        'tag_wrapper_element_attribs': tag_wrapper_element_attribs,
        'element': element
    }

    template = Template("""<commit_msg>add field object in templatetags<commit_after># -*- coding:utf-8 -*-

from django.template import Context, Template
from django import template
register = template.Library()

def dict_to_attribs(options):
    """
    Transforma un `dict` en atributos del estilo key="val" y devuelve un string
    """

    return " ".join([
        "%s=\"%s\"" % (key, val) 
        for key, val in options.iteritems()
        ])

def skeleton_get_html_attributes(context):
    pass

def skeleton_get_meta(context):
    pass

def skeleton_get_style(context):
    pass

def skeleton_get_head_scripts(context):
    pass

def skeleton_get_body_attributes(context):
    pass

def skeleton_get_header(context):
    pass

def skeleton_get_footer(context):
    pass

def skeleton_get_scripts(context):
    pass


def render_as_list(context, object_list, tag_wrapper='ul', \
        tag_wrapper_attribs='class="no-bullet"', tag_wrapper_element='li', \
        tag_wrapper_element_attribs='', tag_element='', tag_element_attribs='', \
        object_field=''):

    if isinstance(tag_wrapper_attribs, dict):
        tag_wrapper_attribs = dict_to_attribs(tag_wrapper_attribs)

    if isinstance(tag_wrapper_attribs, dict):
        tag_wrapper_element_attribs = dict_to_attribs(tag_wrapper_element_attribs)

    if isinstance(tag_element_attribs, dict):
        tag_element_attribs = dict_to_attribs(tag_element_attribs)

    object_tag = 'object'
    
    if object_field:
        object_tag = 'object.%s' % object_field

    if tag_element:
        element = "<%(tag)s %(attribs)s>{{ %(object_tag) }}</%(tag)s>" % {
                'tag':tag_element, 
                'attribs': tag_element_attribs,
                'object_tag': object_tag
            }
    else:
        element = "{{ %s }}" % object_tag

    args = {
        'tag_wrapper': tag_wrapper,
        'tag_wrapper_attribs': tag_wrapper_attribs,
        'tag_wrapper_element': tag_wrapper_element,
        'tag_wrapper_element_attribs': tag_wrapper_element_attribs,
        'element': element
    }

    template = Template("""
{'fraction_non_alphanumeric': 0.1092071611253197, 'fraction_numerical': 0.0005115089514066496, 'mean_word_length': 3.3993250843644542, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1877269', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1270, 'n_words': 235}