<commit_before>import re
from datetime import datetime
from urllib.parse import unquote_plus
from markdown2 import markdown
import geopy

from django.db.models import Q
from django.views import generic
from django.conf import settings
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import get_object_or_404
from django.contrib import messages
from django.contrib.auth import get_user_model, authenticate, login
from django.template.loader import render_to_string, get_template
from django.template import Context
from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.utils.html import linebreaks as tohtmlpara, urlize
from django.utils.http import urlquote_plus
from django.utils.encoding import uri_to_iri

from rest_framework import viewsets
from braces.views import (AnonymousRequiredMixin, LoginRequiredMixin,
    SuperuserRequiredMixin, UserPassesTestMixin, FormInvalidMessageMixin)
from geopy.exc import GeocoderTimedOut, GeocoderServiceError

from .models import Profile, Place, Phone
from .serializers import ProfileSerializer, PlaceSerializer, UserSerializer
from .mixins import (ProfileMixin, ProfileAuthMixin, PlaceAuthMixin, PhoneAuthMixin,
    FamilyMemberMixin, FamilyMemberAuthMixin, CreateMixin, DeleteMixin)
from .forms import (UserRegistrationForm, AuthorizeUserForm, AuthorizedOnceUserForm,
    ProfileForm, ProfileSettingsForm, ProfileCreateForm, PhoneForm, PhoneCreateForm,
    PlaceForm, PlaceCreateForm, FamilyMemberForm, FamilyMemberCreateForm,
    MassMailForm,
)
from .utils import extend_bbox, send_mass_html_mail


User = get_user_model()
lang = settings.LANGUAGE_CODE


class UserViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows users to be viewed or edited.
    """
    queryset = User.objects.all().order_by('-date_joined')
    serializer_class = UserSerializer


class ProfileViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows profiles to be viewed or edited.
    """
    serializer_class = ProfileSerializer
    queryset = Profile.objects.all()


class PlaceViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows places to be viewed or edited.
    """
    serializer_class = PlaceSerializer
    queryset = Place.objects.filter(
        latitude__isnull=False,
        longitude__isnull=False,
    )


class HomeView(generic.TemplateView):
    template_name = 'hosting/home.html'

home = HomeView.as_view()
<commit_msg>API: Filtrebleco laŭ koordinatoj.<commit_after>import re
from datetime import datetime
from urllib.parse import unquote_plus
from markdown2 import markdown
import geopy

from django.db.models import Q
from django.views import generic
from django.conf import settings
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import get_object_or_404
from django.contrib import messages
from django.contrib.auth import get_user_model, authenticate, login
from django.template.loader import render_to_string, get_template
from django.template import Context
from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.utils.html import linebreaks as tohtmlpara, urlize
from django.utils.http import urlquote_plus
from django.utils.encoding import uri_to_iri

from rest_framework import viewsets
from braces.views import (AnonymousRequiredMixin, LoginRequiredMixin,
    SuperuserRequiredMixin, UserPassesTestMixin, FormInvalidMessageMixin)
from geopy.exc import GeocoderTimedOut, GeocoderServiceError

from .models import Profile, Place, Phone
from .serializers import ProfileSerializer, PlaceSerializer, UserSerializer
from .mixins import (ProfileMixin, ProfileAuthMixin, PlaceAuthMixin, PhoneAuthMixin,
    FamilyMemberMixin, FamilyMemberAuthMixin, CreateMixin, DeleteMixin)
from .forms import (UserRegistrationForm, AuthorizeUserForm, AuthorizedOnceUserForm,
    ProfileForm, ProfileSettingsForm, ProfileCreateForm, PhoneForm, PhoneCreateForm,
    PlaceForm, PlaceCreateForm, FamilyMemberForm, FamilyMemberCreateForm,
    MassMailForm,
)
from .utils import extend_bbox, send_mass_html_mail


User = get_user_model()
lang = settings.LANGUAGE_CODE


class UserViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows users to be viewed or edited.
    """
    queryset = User.objects.all().order_by('-date_joined')
    serializer_class = UserSerializer


class ProfileViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows profiles to be viewed or edited.
    """
    serializer_class = ProfileSerializer
    queryset = Profile.objects.all()


class PlaceViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows places to be viewed or edited.
    """
    serializer_class = PlaceSerializer
    queryset = Place.objects.filter(
        latitude__isnull=False,
        longitude__isnull=False,
    )

    def get_queryset(self):
        qs = self.queryset
        bounds = {p: self.request.query_params.get(p, None) for p in 'nswe'}
        if any(bounds.values()):
            qs = qs.filter(latitude__range=(bounds['s'], bounds['n']))
            qs = qs.filter(longitude__range=(bounds['w'], bounds['e']))
        return qs


class HomeView(generic.TemplateView):
    template_name = 'hosting/home.html'

home = HomeView.as_view()

{'fraction_non_alphanumeric': 0.06702800361336947, 'fraction_numerical': 0.0025293586269196024, 'mean_word_length': 5.171683389074693, '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': '3049231', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1538, 'n_words': 443}