<commit_before>import abc

import furl

from mfr.core import exceptions
from mfr.server import settings


class BaseProvider(metaclass=abc.ABCMeta):

    def __init__(self, request, url):
        self.request = request
        url_netloc = furl.furl(url).netloc
        if url_netloc not in settings.ALLOWED_PROVIDER_NETLOCS:
            raise exceptions.ProviderError(
                message="{} is not a permitted provider domain.".format(url_netloc),
                code=400
            )
        self.url = url

    @abc.abstractmethod
    def metadata(self):
        pass

    @abc.abstractmethod
    def download(self):
        pass


class ProviderMetadata:

    def __init__(self, name, ext, content_type, unique_key, download_url):
        self.name = name
        self.ext = ext
        self.content_type = content_type
        self.unique_key = unique_key<commit_msg>HTML invalid provider name in error message<commit_after>import abc
import markupsafe

import furl

from mfr.core import exceptions
from mfr.server import settings


class BaseProvider(metaclass=abc.ABCMeta):

    def __init__(self, request, url):
        self.request = request
        url_netloc = furl.furl(url).netloc
        if url_netloc not in settings.ALLOWED_PROVIDER_NETLOCS:
            raise exceptions.ProviderError(
                message="{} is not a permitted provider domain.".format(
                    markupsafe.escape(url_netloc)
                ),
                code=400
            )
        self.url = url

    @abc.abstractmethod
    def metadata(self):
        pass

    @abc.abstractmethod
    def download(self):
        pass


class ProviderMetadata:

    def __init__(self, name, ext, content_type, unique_key, download_url):
        self.name = name
        self.ext = ext
        self.content_type = content_type
        self.unique_key = unique_key
{'fraction_non_alphanumeric': 0.07345844504021448, 'fraction_numerical': 0.0032171581769436996, 'mean_word_length': 2.3085106382978724, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '617847', 'n_tokens_mistral': 547, 'n_tokens_neox': 523, 'n_words': 136}