<commit_before>from rest_framework import generics, serializers
from rest_framework.permissions import IsAuthenticated

from .models import UserProfile


class ProfileSerializer(serializers.ModelSerializer):

    class Meta:
        model = UserProfile

    url = serializers.SerializerMethodField('get_url')

    def get_url(self, obj):
        return obj.get_absolute_url()


class ProfileListAPIView(generics.ListAPIView):
    """Lists Profiles on the site

    Returns an **HTTP 200** if successful, with a JSON object full of
    information.

    """
    serializer_class = ProfileSerializer
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        return UserProfile.objects.exclude(user__pk=-1)<commit_msg>Limit info provided by the API<commit_after>from django.contrib.auth.models import User

from rest_framework import generics, serializers
from rest_framework.permissions import IsAuthenticated

from .models import UserProfile


class UserSerializer(serializers.ModelSerializer):

    class Meta:
        model = User
        fields = ('username', 'fullname')

    fullname = serializers.SerializerMethodField('get_fullname')

    def get_fullname(self, obj):
        return obj.get_full_name()


class ProfileSerializer(serializers.ModelSerializer):
    user = UserSerializer()

    class Meta:
        model = UserProfile
        fields = ('user', 'url')

    url = serializers.SerializerMethodField('get_url')

    def get_url(self, obj):
        return obj.get_absolute_url()


class ProfileListAPIView(generics.ListAPIView):
    """Lists Profiles on the site

    Returns an **HTTP 200** if successful, with a JSON object full of
    information.

    """
    serializer_class = ProfileSerializer
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        return UserProfile.objects.exclude(user__pk=-1)
{'fraction_non_alphanumeric': 0.080878414568827, 'fraction_numerical': 0.004284949116229245, 'mean_word_length': 3.8900523560209423, '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': '6312861', 'n_tokens_mistral': 528, 'n_tokens_neox': 494, 'n_words': 137}