<commit_before>from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, \
                        HttpResponseServerError, HttpResponseBadRequest, HttpResponseNotAllowed
from django.contrib.auth import login, authenticate
from forms import RegistrationForm
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.models import User

from datetime import datetime, timedelta

from annotatetext.models import Annotation
from actstream import unfollow, follow
from actstream.models import Action
from forms import EditProfileForm

from knesset.accounts.models import EmailValidation
from knesset.mks.models import Member
from knesset.agendas.models import Agenda
from knesset.hashnav import DetailView, ListView
from knesset.tagvotes.models import TagVote

class PublicUserProfile(DetailView):

    queryset = User.objects.all()
    template_resource_name = 'viewed_user' # can't be 'user' because that name is 
                                           # overriden by request context processor!
    slug_field='username'

    def get_context(self):
        context = super(PublicUserProfile, self).get_context()
        context['annotations'] = Annotation.objects.filter(user = context['viewed_user'])
        context['tagged_items'] = TagVote.objects.filter(user = context['viewed_user'])
        return context


class ProfileListView(ListView):

    queryset = User.objects.order_by('username').filter(profiles__public_profile=True)
    template_name = 'user/profile_list.html'

class AggregatedAction:
    def __init__(self, actor, verb):
        self.actor = actor
        self.verb = verb
        self.targets = {}
        self.timestamp = datetime.now()
    
    def __str__(self):
        return self.actor.__str__()+" "+self.verb.__str__()+" "+self.targets.__str__()

AGGREGATION_BREAK_PERIOD = timedelta(0, 15*60) #15 minutes<commit_msg>ordering annotations<commit_after>from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, \
                        HttpResponseServerError, HttpResponseBadRequest, HttpResponseNotAllowed
from django.contrib.auth import login, authenticate
from forms import RegistrationForm
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth.models import User

from datetime import datetime, timedelta

from annotatetext.models import Annotation
from actstream import unfollow, follow
from actstream.models import Action
from forms import EditProfileForm

from knesset.accounts.models import EmailValidation
from knesset.mks.models import Member
from knesset.agendas.models import Agenda
from knesset.hashnav import DetailView, ListView
from knesset.tagvotes.models import TagVote

class PublicUserProfile(DetailView):

    queryset = User.objects.all()
    template_resource_name = 'viewed_user' # can't be 'user' because that name is 
                                           # overriden by request context processor!
    slug_field='username'

    def get_context(self):
        context = super(PublicUserProfile, self).get_context()
        user = context['viewed_user']
        context.update ({
            'annotations': Annotation.objects.filter(user=user).order_by('content_type', 'object_id'),
            'tagged_items': TagVote.objects.filter(user=user),
        })
        return context


class ProfileListView(ListView):

    queryset = User.objects.order_by('username').filter(profiles__public_profile=True)
    template_name = 'user/profile_list.html'

class AggregatedAction:
    def __init__(self, actor, verb):
        self.actor = actor
        self.verb = verb
        self.targets = {}
        self.timestamp = datetime.now()
    
    def __str__(self):
        return self.actor.__str__()+" "+self.verb.__str__()+" "+self.targets.__str__()

AGGREGATION_BREAK_PERIOD = timedelta(0, 15*60) #15 minutes
{'fraction_non_alphanumeric': 0.07994255624700813, 'fraction_numerical': 0.004786979415988511, 'mean_word_length': 4.028880866425993, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6580901', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1116, 'n_words': 290}