<commit_before>import django_filters

from nodeconductor.core import filters as core_filters
from nodeconductor.structure import models as structure_models

from . import models


class IssueFilter(django_filters.FilterSet):
    summary = django_filters.CharFilter(lookup_type='icontains')

    customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid')
    customer_uuid = core_filters.UUIDFilter(name='customer__uuid')

    project = core_filters.URLFilter(view_name='project-detail', name='project__uuid')
    project_uuid = core_filters.UUIDFilter(name='project__uuid')

    reporter_name = django_filters.CharFilter(lookup_type='icontains', name='reporter__name')
    reporter = core_filters.URLFilter(view_name='support-user-detail', name='reporter__uuid')

    caller_full_name = django_filters.CharFilter(lookup_type='icontains', name='caller__full_name')
    caller = core_filters.URLFilter(view_name='user-detail', name='caller__uuid')

    assignee_name = django_filters.CharFilter(lookup_type='icontains', name='assignee__name')
    assignee = core_filters.URLFilter(view_name='support-user-detail', name='assignee__uuid')

    class Meta(object):
        model = models.Issue
        fields = [
            'key',
            'type',
            'status',
        ]
        order_by = [
            'created',
            'updated',
            # desc
            '-created',
            '-updated',
        ]


class IssueResourceFilterBackend(core_filters.GenericKeyFilterBackend):

    def get_related_models(self):
        return structure_models.ResourceMixin.get_all_models()

    def get_field_name(self):
        return 'resource'


class CommentFilter(django_filters.FilterSet):
    description = django_filters.CharFilter(lookup_type='icontains')
    issue = core_filters.URLFilter(view_name='support-issue-detail', name='issue__uuid')
    issue_uuid = core_filters.UUIDFilter(name='issue__uuid')
    author_name = django_filters.CharFilter(lookup_type='icontains', name='author__name')
    author_user = core_filters.URLFilter(view_name='user-detail', name='author__user__uuid')

    class Meta(object):
        model = models.Comment
        fields = [
            'is_public',
        ]
        order_by = [
            'created',
            'updated',
            # desc
            '-created',
            '-updated',
        ]
<commit_msg>Fix typo (WAL-229)<commit_after>import django_filters

from nodeconductor.core import filters as core_filters
from nodeconductor.structure import models as structure_models

from . import models


class IssueFilter(django_filters.FilterSet):
    summary = django_filters.CharFilter(lookup_type='icontains')

    customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid')
    customer_uuid = core_filters.UUIDFilter(name='customer__uuid')

    project = core_filters.URLFilter(view_name='project-detail', name='project__uuid')
    project_uuid = core_filters.UUIDFilter(name='project__uuid')

    reporter_name = django_filters.CharFilter(lookup_type='icontains', name='reporter__name')
    reporter = core_filters.URLFilter(view_name='support-user-detail', name='reporter__uuid')

    caller_full_name = django_filters.CharFilter(lookup_type='icontains', name='caller__full_name')
    caller = core_filters.URLFilter(view_name='user-detail', name='caller__uuid')

    assignee_name = django_filters.CharFilter(lookup_type='icontains', name='assignee__name')
    assignee = core_filters.URLFilter(view_name='support-user-detail', name='assignee__uuid')

    class Meta(object):
        model = models.Issue
        fields = [
            'key',
            'type',
            'status',
        ]
        order_by = [
            'created',
            'modified',
            # desc
            '-created',
            '-modified',
        ]


class IssueResourceFilterBackend(core_filters.GenericKeyFilterBackend):

    def get_related_models(self):
        return structure_models.ResourceMixin.get_all_models()

    def get_field_name(self):
        return 'resource'


class CommentFilter(django_filters.FilterSet):
    description = django_filters.CharFilter(lookup_type='icontains')
    issue = core_filters.URLFilter(view_name='support-issue-detail', name='issue__uuid')
    issue_uuid = core_filters.UUIDFilter(name='issue__uuid')
    author_name = django_filters.CharFilter(lookup_type='icontains', name='author__name')
    author_user = core_filters.URLFilter(view_name='user-detail', name='author__user__uuid')

    class Meta(object):
        model = models.Comment
        fields = [
            'is_public',
        ]
        order_by = [
            'created',
            'updated',
            # desc
            '-created',
            '-updated',
        ]

{'fraction_non_alphanumeric': 0.10898103771619087, 'fraction_numerical': 0.000625130235465722, 'mean_word_length': 3.4776119402985075, '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': '5931406', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1360, 'n_words': 202}