<commit_before>from django.core.management.base import BaseCommand
from thezombies.tasks.main import crawl_agency_datasets


class Command(BaseCommand):
    """Start a task that crawl the datasets from an agency data catalog. This command will exit, but the task will run in the background"""
    args = '<agency_id ...>'

    def handle(self, *args, **options):
        if len(args) > 0:
            agency_id = args[0]
            if agency_id:
                task = crawl_agency_datasets.delay(agency_id)
                self.stdout.write(u'Running task with id {0}'.format(task.id))
                self.stdout.write(u'This can take many minutes...')
            else:
                self.stderr.write(u"Didn't get an agency_id!")<commit_msg>Add message for when command is not supplied any arguments.<commit_after>from django.core.management.base import BaseCommand
from thezombies.models import Agency
from thezombies.tasks.main import crawl_agency_datasets


class Command(BaseCommand):
    """Start a task that crawl the datasets from an agency data catalog. This command will exit, but the task will run in the background"""
    args = '<agency_id ...>'

    def handle(self, *args, **options):
        if len(args) > 0:
            agency_id = args[0]
            if agency_id:
                task = crawl_agency_datasets.delay(agency_id)
                self.stdout.write(u'Running task with id {0}'.format(task.id))
                self.stdout.write(u'This can take many minutes...')
            else:
                self.stderr.write(u"Didn't get an agency_id!")
        else:
            self.stdout.write(u'Please provide an agency id:\n')
            agency_list = u'\n'.join(['{0:2d}: {1}'.format(a.id, a.name) for a in Agency.objects.all()])
            self.stdout.write(agency_list)
            self.stdout.write(u'\n')
{'fraction_non_alphanumeric': 0.1101465002712968, 'fraction_numerical': 0.0048833423765599565, 'mean_word_length': 2.492424242424242, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '369870', 'n_tokens_mistral': 551, 'n_tokens_neox': 516, 'n_words': 156}