<commit_before>from datetime import datetime

from django.core.management import BaseCommand

from corehq.motech.dhis2.tasks import send_datasets


class Command(BaseCommand):
    """
    Manually send datasets for a project assuming it was run at a date in the past
    """

    def add_arguments(self, parser):
        parser.add_argument('domain_name')
        parser.add_argument('send_date', help="YYYY-MM-DD")

    def handle(self, domain_name, send_date, **options):
        send_date = datetime.strptime(send_date, '%Y-%m-%d')
        print("Sending dataset")
        send_datasets(domain_name, send_now=True, send_date=send_date)<commit_msg>send_datasets command: `send_date` param optional<commit_after>from datetime import datetime

from django.core.management import BaseCommand

from corehq.motech.dhis2.tasks import send_datasets


class Command(BaseCommand):
    help = ('Manually send datasets for a domain. Specify --send-date '
            'to simulate a date in the past')

    def add_arguments(self, parser):
        parser.add_argument('domain_name')
        parser.add_argument('--send_date', help="YYYY-MM-DD")

    def handle(self, domain_name, **options):
        if 'send_date' in options:
            send_date = datetime.strptime(options['send_date'], '%Y-%m-%d')
        else:
            send_date = None
        print("Sending dataset")
        send_datasets.apply(domain_name, kwargs={
            'send_now': True, 'send_date': send_date,
        })
{'fraction_non_alphanumeric': 0.10856372218476062, 'fraction_numerical': 0.0013486176668914363, 'mean_word_length': 3.4035608308605343, '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': '6983929', 'n_tokens_mistral': 448, 'n_tokens_neox': 438, 'n_words': 110}