<commit_before>
import datetime
import os
import sys
from django.conf import settings
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from models import MigrationHistory
from south.db import db


def get_app(app):
    """
    Returns the migrations module for the given app model name/module, or None
    if it does not use migrations.
    """
    if isinstance(app, (str, unicode)):
        # If it's a string, use the models module
        app = models.get_app(app)
    mod = __import__(app.__name__[:-7], {}, {}, ['migrations'])
    if hasattr(mod, 'migrations'):
        return getattr(mod, 'migrations')


def get_migrated_apps():
    """
    Returns all apps with migrations.
    """
    for mapp in models.get_apps():
        app = get_app(mapp)
        if app:
            yield app


def get_app_name(app):
    """
    Returns the _internal_ app name for the given app module.
    i.e. for <module django.contrib.auth.models> will return 'auth'
    """
    return app.__name__.split('.')[-2]


def get_app_fullname(app):
    """
    Returns the full python name of an app - e.g. django.contrib.auth
    """
    return app.__name__[:-11]


def short_from_long(app_name):
    return app_name.split(".")[-1]


def get_migration_names(app):
    """
    Returns a list of migration file names for the given app.
    """
    return sorted([
        filename[:-3]
        for filename in os.listdir(os.path.dirname(app.__file__))
        if filename.endswith(".py") and filename != "__init__.py"
    ])


def get_migration_classes(app):
    """
    Returns a list of migration classes (one for each migration) for the app.
    """
    for name in get_migration_names(app):
        yield get_migration(app, name)

<commit_msg>Ignore dotfiles in the migration folder.<commit_after>
import datetime
import os
import sys
from django.conf import settings
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from models import MigrationHistory
from south.db import db


def get_app(app):
    """
    Returns the migrations module for the given app model name/module, or None
    if it does not use migrations.
    """
    if isinstance(app, (str, unicode)):
        # If it's a string, use the models module
        app = models.get_app(app)
    mod = __import__(app.__name__[:-7], {}, {}, ['migrations'])
    if hasattr(mod, 'migrations'):
        return getattr(mod, 'migrations')


def get_migrated_apps():
    """
    Returns all apps with migrations.
    """
    for mapp in models.get_apps():
        app = get_app(mapp)
        if app:
            yield app


def get_app_name(app):
    """
    Returns the _internal_ app name for the given app module.
    i.e. for <module django.contrib.auth.models> will return 'auth'
    """
    return app.__name__.split('.')[-2]


def get_app_fullname(app):
    """
    Returns the full python name of an app - e.g. django.contrib.auth
    """
    return app.__name__[:-11]


def short_from_long(app_name):
    return app_name.split(".")[-1]


def get_migration_names(app):
    """
    Returns a list of migration file names for the given app.
    """
    return sorted([
        filename[:-3]
        for filename in os.listdir(os.path.dirname(app.__file__))
        if filename.endswith(".py") and filename != "__init__.py" and not filename.startswith(".")
    ])


def get_migration_classes(app):
    """
    Returns a list of migration classes (one for each migration) for the app.
    """
    for name in get_migration_names(app):
        yield get_migration(app, name)


{'fraction_non_alphanumeric': 0.11176142697881829, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 2.8926247288503255, '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': '7095846', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1092, 'n_words': 354}