<commit_before>"""Models for resources application."""

from os.path import join, basename, splitext
from re import match
import logging
from django.db import models
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from autoslug import AutoSlugField
import filetype
from utils.get_upload_filepath import get_resource_upload_path
from utils.google_drive_api import get_google_drive_mimetype
from ckeditor_uploader.fields import RichTextUploadingField

ICON_PATH = 'img/icons/'
GOOGLE_DRIVE_REGEX = 'https://(drive|docs).google.com'
logger = logging.getLogger(__name__)


class Language(models.Model):
    """Model for a resource language."""

    name = models.CharField(max_length=40)
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a language."""
        return self.name

    class Meta:
        """Meta options for class."""

        # Māori before English
        ordering = ['-name']


class TechnologicalArea(models.Model):
    """Model for a technological areas."""

    name = models.CharField(max_length=80)
    abbreviation = models.CharField(max_length=10)
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a technological area."""
        return self.name

    class Meta:
        """Meta options for class."""

        ordering = ['abbreviation']


class ProgressOutcome(models.Model):
    """Model for a progress outcome."""

    name = models.CharField(max_length=80)
    abbreviation = models.CharField(max_length=10)
    technological_area = models.ForeignKey(
        TechnologicalArea,
        on_delete=models.CASCADE,
        related_name='progress_outcomes',
    )
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a progress outcome."""
        return self.name

    class Meta:
        """Meta options for class."""

        ordering = ['abbreviation']


class NZQAStandard(models.Model):
    """Model for a NZQA standard."""

    name = models.CharField(max_length=200)
    abbreviation = models.CharField(max_length=20)
    NCEA_LEVEL_1 = 1
    NCEA_LEVEL_2 = 2
    NCEA_LEVEL_3 = 3
    NCEA_LEVEL_CHOICES = (
        (NCEA_LEVEL_1, _('NCEA Level 1')),
        (NCEA_LEVEL_2, _('NCEA Level 2')),
        (NCEA_LEVEL_3, _('NCEA Level 3')),
    )
    level = models.PositiveSmallIntegerField(
        choices=NCEA_LEVEL_CHOICES,
        default=NCEA_LEVEL_1,
    )
    INTERNAL_STANDARD = 1
    EXTERNAL_STANDARD = 2
    STANDARD_TYPE_CHOICES = (
        (INTERNAL_STANDARD, _('Internal')),
        (EXTERNAL_STANDARD, _('External')),
    )
    standard_type = models.PositiveSmallIntegerField(
        choices=STANDARD_TYPE_CHOICES,
        default=INTERNAL_STANDARD,
    )
    credit_value = models.PositiveSmallIntegerField(
        default=1,
    )
<commit_msg>Style fix<commit_after>"""Models for resources application."""

from os.path import join, basename, splitext
from re import match
import logging
from django.db import models
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from autoslug import AutoSlugField
import filetype
from utils.get_upload_filepath import get_resource_upload_path
from utils.google_drive_api import get_google_drive_mimetype
from ckeditor_uploader.fields import RichTextUploadingField

ICON_PATH = 'img/icons/'
GOOGLE_DRIVE_REGEX = 'https://(drive|docs).google.com'
logger = logging.getLogger(__name__)


class Language(models.Model):
    """Model for a resource language."""

    name = models.CharField(max_length=40)
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a language."""
        return self.name

    class Meta:
        """Meta options for class."""

        # Māori before English
        ordering = ['-name']


class TechnologicalArea(models.Model):
    """Model for a technological areas."""

    name = models.CharField(max_length=80)
    abbreviation = models.CharField(max_length=10)
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a technological area."""
        return self.name

    class Meta:
        """Meta options for class."""

        ordering = ['abbreviation']


class ProgressOutcome(models.Model):
    """Model for a progress outcome."""

    name = models.CharField(max_length=80)
    abbreviation = models.CharField(max_length=10)
    technological_area = models.ForeignKey(
        TechnologicalArea,
        on_delete=models.CASCADE,
        related_name='progress_outcomes',
    )
    css_class = models.CharField(max_length=30)

    def __str__(self):
        """Text representation of a progress outcome."""
        return self.name

    class Meta:
        """Meta options for class."""

        ordering = ['abbreviation']


class NZQAStandard(models.Model):
    """Model for a NZQA standard."""

    name = models.CharField(max_length=200)
    abbreviation = models.CharField(max_length=20)
    NCEA_LEVEL_1 = 1
    NCEA_LEVEL_2 = 2
    NCEA_LEVEL_3 = 3
    NCEA_LEVEL_CHOICES = (
        (NCEA_LEVEL_1, _('NCEA Level 1')),
        (NCEA_LEVEL_2, _('NCEA Level 2')),
        (NCEA_LEVEL_3, _('NCEA Level 3')),
    )
    level = models.PositiveSmallIntegerField(
        choices=NCEA_LEVEL_CHOICES,
        default=NCEA_LEVEL_1,
    )
    INTERNAL_STANDARD = 1
    EXTERNAL_STANDARD = 2
    STANDARD_TYPE_CHOICES = (
        (INTERNAL_STANDARD, _('Internal')),
        (EXTERNAL_STANDARD, _('External')),
    )
    standard_type = models.PositiveSmallIntegerField(
        choices=STANDARD_TYPE_CHOICES,
        default=INTERNAL_STANDARD,
    )
    credit_value = models.PositiveSmallIntegerField(
        default=1,
    )
{'fraction_non_alphanumeric': 0.1001527754201324, 'fraction_numerical': 0.012561534544219996, 'mean_word_length': 3.380669144981413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4098992', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1786, 'n_words': 411}