<commit_before>import shlex
import re
import logging

from django.db.models import Q

from rest_framework.filters import BaseFilterBackend


log = logging.getLogger(__name__)
splitter = re.compile(r'^(.*[^\s]):([^\s].*)?$')

class InvalidSearchQuery(Exception):
    pass


class FilterBackend(BaseFilterBackend):<commit_msg>Extend APIException<commit_after>import shlex
import re
import logging

from django.db.models import Q

from rest_framework.exceptions import APIException
from rest_framework.filters import BaseFilterBackend


log = logging.getLogger(__name__)
splitter = re.compile(r'^(.*[^\s]):([^\s].*)?$')

class InvalidSearchQuery(APIException):
    status_code = 400
    default_detail = 'Invalid filter'


class FilterBackend(BaseFilterBackend):
{'fraction_non_alphanumeric': 0.11725955204216074, 'fraction_numerical': 0.003952569169960474, 'mean_word_length': 6.238095238095238, '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': '3273458', 'n_tokens_mistral': 233, 'n_tokens_neox': 227, 'n_words': 54}