<commit_before>from django.views.generic import RedirectView
from django.views.generic.detail import SingleObjectMixin
from django.contrib.auth import login, authenticate, login
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse

class BaseAuthView(SingleObjectMixin, RedirectView):

    def get_redirect_url(self, *args, **kwargs):
        if not self.request.user.is_authenticated() \
            and not hasattr(self.request.user, 'organisation_id'):
            auth_user = authenticate(auth_token=self.kwargs['token'])
            if not auth_user:
                raise PermissionDenied()
            login(self.request, auth_user)
        return reverse('organisation_questions')<commit_msg>Fix indent, PEP-8 style and remove dup import.<commit_after>from django.views.generic import RedirectView
from django.views.generic.detail import SingleObjectMixin
from django.contrib.auth import login, authenticate
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse

class BaseAuthView(SingleObjectMixin, RedirectView):

    def get_redirect_url(self, *args, **kwargs):
        if (not self.request.user.is_authenticated()
                and not hasattr(self.request.user, 'organisation_id')):
            auth_user = authenticate(auth_token=self.kwargs['token'])
            if not auth_user:
                raise PermissionDenied()
            login(self.request, auth_user)
        return reverse('organisation_questions')
{'fraction_non_alphanumeric': 0.0836627140974967, 'fraction_numerical': 0.0006587615283267457, 'mean_word_length': 3.7917981072555205, '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': '5694752', 'n_tokens_mistral': 416, 'n_tokens_neox': 398, 'n_words': 99}