<commit_before>import urllib2, urllib

from django.utils import simplejson as json

from boundaryservice.base_views import ModelListView, ModelDetailView

from repapi.models import Representative, RepresentativeSet, app_settings

class RepresentativeListView(ModelListView):

    model = Representative

    def get_qs(self, request, district=None):
        qs = super(RepresentativeListView, self).get_qs(request)
        if district:
            qs = qs.filter(boundary_url='/' + district)
        return qs

    def filter(self, request, qs):
        qs = super(RepresentativeListView, self).filter(request, qs)

        if 'districts' in request.GET:
            qs = qs.filter(boundary_url__in=request.GET['districts'].split(','))

        if 'point' in request.GET:
            # Figure out the boundaries for that point via the boundaryservice API
            request_url = app_settings.BOUNDARYSERVICE_URL \
                        + 'boundary/?' + urllib.urlencode({'contains': request.GET['point']})
            resp = urllib2.urlopen(request_url)<commit_msg>Sync with URL schema changes in boundaryservice<commit_after>import urllib2, urllib

from django.utils import simplejson as json

from boundaryservice.base_views import ModelListView, ModelDetailView

from repapi.models import Representative, RepresentativeSet, app_settings

class RepresentativeListView(ModelListView):

    model = Representative

    def get_qs(self, request, district=None):
        qs = super(RepresentativeListView, self).get_qs(request)
        if district:
            qs = qs.filter(boundary_url='/' + district)
        return qs

    def filter(self, request, qs):
        qs = super(RepresentativeListView, self).filter(request, qs)

        if 'districts' in request.GET:
            qs = qs.filter(boundary_url__in=request.GET['districts'].split(','))

        if 'point' in request.GET:
            # Figure out the boundaries for that point via the boundaryservice API
            request_url = app_settings.BOUNDARYSERVICE_URL \
                        + 'boundaries/?' + urllib.urlencode({'contains': request.GET['point']})
            resp = urllib2.urlopen(request_url)
{'fraction_non_alphanumeric': 0.09291628334866606, 'fraction_numerical': 0.0018399264029438822, 'mean_word_length': 3.1907514450867054, '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': '4775063', 'n_tokens_mistral': 634, 'n_tokens_neox': 585, 'n_words': 153}