<commit_before>import sys
import logging

from website.app import setup_django
setup_django()

from waffle.models import Switch

from framework.celery_tasks import app as celery_app


from scripts.utils import add_file_logger
from osf.models import RegistrationSchema

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)


def main(dry_run=True):

    switch = Switch.objects.get(name='osf_preregistration')
    switch.active = True
    prereg_schema = RegistrationSchema.objects.get(name='OSF Preregistration')
    prereg_schema.active = True
    if dry_run:
        logger.warn('This is a dry run')
    else:
        switch.save()
        prereg_schema.save()


@celery_app.task(name='scripts.remove_after_use.end_prereg_challenge')
def run_main(dry_run=True):
    if not dry_run:
        add_file_logger(logger, __file__)
    main(dry_run=dry_run)


if __name__ == '__main__':
    run_main(dry_run='--dry' in sys.argv)
<commit_msg>deactivate the old prereg challenge schema =<commit_after>import sys
import logging

from website.app import setup_django
setup_django()

from waffle.models import Switch

from framework.celery_tasks import app as celery_app


from scripts.utils import add_file_logger
from osf.models import RegistrationSchema

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)


def main(dry_run=True):

    switch = Switch.objects.get(name='osf_preregistration')
    switch.active = True
    prereg_challenge_schema = RegistrationSchema.objects.get(name='Prereg Challenge')
    prereg_challenge_schema.active = False
    prereg_schema = RegistrationSchema.objects.get(name='OSF Preregistration')
    prereg_schema.active = True
    if dry_run:
        logger.warn('This is a dry run')
    else:
        switch.save()
        prereg_schema.save()
        prereg_challenge_schema.save()


@celery_app.task(name='scripts.remove_after_use.end_prereg_challenge')
def run_main(dry_run=True):
    if not dry_run:
        add_file_logger(logger, __file__)
    main(dry_run=dry_run)


if __name__ == '__main__':
    run_main(dry_run='--dry' in sys.argv)

{'fraction_non_alphanumeric': 0.09069437883797828, 'fraction_numerical': 0.0, 'mean_word_length': 4.4728682170542635, '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': '5993611', 'n_tokens_mistral': 707, 'n_tokens_neox': 663, 'n_words': 144}