<commit_before>from django import template
register=template.Library()

@register.filter
def autowidth(lst, total=100.0):
   if hasattr(lst, '__len__'): lst=lst.__len__()
   if not isinstance(lst, float): lst=float(lst)
   return round(total/lst, 1)<commit_msg>Fixing the autowidth throwing exception when the list is empty<commit_after>from django import template
register=template.Library()

@register.filter
def autowidth(lst, total=100.0):
   if hasattr(lst, '__len__'): lst=lst.__len__()
   if not isinstance(lst, float): lst=float(lst)
   if lst<1: lst=1
   return round(total/lst, 1)
{'fraction_non_alphanumeric': 0.1271186440677966, 'fraction_numerical': 0.020338983050847456, 'mean_word_length': 5.872093023255814, 'pattern_counts': {'":': 0, '<': 4, '<?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': '7118199', 'n_tokens_mistral': 207, 'n_tokens_neox': 199, 'n_words': 53}