<commit_before># -*- coding: utf-8 -*-
"""send newsletter"""

import sys

from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.management import call_command


def get_and_configure_base_class():
    if DJANGO_VERSION >= (1, 7, 0):
        from django.core.management.commands import migrate
        return migrate.Command
    else:
        if 'south' in settings.INSTALLED_APPS:
            from south.management.commands.migrate import Command as SouthMigrateCommand
            south_migration_modules = getattr(settings, 'SOUTH_MIGRATION_MODULES', None)
            if not south_migration_modules:
                south_migration_modules = {}
            south_migration_modules['coop_cms'] = 'coop_cms.south_migrations'
            settings.SOUTH_MIGRATION_MODULES = south_migration_modules
            return SouthMigrateCommand
        else:
            raise ImportError("south is not set in INSTALLED_APPS")


class Command(get_and_configure_base_class()):
    """send newsletter"""
    help = u"migrate"
    #use_argparse = False

    def handle(self, *args, **options):
        """command"""

        super(Command, self).handle(*args, **options)
        if DJANGO_VERSION >= (1, 7, 0) and 'test' in sys.argv:
            call_command('sync_translation_fields', interactive=False)<commit_msg>Fix migrate custom command when model migration is not installed<commit_after># -*- coding: utf-8 -*-
"""send newsletter"""

import sys

from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.management import call_command


def get_and_configure_base_class():
    if DJANGO_VERSION >= (1, 7, 0):
        from django.core.management.commands import migrate
        return migrate.Command
    else:
        if 'south' in settings.INSTALLED_APPS:
            from south.management.commands.migrate import Command as SouthMigrateCommand
            south_migration_modules = getattr(settings, 'SOUTH_MIGRATION_MODULES', None)
            if not south_migration_modules:
                south_migration_modules = {}
            south_migration_modules['coop_cms'] = 'coop_cms.south_migrations'
            settings.SOUTH_MIGRATION_MODULES = south_migration_modules
            return SouthMigrateCommand
        else:
            raise ImportError("south is not set in INSTALLED_APPS")


class Command(get_and_configure_base_class()):
    """send newsletter"""
    help = u"migrate"
    #use_argparse = False

    def handle(self, *args, **options):
        """command"""

        super(Command, self).handle(*args, **options)
        if DJANGO_VERSION >= (1, 7, 0) and 'test' in sys.argv and 'modeltranslation' in settings.INSTALLED_APPS:
            call_command('sync_translation_fields', interactive=False)
{'fraction_non_alphanumeric': 0.0906485130777499, 'fraction_numerical': 0.005016123253314225, 'mean_word_length': 3.211161387631976, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1996458', 'n_tokens_mistral': 831, 'n_tokens_neox': 801, 'n_words': 200}