<commit_before>from datetime import datetime, timedelta
from django.http import HttpResponse
from django.views.generic import TemplateView, View
from django.db.models import Avg
import qsstats

from bigbrother.models import ModuleStat
from bigbrother.core import get_module_classes, get_module_by_slug


class BigBrotherIndexView(TemplateView):
    """
    Produces a overview of installed modules
    """

    template_name = 'bigbrother/index.html'

    def get_overview_data(self):
        data = []
        for cls in get_module_classes():
            instance = cls()
            data.append({'name': instance.name,
                         'value': instance.get_val(),
                         'text': instance.get_text(),
                         'warning': instance.check_warning(),
                         'link': instance.link_url})
        return data

    def get_context_data(self, **kwargs):
        ctx = super(BigBrotherIndexView, self).get_context_data(**kwargs)
        ctx.update({
            'bb': self.get_overview_data,
        })
        return ctx


class BigBrotherGraphView(TemplateView):
    """
    Shows a individual module and produces the related graph
    """

    template_name = 'bigbrother/graph.html'
    week_interval = None
    month_interval = None
    year_interval = None

    def get_week_interval(self):
        return self.week_interval or 'days'

    def get_month_interval(self):
        return self.month_interval or 'days'<commit_msg>Re-add call to check_compatible.<commit_after>from datetime import datetime, timedelta
from django.http import HttpResponse
from django.views.generic import TemplateView, View
from django.db.models import Avg
import qsstats

from bigbrother.models import ModuleStat
from bigbrother.core import get_module_classes, get_module_by_slug


class BigBrotherIndexView(TemplateView):
    """
    Produces a overview of installed modules
    """

    template_name = 'bigbrother/index.html'

    def get_overview_data(self):
        data = []
        for cls in get_module_classes():
            instance = cls()
            if instance.check_compatible():
                data.append({'name': instance.name,
                             'value': instance.get_val(),
                             'text': instance.get_text(),
                             'warning': instance.check_warning(),
                             'link': instance.link_url})
        return data

    def get_context_data(self, **kwargs):
        ctx = super(BigBrotherIndexView, self).get_context_data(**kwargs)
        ctx.update({
            'bb': self.get_overview_data,
        })
        return ctx


class BigBrotherGraphView(TemplateView):
    """
    Shows a individual module and produces the related graph
    """

    template_name = 'bigbrother/graph.html'
    week_interval = None
    month_interval = None
    year_interval = None

    def get_week_interval(self):
        return self.week_interval or 'days'

    def get_month_interval(self):
        return self.month_interval or 'days'
{'fraction_non_alphanumeric': 0.0858734841035726, 'fraction_numerical': 0.0, 'mean_word_length': 2.495990836197022, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397050', 'n_tokens_mistral': 834, 'n_tokens_neox': 798, 'n_words': 208}