<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu

from __future__ import (unicode_literals, absolute_import,
                        division, print_function)
import logging

from django.core.management.base import BaseCommand

from snisi_core.models.Periods import MonthPeriod
from snisi_core.models.PeriodicTasks import PeriodicTask

logger = logging.getLogger(__name__)


class Command(BaseCommand):

    def handle(self, *args, **options):

        period = MonthPeriod.current().previous()
        category = 'end_of_district_period'

        for pt in PeriodicTask.objects.filter(category=category):
            regexp = r'_{p}_{cat}'.format(p=period.strid(), cat=category)
            if not pt.slug.endswith(regexp):
                continue

            # skipping nutrition
            if pt.slug == 'nutrition_12-2014_end_of_district_period':
                continue

            logger.info("Untriggering {}".format(pt))
            pt.untrigger()
<commit_msg>now it's generic<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu

from __future__ import (unicode_literals, absolute_import,
                        division, print_function)
import logging

from django.core.management.base import BaseCommand

from snisi_core.models.Periods import MonthPeriod
from snisi_core.models.PeriodicTasks import PeriodicTask

logger = logging.getLogger(__name__)


class Command(BaseCommand):

    def handle(self, *args, **options):

        period = MonthPeriod.current().previous()
        category = 'end_of_district_period'

        for pt in PeriodicTask.objects.filter(category=category):
            regexp = r'_{p}_{cat}'.format(p=period.strid(), cat=category)
            if not pt.slug.endswith(regexp):
                continue

            logger.info("Untriggering {}".format(pt))
            pt.untrigger()

{'fraction_non_alphanumeric': 0.10849056603773585, 'fraction_numerical': 0.007337526205450734, 'mean_word_length': 2.880081300813008, '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': '3138020', 'n_tokens_mistral': 574, 'n_tokens_neox': 542, 'n_words': 124}