<commit_before>from rest_framework.response import Response
from rest_framework.generics import GenericAPIView, ListAPIView

from spillway import carto, filters, forms, renderers
from spillway.generics import BaseGeoView


class MapView(GenericAPIView):
    """View for rendering map tiles from /{z}/{x}/{y}/ tile coordinates."""
    renderer_classes = (renderers.MapnikRenderer,
                        renderers.MapnikJPEGRenderer)

    def get(self, request, *args, **kwargs):
        form = forms.RasterTileForm(dict(self.request.query_params.dict(),
                                         **self.kwargs))
        return Response(carto.build_map([self.get_object()], form))


class TileView(BaseGeoView, ListAPIView):
    """View for serving tiled GeoJSON or PNG from a GeoModel."""
    pagination_class = None
    filter_backends = (filters.TileFilter,)<commit_msg>Use ResponseExceptionMixin with MapView<commit_after>from rest_framework.response import Response
from rest_framework.generics import GenericAPIView, ListAPIView

from spillway import carto, filters, forms, mixins, renderers
from spillway.generics import BaseGeoView


class MapView(mixins.ResponseExceptionMixin, GenericAPIView):
    """View for rendering map tiles from /{z}/{x}/{y}/ tile coordinates."""
    renderer_classes = (renderers.MapnikRenderer,
                        renderers.MapnikJPEGRenderer)

    def get(self, request, *args, **kwargs):
        form = forms.RasterTileForm(dict(self.request.query_params.dict(),
                                         **self.kwargs))
        return Response(carto.build_map([self.get_object()], form))


class TileView(BaseGeoView, ListAPIView):
    """View for serving tiled GeoJSON or PNG from a GeoModel."""
    pagination_class = None
    filter_backends = (filters.TileFilter,)
{'fraction_non_alphanumeric': 0.09894969596462133, 'fraction_numerical': 0.0, 'mean_word_length': 3.55919395465995, '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': '5128951', 'n_tokens_mistral': 511, 'n_tokens_neox': 494, 'n_words': 128}