<commit_before>from rest_framework import generics
from rest_framework.decorators import api_view
from rest_framework.views import APIView
import rest_framework.reverse
from rest_framework.permissions import AllowAny
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import status
import reversion
import datetime
from django.utils.translation import ugettext_lazy as _

from api.serializers import *
from devices.models import *
from devicetypes.models import *
from network.models import *
from django.contrib.auth.models import Group
from mail.models import MailTemplate

@api_view(('GET',))
def api_root(request, format=None):
    return Response({
        'devices': rest_framework.reverse.reverse('device-api-list', request=request),
        'rooms': rest_framework.reverse.reverse('room-api-list', request=request),
        'buildings': rest_framework.reverse.reverse('building-api-list', request=request),
        'manufacturers': rest_framework.reverse.reverse('manufacturer-api-list', request=request),
        'types': rest_framework.reverse.reverse('type-api-list', request=request),
        'templates': rest_framework.reverse.reverse('template-api-list', request=request),
        'ipaddresses': rest_framework.reverse.reverse('ipaddress-api-list', request=request),
        'users': rest_framework.reverse.reverse('user-api-list', request=request),
        'groups': rest_framework.reverse.reverse('group-api-list', request=request),
    })


class SearchQuerysetMixin():
    def get_queryset(self):
        queryset = self.model.objects.all()
        valid_fields = self.model._meta.get_all_field_names()
        filters = {}
        for param in self.request.QUERY_PARAMS.lists():
            if param[0] in valid_fields:
                key_name = param[0] + "__in"<commit_msg>update for rest framework 3.90<commit_after>from rest_framework import generics
from rest_framework.decorators import api_view
from rest_framework.views import APIView
import rest_framework.reverse
from rest_framework.permissions import AllowAny
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import status
import reversion
import datetime
from django.utils.translation import ugettext_lazy as _

from api.serializers import *
from devices.models import *
from devicetypes.models import *
from network.models import *
from django.contrib.auth.models import Group
from mail.models import MailTemplate

@api_view(('GET',))
def api_root(request, format=None):
    return Response({
        'devices': rest_framework.reverse.reverse('device-api-list', request=request),
        'rooms': rest_framework.reverse.reverse('room-api-list', request=request),
        'buildings': rest_framework.reverse.reverse('building-api-list', request=request),
        'manufacturers': rest_framework.reverse.reverse('manufacturer-api-list', request=request),
        'types': rest_framework.reverse.reverse('type-api-list', request=request),
        'templates': rest_framework.reverse.reverse('template-api-list', request=request),
        'ipaddresses': rest_framework.reverse.reverse('ipaddress-api-list', request=request),
        'users': rest_framework.reverse.reverse('user-api-list', request=request),
        'groups': rest_framework.reverse.reverse('group-api-list', request=request),
    })


class SearchQuerysetMixin():
    def get_queryset(self):
        queryset = self.model.objects.all()
        valid_fields = self.model._meta.get_all_field_names()
        filters = {}
        for param in self.request.query_params.lists():
            if param[0] in valid_fields:
                key_name = param[0] + "__in"
{'fraction_non_alphanumeric': 0.10854998659876709, 'fraction_numerical': 0.003484320557491289, 'mean_word_length': 4.570149253731343, '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': '6663915', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1024, 'n_words': 227}