<commit_before>from django.contrib import admin
from django.contrib.contenttypes.admin import (GenericStackedInline,
    GenericTabularInline)
from django.db.models import Count

from taggit.models import TaggedItem


class TaggitCounter():
    """
    Display (and sort by) number of Taggit tags associated with tagged items.

    Usage Example:
        from taggit_helpers import TaggitCounter

        class MyModelAdmin(TaggitCounter, admin.ModelAdmin):
            list_display = (
                ...
                'taggit_counter',
            )

    Note: Currently, the TaggableManager() field must be named 'tags'.

    Note: To avoid overcounting, set distinct=True if further annotating the queryset with Count():

        queryset.annotate(m2m_field_count=Count('m2m_field', distinct=True))
    """

    def queryset(self, request):
        queryset = self.model.objects.get_query_set()<commit_msg>Rename deprecated queryset method<commit_after>from django.contrib import admin
from django.contrib.contenttypes.admin import (GenericStackedInline,
    GenericTabularInline)
from django.db.models import Count

from taggit.models import TaggedItem


class TaggitCounter():
    """
    Display (and sort by) number of Taggit tags associated with tagged items.

    Usage Example:
        from taggit_helpers import TaggitCounter

        class MyModelAdmin(TaggitCounter, admin.ModelAdmin):
            list_display = (
                ...
                'taggit_counter',
            )

    Note: Currently, the TaggableManager() field must be named 'tags'.

    Note: To avoid overcounting, set distinct=True if further annotating the queryset with Count():

        queryset.annotate(m2m_field_count=Count('m2m_field', distinct=True))
    """

    def get_queryset(self, request):
        queryset = self.model.objects.get_queryset()
{'fraction_non_alphanumeric': 0.07896160086533262, 'fraction_numerical': 0.002163331530557058, 'mean_word_length': 3.111111111111111, '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': '7213735', 'n_tokens_mistral': 518, 'n_tokens_neox': 498, 'n_words': 144}