<commit_before>from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models import Q, signals
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _

from cabinet.base import AbstractFile, DownloadMixin, ImageMixin, OverwriteMixin
from tree_queries.models import TreeNode


if not hasattr(settings, "CABINET_FILE_MODEL"):  # pragma: no branch
    settings.CABINET_FILE_MODEL = "cabinet.File"


def get_file_model():
    """
    Return the File model that is active in this project.
    """
    try:
        return apps.get_model(settings.CABINET_FILE_MODEL, require_ready=False)
    except ValueError:
        raise ImproperlyConfigured(
            "CABINET_FILE_MODEL must be of the form 'app_label.model_name'"
        )
    except LookupError:
        raise ImproperlyConfigured(
            "CABINET_FILE_MODEL refers to model '%s'"
            " that has not been installed" % settings.CABINET_FILE_MODEL
        )


class Folder(TreeNode):
    parent = models.ForeignKey(
        "self",
        on_delete=models.CASCADE,
        blank=True,
        null=True,
        verbose_name=_("parent"),
        related_name="children",
    )
    name = models.CharField(_("name"), max_length=100)

    class Meta:<commit_msg>Remove the parent FK redefinition<commit_after>from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models import Q, signals
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _

from cabinet.base import AbstractFile, DownloadMixin, ImageMixin, OverwriteMixin
from tree_queries.models import TreeNode


if not hasattr(settings, "CABINET_FILE_MODEL"):  # pragma: no branch
    settings.CABINET_FILE_MODEL = "cabinet.File"


def get_file_model():
    """
    Return the File model that is active in this project.
    """
    try:
        return apps.get_model(settings.CABINET_FILE_MODEL, require_ready=False)
    except ValueError:
        raise ImproperlyConfigured(
            "CABINET_FILE_MODEL must be of the form 'app_label.model_name'"
        )
    except LookupError:
        raise ImproperlyConfigured(
            "CABINET_FILE_MODEL refers to model '%s'"
            " that has not been installed" % settings.CABINET_FILE_MODEL
        )


class Folder(TreeNode):
    name = models.CharField(_("name"), max_length=100)

    class Meta:
{'fraction_non_alphanumeric': 0.07384615384615385, 'fraction_numerical': 0.002307692307692308, 'mean_word_length': 3.5392670157068062, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '63098', 'n_tokens_mistral': 785, 'n_tokens_neox': 772, 'n_words': 211}