<commit_before>from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models import get_model
from django.http import HttpResponseRedirect
from django.views.generic import FormView, View
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist

from extra_views import ModelFormSetView
from oscar.apps.basket.signals import basket_addition, voucher_addition
from oscar.core.loading import get_class, get_classes
Applicator = get_class('offer.utils', 'Applicator')
BasketLineForm, AddToBasketForm, BasketVoucherForm, \
        SavedLineFormSet, SavedLineForm, ProductSelectionForm = get_classes(
            'basket.forms', ('BasketLineForm', 'AddToBasketForm',
                             'BasketVoucherForm', 'SavedLineFormSet',
                             'SavedLineForm', 'ProductSelectionForm'))
Repository = get_class('shipping.repository', ('Repository'))


class BasketView(ModelFormSetView):
    model = get_model('basket', 'Line')
    basket_model = get_model('basket', 'Basket')
    form_class = BasketLineForm
    extra = 0
    can_delete = True
    template_name='basket/basket.html'

    def get_queryset(self):
        return self.request.basket.all_lines()

    def get_default_shipping_method(self, basket):
        return Repository().get_default_shipping_method(self.request.user, self.request.basket)

    def get_basket_warnings(self, basket):
        """
        Return a list of warnings that apply to this basket
        """
        warnings = []
        for line in basket.all_lines():
            warning = line.get_warning()<commit_msg>PEP8 changes<commit_after>from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models import get_model
from django.http import HttpResponseRedirect
from django.views.generic import FormView, View
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist

from extra_views import ModelFormSetView
from oscar.apps.basket.signals import basket_addition, voucher_addition
from oscar.core.loading import get_class, get_classes
Applicator = get_class('offer.utils', 'Applicator')
BasketLineForm, AddToBasketForm, BasketVoucherForm, \
        SavedLineFormSet, SavedLineForm, ProductSelectionForm = get_classes(
            'basket.forms', ('BasketLineForm', 'AddToBasketForm',
                             'BasketVoucherForm', 'SavedLineFormSet',
                             'SavedLineForm', 'ProductSelectionForm'))
Repository = get_class('shipping.repository', ('Repository'))


class BasketView(ModelFormSetView):
    model = get_model('basket', 'Line')
    basket_model = get_model('basket', 'Basket')
    form_class = BasketLineForm
    extra = 0
    can_delete = True
    template_name = 'basket/basket.html'

    def get_queryset(self):
        return self.request.basket.all_lines()

    def get_default_shipping_method(self, basket):
        return Repository().get_default_shipping_method(self.request.user, self.request.basket)

    def get_basket_warnings(self, basket):
        """
        Return a list of warnings that apply to this basket
        """
        warnings = []
        for line in basket.all_lines():
            warning = line.get_warning()
{'fraction_non_alphanumeric': 0.08742839915586373, 'fraction_numerical': 0.0009044317154054868, 'mean_word_length': 3.7947976878612715, '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': '7027925', 'n_tokens_mistral': 955, 'n_tokens_neox': 946, 'n_words': 219}