<commit_before># -*- coding: utf-8 -*-
#
# Copyright © 2009-2011 <NAME> <<EMAIL>>
#
# muspy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# muspy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with muspy.  If not, see <http://www.gnu.org/licenses/>.

import random
from smtplib import SMTPException
import string
from time import sleep

from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.db import connection, IntegrityError, models, transaction
from django.db.backends.signals import connection_created
from django.db.models import Count, Q
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.template.loader import render_to_string

import app.musicbrainz as mb
from app.tools import date_to_iso8601, date_to_str, str_to_date


class Artist(models.Model):

    mbid = models.CharField(max_length=36, unique=True)
    name = models.CharField(max_length=512)
    sort_name = models.CharField(max_length=512)
    disambiguation = models.CharField(max_length=512)
    users = models.ManyToManyField(User, through='UserArtist')

    blacklisted = [
        '89ad4ac3-39f7-470e-963a-56509c546377', # Various Artists
        'fe5b7087-438f-4e7e-afaf-6d93c8c888b2', # Various Artists
        'f731ccc4-e22a-43af-a747-64213329e088', # [anonymous]
        '33cf029c-63b0-41a0-9855-be2a3665fb3b', # [data]
        '314e1c25-dde7-4e4d-b2f4-0a7b9f7c56dc', # [dialogue]
        'eec63d3c-3b81-4ad4-b1e4-7c147d4d2b61', # [no artist]
        '9be7f096-97ec-4615-8957-8d40b5dcbc41', # [traditional]
        '125ec42a-7229-4250-afc5-e057484327fe', # [unknown]
        '203b6058-2401-4bf0-89e3-8dc3d37c3f12', # [unknown]
        '5e760f5a-ea55-4b53-a18f-021c0d9779a6', # [unknown]
        '1d8bc797-ec8a-40d2-8d80-b1346b56a65f', # [unknown]
        '7734d67f-44d9-4ba2-91e3-9b067263210e', # [unknown]
        'd6bd72bc-b1e2-4525-92aa-0f853cbb41bf', # [soundtrack]
        ]
    class Blacklisted(Exception): pass
    class Unknown(Exception): pass

    @classmethod
    def get_by_mbid(cls, mbid):
        """ Fetches the artist and releases from MB if not in the database. """
        if mbid in cls.blacklisted:
            raise cls.Blacklisted()

        try:<commit_msg>Blacklist another Various Artists alias<commit_after># -*- coding: utf-8 -*-
#
# Copyright © 2009-2011 <NAME> <<EMAIL>>
#
# muspy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# muspy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with muspy.  If not, see <http://www.gnu.org/licenses/>.

import random
from smtplib import SMTPException
import string
from time import sleep

from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.db import connection, IntegrityError, models, transaction
from django.db.backends.signals import connection_created
from django.db.models import Count, Q
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.template.loader import render_to_string

import app.musicbrainz as mb
from app.tools import date_to_iso8601, date_to_str, str_to_date


class Artist(models.Model):

    mbid = models.CharField(max_length=36, unique=True)
    name = models.CharField(max_length=512)
    sort_name = models.CharField(max_length=512)
    disambiguation = models.CharField(max_length=512)
    users = models.ManyToManyField(User, through='UserArtist')

    blacklisted = [
        '89ad4ac3-39f7-470e-963a-56509c546377', # Various Artists
        'fe5b7087-438f-4e7e-afaf-6d93c8c888b2', # Various Artists
        '0677ef60-6be5-4e36-9d1e-8bb2bf85b981', # Various Artists
        'f731ccc4-e22a-43af-a747-64213329e088', # [anonymous]
        '33cf029c-63b0-41a0-9855-be2a3665fb3b', # [data]
        '314e1c25-dde7-4e4d-b2f4-0a7b9f7c56dc', # [dialogue]
        'eec63d3c-3b81-4ad4-b1e4-7c147d4d2b61', # [no artist]
        '9be7f096-97ec-4615-8957-8d40b5dcbc41', # [traditional]
        '125ec42a-7229-4250-afc5-e057484327fe', # [unknown]
        '203b6058-2401-4bf0-89e3-8dc3d37c3f12', # [unknown]
        '5e760f5a-ea55-4b53-a18f-021c0d9779a6', # [unknown]
        '1d8bc797-ec8a-40d2-8d80-b1346b56a65f', # [unknown]
        '7734d67f-44d9-4ba2-91e3-9b067263210e', # [unknown]
        'd6bd72bc-b1e2-4525-92aa-0f853cbb41bf', # [soundtrack]
        ]
    class Blacklisted(Exception): pass
    class Unknown(Exception): pass

    @classmethod
    def get_by_mbid(cls, mbid):
        """ Fetches the artist and releases from MB if not in the database. """
        if mbid in cls.blacklisted:
            raise cls.Blacklisted()

        try:
{'fraction_non_alphanumeric': 0.09880995311936532, 'fraction_numerical': 0.10962856112513523, 'mean_word_length': 3.74508126603935, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '598379', 'n_tokens_mistral': 2259, 'n_tokens_neox': 1952, 'n_words': 482}