<commit_before>from __future__ import unicode_literals

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from waffle.models import Flag, Sample, Switch


class BaseAdmin(admin.ModelAdmin):
    search_fields = ('name', 'note')

    def get_actions(self, request):
        actions = super(BaseAdmin, self).get_actions(request)
        if 'delete_selected' in actions:
            del actions['delete_selected']
        return actions


def enable_for_all(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.everyone = True
        f.save()


def disable_for_all(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.everyone = False
        f.save()


def delete_individually(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.delete()


enable_for_all.short_description = 'Enable selected flags for everyone.'
disable_for_all.short_description = 'Disable selected flags for everyone.'
delete_individually.short_description = 'Delete selected.'


class FlagAdmin(BaseAdmin):
    actions = [enable_for_all, disable_for_all, delete_individually]
    list_display = ('name', 'note', 'everyone', 'percent', 'superusers',
                    'staff', 'authenticated', 'languages')
    list_filter = ('everyone', 'superusers', 'staff', 'authenticated')
    raw_id_fields = ('users', 'groups')
    ordering = ('-id',)


def enable_switches(ma, request, qs):
    for switch in qs:
        switch.active = True
        switch.save()


def disable_switches(ma, request, qs):
    for switch in qs:
        switch.active = False
        switch.save()


enable_switches.short_description = _('Enable the selected switches.')
disable_switches.short_description = _('Disable the selected switches.')


class SwitchAdmin(BaseAdmin):
    actions = [enable_switches, disable_switches, delete_individually]<commit_msg>remove dot from admin actions<commit_after>from __future__ import unicode_literals

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from waffle.models import Flag, Sample, Switch


class BaseAdmin(admin.ModelAdmin):
    search_fields = ('name', 'note')

    def get_actions(self, request):
        actions = super(BaseAdmin, self).get_actions(request)
        if 'delete_selected' in actions:
            del actions['delete_selected']
        return actions


def enable_for_all(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.everyone = True
        f.save()


def disable_for_all(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.everyone = False
        f.save()


def delete_individually(ma, request, qs):
    # Iterate over all objects to cause cache invalidation.
    for f in qs.all():
        f.delete()


enable_for_all.short_description = 'Enable selected flags for everyone'
disable_for_all.short_description = 'Disable selected flags for everyone'
delete_individually.short_description = 'Delete selected'


class FlagAdmin(BaseAdmin):
    actions = [enable_for_all, disable_for_all, delete_individually]
    list_display = ('name', 'note', 'everyone', 'percent', 'superusers',
                    'staff', 'authenticated', 'languages')
    list_filter = ('everyone', 'superusers', 'staff', 'authenticated')
    raw_id_fields = ('users', 'groups')
    ordering = ('-id',)


def enable_switches(ma, request, qs):
    for switch in qs:
        switch.active = True
        switch.save()


def disable_switches(ma, request, qs):
    for switch in qs:
        switch.active = False
        switch.save()


enable_switches.short_description = _('Enable the selected switches.')
disable_switches.short_description = _('Disable the selected switches.')


class SwitchAdmin(BaseAdmin):
    actions = [enable_switches, disable_switches, delete_individually]
{'fraction_non_alphanumeric': 0.10170749814402376, 'fraction_numerical': 0.0, 'mean_word_length': 3.6036446469248293, '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': '6091340', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1179, 'n_words': 345}