<commit_before>from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView

from project.forms import ProjectForm
from project.models import Project
from scorinator.score.models import ProjectScore


class ProjectBuildView(DetailView):
    template_name = "project/project_build.html"
    model = Project

    def get_object(self):
        # Call the superclass
        the_object = super(ProjectBuildView, self).get_object()
        # Trigger the build
        the_object.rebuild_score()
        return the_object

    def get_context_data(self, **kwargs):
        from score.models import ProjectScoreAttribute
        if self.object.score:
            kwargs.update(
                score_breakdown=ProjectScoreAttribute.objects.for_score(
                    self.object.pk
                )
            )
        return super(ProjectBuildView, self).get_context_data(**kwargs)


class ProjectListView(ListView):
    template_name = "project/project_list.html"
    model = Project<commit_msg>bad import<commit_after>from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView

from project.forms import ProjectForm
from project.models import Project
from score.models import ProjectScore


class ProjectBuildView(DetailView):
    template_name = "project/project_build.html"
    model = Project

    def get_object(self):
        # Call the superclass
        the_object = super(ProjectBuildView, self).get_object()
        # Trigger the build
        the_object.rebuild_score()
        return the_object

    def get_context_data(self, **kwargs):
        from score.models import ProjectScoreAttribute
        if self.object.score:
            kwargs.update(
                score_breakdown=ProjectScoreAttribute.objects.for_score(
                    self.object.pk
                )
            )
        return super(ProjectBuildView, self).get_context_data(**kwargs)


class ProjectListView(ListView):
    template_name = "project/project_list.html"
    model = Project
{'fraction_non_alphanumeric': 0.06818181818181818, 'fraction_numerical': 0.0, 'mean_word_length': 3.059674502712477, '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': '746046', 'n_tokens_mistral': 590, 'n_tokens_neox': 568, 'n_words': 140}