<commit_before>from django.core.management import BaseCommand
from rdrf.models.definition.models import Registry


class Command(BaseCommand):
    help = "Set the registry version"

    def handle(self, *args, **options):
        print("\nThe current registry versions:\n")

        registries = Registry.objects.all().values("name", "code", "version").order_by("code")
        for registry in registries:
            print(f"{registry['name']} [{registry['code']}]: {registry['version']}")

        code = input("\nEnter the registry code (press ENTER to exit): ")
        if code:
            version = input("\nEnter the new version (press ENTER to exit): ")
            if version:
                Registry.objects.filter(code=code).update(version=version)<commit_msg>rdrf #1393 modified the management command to have command line arguments<commit_after>from django.core.management import BaseCommand
from rdrf.models.definition.models import Registry


class Command(BaseCommand):
    help = "Set the registry version"

    def add_arguments(self, parser):
        parser.add_argument('--code',
                            action='store',
                            dest='code',
                            default=None,
                            help='The registry code')
        parser.add_argument('--ver',
                            action='store',
                            dest='version',
                            default=None,
                            help='The new registry version to be set')

    def handle(self, *args, **options):
        code = options.get("code")
        version = options.get("version")
        Registry.objects.filter(code=code).update(version=version)
{'fraction_non_alphanumeric': 0.11450381679389313, 'fraction_numerical': 0.002348796241926013, 'mean_word_length': 2.1731843575418996, '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': '1366653', 'n_tokens_mistral': 427, 'n_tokens_neox': 410, 'n_words': 111}