<commit_before>from django.conf import settings as django_settings
from django.utils.importlib import import_module
from django.core.exceptions import ImproperlyConfigured


class NewsletterSettings(object):
    """
    A settings object, that handles newsletter default settings.
    """

    @property
    def RICHTEXT_WIDGET(self):
        # Import and set the richtext field
        NEWSLETTER_RICHTEXT_WIDGET = \
            getattr(django_settings, "NEWSLETTER_RICHTEXT_WIDGET", "")

        if NEWSLETTER_RICHTEXT_WIDGET:
            try:<commit_msg>Add NEWSLETTER_CONFIRM_EMAIL... settings<commit_after>from django.conf import settings as django_settings
from django.utils.importlib import import_module
from django.core.exceptions import ImproperlyConfigured


class NewsletterSettings(object):
    """
    A settings object, that handles newsletter default settings.

    With instance being instance of NewsletterSettings,
    accessing instance.SETTING_NAME returns NEWSLETTER_SETTING_NAME,
    if it's defined in project, or instance.DEFAULT_SETTING_NAME if not.

    DEFAULT_SETTING_NAME can be a class variable or a property if needed.

    SETTING_NAME can be overridden if above behavior is not adequate.
    """

    def __getattr__(self, attr):
        return getattr(
            django_settings,
            'NEWSLETTER_%s' % attr,
            getattr(self, 'DEFAULT_%s' % attr)
        )

    DEFAULT_CONFIRM_EMAIL = True

    @property
    def DEFAULT_CONFIRM_EMAIL_SUBSCRIBE(self):
        return self.CONFIRM_EMAIL

    @property
    def DEFAULT_CONFIRM_EMAIL_UNSUBSCRIBE(self):
        return self.CONFIRM_EMAIL

    @property
    def DEFAULT_CONFIRM_EMAIL_UPDATE(self):
        return self.CONFIRM_EMAIL

    @property
    def RICHTEXT_WIDGET(self):
        # Import and set the richtext field
        NEWSLETTER_RICHTEXT_WIDGET = \
            getattr(django_settings, "NEWSLETTER_RICHTEXT_WIDGET", "")

        if NEWSLETTER_RICHTEXT_WIDGET:
            try:
{'fraction_non_alphanumeric': 0.05988928032209361, 'fraction_numerical': 0.0, 'mean_word_length': 3.247863247863248, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6850123', 'n_tokens_mistral': 605, 'n_tokens_neox': 603, 'n_words': 147}