<commit_before>from decimal import Decimal as D
from datetime import datetime, timedelta

from django.views.generic import TemplateView
from django.db.models.loading import get_model
from django.db.models import Avg, Sum, Count

from oscar.core.loading import get_class
from oscar.apps.offer.models import SITE
OrderSummaryForm = get_class('dashboard.forms', 'OrderSummaryForm')
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Voucher = get_model('voucher', 'Voucher')
StockAlert = get_model('partner', 'StockAlert')
Product = get_model('catalogue', 'Product')
Order = get_model('order', 'Order')
Line = get_model('order', 'Line')


class IndexView(TemplateView):
    template_name = 'dashboard/index.html'

    def get_context_data(self, **kwargs):
        ctx = super(IndexView, self).get_context_data(**kwargs)
        ctx.update(self.get_stats())
        return ctx

    def get_active_site_offers(self):
        """
        Return active conditional offers of type "site offer". The returned
        ``Queryset`` of site offers is filtered by end date greater then 
        the current date.
        """
        return ConditionalOffer.objects.filter(end_date__gt=datetime.now(),<commit_msg>Removed broken import statement<commit_after>from decimal import Decimal as D
from datetime import datetime, timedelta

from django.views.generic import TemplateView
from django.db.models.loading import get_model
from django.db.models import Avg, Sum, Count

from oscar.apps.offer.models import SITE
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Voucher = get_model('voucher', 'Voucher')
StockAlert = get_model('partner', 'StockAlert')
Product = get_model('catalogue', 'Product')
Order = get_model('order', 'Order')
Line = get_model('order', 'Line')


class IndexView(TemplateView):
    template_name = 'dashboard/index.html'

    def get_context_data(self, **kwargs):
        ctx = super(IndexView, self).get_context_data(**kwargs)
        ctx.update(self.get_stats())
        return ctx

    def get_active_site_offers(self):
        """
        Return active conditional offers of type "site offer". The returned
        ``Queryset`` of site offers is filtered by end date greater then 
        the current date.
        """
        return ConditionalOffer.objects.filter(end_date__gt=datetime.now(),
{'fraction_non_alphanumeric': 0.10641964670400689, 'fraction_numerical': 0.0, 'mean_word_length': 4.387470997679815, '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': '4096101', 'n_tokens_mistral': 681, 'n_tokens_neox': 663, 'n_words': 185}