<commit_before>#!/usr/bin/env python
from __future__ import unicode_literals

import argparse
import os
import sys

from django.conf import settings


class MongoRouter(object):

    def _db_for(self, model, **hints):
        from mutant.db.models import MutableModel
        if issubclass(model, MutableModel):
            return 'mongo'
        else:
            return 'default'

    db_for_read = _db_for

    db_for_write = _db_for

    def allow_syncdb(self, db, model):
        return self._db_for(model) == db

DEFAULT_SETTINGS = {
    'SECRET_KEY': 'secret',
    'INSTALLED_APPS': [
        'django.contrib.auth', # This is needed because of django bug
        'django.contrib.contenttypes',
        'south',
        'polymodels',
        'mutant',
        'mutant.contrib.boolean',
        'mutant.contrib.temporal',
        'mutant.contrib.file',
        'mutant.contrib.numeric',
        'mutant.contrib.text',
        'mutant.contrib.web',
        'mutant.contrib.related',
    ],
    'SKIP_SOUTH_TESTS': False
}

ENGINE_SETTINGS = {
    'sqlite3': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            }
        }
    },
    'postgresql': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.postgresql_psycopg2',
                'NAME': 'mutant',
                'USER': 'postgres',
            }
        }
    },
    'postgis': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.contrib.gis.db.backends.postgis',
                'NAME': 'mutant',
                'USER': 'postgres',
            }
        },
        'INSTALLED_APPS': DEFAULT_SETTINGS['INSTALLED_APPS'] + [
            'django.contrib.gis',
            'mutant.contrib.geo',
        ]
    },
    'mongodb': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            },
            'mongo': {
                'ENGINE' : 'django_mongodb_engine',
                'NAME' : 'mutant',
                'OPTIONS': {
                    'OPERATIONS': {
                        'save' : {'safe' : True},
                    }
                }
            }
        },
        'DATABASE_ROUTERS': (
            'runtests.MongoRouter',
        ),
        'SOUTH_DATABASE_ADAPTERS': {
            'mongo': 'django_mongodb_engine.south_adapter'
        },
        # FK and M2M are not supported for nonrel db
        'INSTALLED_APPS': DEFAULT_SETTINGS['INSTALLED_APPS'][0:-1] + [
            'django_mongodb_engine',
            'djangotoolbox',
            'mutant.contrib.nonrel',
        ]
    },
}

DEFAULT_TEST_LABELS = [
    'mutant',
    'boolean',
    'temporal',
    'file',
    'numeric',
    'related',
    'text',
    'web',
    'south',
    'polymodels',<commit_msg>Whitespace fix<commit_after>#!/usr/bin/env python
from __future__ import unicode_literals

import argparse
import os
import sys

from django.conf import settings


class MongoRouter(object):
    def _db_for(self, model, **hints):
        from mutant.db.models import MutableModel
        if issubclass(model, MutableModel):
            return 'mongo'
        else:
            return 'default'

    db_for_read = _db_for
    db_for_write = _db_for

    def allow_syncdb(self, db, model):
        return self._db_for(model) == db


DEFAULT_SETTINGS = {
    'SECRET_KEY': 'secret',
    'INSTALLED_APPS': [
        'django.contrib.auth', # This is needed because of django bug
        'django.contrib.contenttypes',
        'south',
        'polymodels',
        'mutant',
        'mutant.contrib.boolean',
        'mutant.contrib.temporal',
        'mutant.contrib.file',
        'mutant.contrib.numeric',
        'mutant.contrib.text',
        'mutant.contrib.web',
        'mutant.contrib.related',
    ],
    'SKIP_SOUTH_TESTS': False
}


ENGINE_SETTINGS = {
    'sqlite3': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            }
        }
    },
    'postgresql': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.postgresql_psycopg2',
                'NAME': 'mutant',
                'USER': 'postgres',
            }
        }
    },
    'postgis': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.contrib.gis.db.backends.postgis',
                'NAME': 'mutant',
                'USER': 'postgres',
            }
        },
        'INSTALLED_APPS': DEFAULT_SETTINGS['INSTALLED_APPS'] + [
            'django.contrib.gis',
            'mutant.contrib.geo',
        ]
    },
    'mongodb': {
        'DATABASES': {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            },
            'mongo': {
                'ENGINE' : 'django_mongodb_engine',
                'NAME' : 'mutant',
                'OPTIONS': {
                    'OPERATIONS': {
                        'save' : {'safe' : True},
                    }
                }
            }
        },
        'DATABASE_ROUTERS': (
            'runtests.MongoRouter',
        ),
        'SOUTH_DATABASE_ADAPTERS': {
            'mongo': 'django_mongodb_engine.south_adapter'
        },
        # FK and M2M are not supported for nonrel db
        'INSTALLED_APPS': DEFAULT_SETTINGS['INSTALLED_APPS'][0:-1] + [
            'django_mongodb_engine',
            'djangotoolbox',
            'mutant.contrib.nonrel',
        ]
    },
}


DEFAULT_TEST_LABELS = [
    'mutant',
    'boolean',
    'temporal',
    'file',
    'numeric',
    'related',
    'text',
    'web',
    'south',
    'polymodels',
{'fraction_non_alphanumeric': 0.13664383561643836, 'fraction_numerical': 0.002397260273972603, 'mean_word_length': 1.5406698564593302, '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': '2164450', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1853, 'n_words': 294}