<commit_before>from corehq.apps.cleanup.management.commands.populate_sql_model_from_couch_model import PopulateSQLCommand


class Command(PopulateSQLCommand):
    help = """
        Adds a SQLDhis2Connection for any Dhis2Connection doc that doesn't yet have one.
    """

    @property
    def couch_class(self):
        try:
            from corehq.motech.dhis2.models import Dhis2Connection
            return Dhis2Connection
        except ImportError:
            return None

    @property
    def couch_class_key(self):
        return set(['domain'])

    @property
    def sql_class(self):
        from corehq.motech.dhis2.models import SQLDhis2Connection
        return SQLDhis2Connection

    def update_or_create_sql_object(self, doc):
        model, created = self.sql_class.objects.update_or_create(
            domain=doc['domain'],
            defaults={
                'server_url': doc.get('server_url'),
                'username': doc.get('username'),
                'password': doc.<PASSWORD>('password'),
                'skip_cert_verify': doc.get('skip_cert_verify'),
            }
        )
        return (model, created)
<commit_msg>Provide default value for skip_cert_verify in SQLDhis2Connection migration<commit_after>from corehq.apps.cleanup.management.commands.populate_sql_model_from_couch_model import PopulateSQLCommand


class Command(PopulateSQLCommand):
    help = """
        Adds a SQLDhis2Connection for any Dhis2Connection doc that doesn't yet have one.
    """

    @property
    def couch_class(self):
        try:
            from corehq.motech.dhis2.models import Dhis2Connection
            return Dhis2Connection
        except ImportError:
            return None

    @property
    def couch_class_key(self):
        return set(['domain'])

    @property
    def sql_class(self):
        from corehq.motech.dhis2.models import SQLDhis2Connection
        return SQLDhis2Connection

    def update_or_create_sql_object(self, doc):
        model, created = self.sql_class.objects.update_or_create(
            domain=doc['domain'],
            defaults={
                'server_url': doc.get('server_url'),
                'username': doc.get('username'),
                'password': <PASSWORD>('password'),
                'skip_cert_verify': doc.get('skip_cert_verify') or False,
            }
        )
        return (model, created)

{'fraction_non_alphanumeric': 0.0892707460184409, 'fraction_numerical': 0.007124895222129086, 'mean_word_length': 2.454413892908828, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5564976', 'n_tokens_mistral': 685, 'n_tokens_neox': 660, 'n_words': 141}