<commit_before>import pygal
from django.db.models import Min, Max
from django.utils import timezone

from djangotrellostats.apps.repositories.models import PylintMessage


# Number of code errors
def number_of_code_errors_by_month(board):
    chart_title = u"Errors by month in project {0} {1}".format(board.name, timezone.now())

    chart = pygal.Line(title=chart_title, legend_at_bottom=True, print_values=True,
                                          print_zeroes=False,
                                          human_readable=True)

    pylint_message_types = dict(PylintMessage.TYPE_CHOICES).keys()

    min_creation_datetime = board.commits.all().aggregate(min_creation_datetime=Min("creation_datetime"))[
        "min_creation_datetime"]
    if min_creation_datetime is None:
        return chart.render_django_response()

    max_creation_datetime = board.commits.all().aggregate(max_creation_datetime=Max("creation_datetime"))[
        "max_creation_datetime"]

    max_month_i = max_creation_datetime.month<commit_msg>Number of errors by month<commit_after>import pygal
from django.db.models import Min, Max
from django.utils import timezone

from djangotrellostats.apps.repositories.models import PylintMessage


# Number of code errors by month
def number_of_code_errors_by_month(board):
    chart_title = u"Errors by month in project {0} {1}".format(board.name, timezone.now())

    chart = pygal.Line(title=chart_title, legend_at_bottom=True, print_values=True,
                                          print_zeroes=False,
                                          human_readable=True)

    pylint_message_types = dict(PylintMessage.TYPE_CHOICES).keys()

    min_creation_datetime = board.commits.all().aggregate(min_creation_datetime=Min("creation_datetime"))[
        "min_creation_datetime"]
    if min_creation_datetime is None:
        return chart.render_django_response()

    max_creation_datetime = board.commits.all().aggregate(max_creation_datetime=Max("creation_datetime"))[
        "max_creation_datetime"]

    max_month_i = max_creation_datetime.month
{'fraction_non_alphanumeric': 0.0853717026378897, 'fraction_numerical': 0.0019184652278177458, 'mean_word_length': 3.625277161862528, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1783857', 'n_tokens_mistral': 631, 'n_tokens_neox': 588, 'n_words': 109}