<commit_before>from django import template
from datetime import datetime
import calendar

register = template.Library()

def get_type(ob):
    return ob.field.widget.__class__.__name__

def get_form_type(type):
    return {
        'TextInput' : 'text',
        'PasswordInput' : 'password',
        'EmailInput' : 'email'
    }.get(type, 'text')

@register.inclusion_tag('tags/form.html')
def show_form(form):
    return {'form':form}

@register.inclusion_tag('tags/field.html')
def show_field(field, required = True):
    return {'field':field, 'required': "required" if required  else "", 'type':get_form_type(get_type(field))}

@register.simple_tag
def converto_to_hours(amount):
    hours = amount//60
    minutes = amount%60
    return str(hours)+":"+str(minutes) if amount !=0 else ""

@register.simple_tag
def is_weekend(day,month,year):
    result = True
    if day != "Total" and int(day) != calendar.monthrange(year,month)[1]+1:
        fecha = datetime(year,month,day).date()
        result = fecha.weekday() in (5,6)
    return "success" if result else ""

<commit_msg>Nuevo metodo auxiliar para filtrar por meses<commit_after>from django import template
from datetime import datetime
import calendar

register = template.Library()

def get_type(ob):
    return ob.field.widget.__class__.__name__

def get_form_type(type):
    return {
        'TextInput' : 'text',
        'PasswordInput' : 'password',
        'EmailInput' : 'email'
    }.get(type, 'text')

@register.inclusion_tag('tags/form.html')
def show_form(form):
    return {'form':form}

@register.inclusion_tag('tags/field.html')
def show_field(field, required = True):
    return {'field':field, 'required': "required" if required  else "", 'type':get_form_type(get_type(field))}

@register.simple_tag
def converto_to_hours(amount):
    hours = amount//60
    minutes = amount%60
    return str(hours)+":"+str(minutes) if amount !=0 else ""

@register.simple_tag
def is_weekend(day,month,year):
    result = True
    if day != "Total" and int(day) != calendar.monthrange(year,month)[1]+1:
        fecha = datetime(year,month,day).date()
        result = fecha.weekday() in (5,6)
    return "success" if result else ""

@register.simple_tag
def get_month(month,year,bool):
    nextMonth = month
    nextYear = year
    if bool:
        nextMonth+=1
        if nextMonth==13:
            nextMonth = 1
            nextYear+=1
    else:
        nextMonth-=1
        if nextMonth==0:
            nextMonth==12
            nextYear-=1
    return {'nextMonth':nextMonth,'nextYear':nextYear}


{'fraction_non_alphanumeric': 0.1377829820452771, 'fraction_numerical': 0.01092896174863388, 'mean_word_length': 3.634719710669078, 'pattern_counts': {'":': 2, '<': 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': '3629598', 'n_tokens_mistral': 838, 'n_tokens_neox': 821, 'n_words': 189}