<commit_before>from django.core.management.base import BaseCommand
from maldini import queues

class Command(BaseCommand):

    help = "Run the `digest` worker"

    def add_arguments(self, parser):
        parser.add_argument('queue')
        parser.add_argument('-x', action='store_true', dest='stop_first_error')

    def handle(self, verbosity, queue, stop_first_error, **options):
        if queue == 'digest':
            from maldini.digest import worker
        elif queue == 'index':
            from maldini.index import worker
        elif queue == 'ocr':
            from maldini.ocr import worker
        else:
            raise ValueError("Unknown queue %r" % queue)

        queue_iterator = queues.iterate(
            queue,
            verbose=verbosity > 0,
            stop_first_error=stop_first_error,
            in_order=stop_first_error,
        )

        for work in queue_iterator:
            with work() as data:<commit_msg>fix help text<commit_after>from django.core.management.base import BaseCommand
from maldini import queues

class Command(BaseCommand):

    help = "Run a worker"

    def add_arguments(self, parser):
        parser.add_argument('queue')
        parser.add_argument('-x', action='store_true', dest='stop_first_error')

    def handle(self, verbosity, queue, stop_first_error, **options):
        if queue == 'digest':
            from maldini.digest import worker
        elif queue == 'index':
            from maldini.index import worker
        elif queue == 'ocr':
            from maldini.ocr import worker
        else:
            raise ValueError("Unknown queue %r" % queue)

        queue_iterator = queues.iterate(
            queue,
            verbose=verbosity > 0,
            stop_first_error=stop_first_error,
            in_order=stop_first_error,
        )

        for work in queue_iterator:
            with work() as data:
{'fraction_non_alphanumeric': 0.09066947812335266, 'fraction_numerical': 0.0010542962572482868, 'mean_word_length': 2.3181818181818183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2255580', 'n_tokens_mistral': 531, 'n_tokens_neox': 511, 'n_words': 140}