<commit_before># from django.http import HttpResponse
# from django.views.decorators.csrf import csrf_exempt
# from rest_framework.renderers import JSONRenderer
# from rest_framework.parsers import JSONParser
# from skynet.models import Messages
# from skynet.serializers import SkynetSerializer
# from django.db.models import Count

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from skynet.models import Messages
from skynet.serializers import SkynetSerializer


@api_view(['GET', 'POST'])
def skynet_list(request):
    """
    List all snippets, or create a new snippet.
    """
    if request.method == 'GET':
        messages = Messages.objects.all()
        serializer = SkynetSerializer(messages, many=True)
        return Response(serializer.data)

    elif request.method == 'POST':
        serializer = SkynetSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

# @csrf_exempt
# def skynet_list(request):
#     """
#     List all code skynets, or create a new skynet.
#     """
#     if request.method == 'GET':
#         skynets = Messages.objects.all()
#         serializer = SkynetSerializer(skynets, many=True)
#         return JSONResponse(serializer.data)

#     elif request.method == 'POST':
#         data = JSONParser().parse(request)
#         serializer = SkynetSerializer(data=data)
#         if serializer.is_valid():
#             serializer.save()
#             return JSONResponse(serializer.data, status=201)
#         return JSONResponse(serializer.errors, status=400)

# @csrf_exempt
# def skynet_detail(request, pk):
#     """
#     Retrieve, update or delete a code skynet.
#     """
#     try:<commit_msg>fix view bug<commit_after># from django.http import HttpResponse
# from django.views.decorators.csrf import csrf_exempt
# from rest_framework.renderers import JSONRenderer
# from rest_framework.parsers import JSONParser
# from skynet.models import Messages
# from skynet.serializers import SkynetSerializer
# from django.db.models import Count

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from skynet.models import Messages
from skynet.serializers import SkynetSerializer


@api_view(['GET'])
def skynet_list(request):
    """
    List all snippets, or create a new snippet.
    """
    if request.method == 'GET':
        messages = Messages.objects.all()
        serializer = SkynetSerializer(messages, many=True)
        return Response(serializer.data)

# @csrf_exempt
# def skynet_list(request):
#     """
#     List all code skynets, or create a new skynet.
#     """
#     if request.method == 'GET':
#         skynets = Messages.objects.all()
#         serializer = SkynetSerializer(skynets, many=True)
#         return JSONResponse(serializer.data)

#     elif request.method == 'POST':
#         data = JSONParser().parse(request)
#         serializer = SkynetSerializer(data=data)
#         if serializer.is_valid():
#             serializer.save()
#             return JSONResponse(serializer.data, status=201)
#         return JSONResponse(serializer.errors, status=400)

# @csrf_exempt
# def skynet_detail(request, pk):
#     """
#     Retrieve, update or delete a code skynet.
#     """
#     try:
{'fraction_non_alphanumeric': 0.10113960113960115, 'fraction_numerical': 0.005128205128205128, 'mean_word_length': 3.4386852085967132, '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': '1035261', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1039, 'n_words': 256}