<commit_before>from django.core.exceptions import ImproperlyConfigured
from django.views.generic import TemplateView
from django.utils.translation import ugettext as _

from .models import Well


class SimpleWellView(TemplateView):
    def render_to_response(self, context, **response_kwargs):
        if not 'params' in context:
            raise ImproperlyConfigured(
                    _(u"Expects `params` to be provided in the context"))
        if not self.template_name:
            if not 'template_name' in context['params']:
                raise ImproperlyConfigured(
                        _(u"Expects `template_name` to be provided"))
            else:
                self.template_name = context['params']['template_name']

        if not 'well_title' in context['params']:
            raise ImproperlyConfigured(_(u"Expects a `well_title` to be provided"))

        well_title = context['params']['well_title']
        context['well'] = Well.objects.get_current(title=well_title)

        return super(SimpleWellView, self).render_to_response(context,
                **response_kwargs)<commit_msg>pep8ify (oops)<commit_after>from django.core.exceptions import ImproperlyConfigured
from django.views.generic import TemplateView
from django.utils.translation import ugettext as _

from .models import Well


class SimpleWellView(TemplateView):
    def render_to_response(self, context, **response_kwargs):
        if not 'params' in context:
            raise ImproperlyConfigured(
                    _(u"Expects `params` to be provided in the context"))
        if not self.template_name:
            if not 'template_name' in context['params']:
                raise ImproperlyConfigured(
                        _(u"Expects `template_name` to be provided"))
            else:
                self.template_name = context['params']['template_name']

        if not 'well_title' in context['params']:
            raise ImproperlyConfigured(
                    _(u"Expects a `well_title` to be provided"))

        well_title = context['params']['well_title']
        context['well'] = Well.objects.get_current(title=well_title)

        return super(SimpleWellView, self).render_to_response(context,
                **response_kwargs)
{'fraction_non_alphanumeric': 0.09139307897071872, 'fraction_numerical': 0.00044365572315882877, 'mean_word_length': 2.7520798668885194, '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': '7037564', 'n_tokens_mistral': 599, 'n_tokens_neox': 577, 'n_words': 153}