<commit_before>from django.conf import settings
from django.template.loader import render_to_string
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.template import TemplateDoesNotExist

try:
    from django.utils.encoding import force_text
except ImportError:
    from django.utils.encoding import force_unicode as force_text

from .utils import import_attribute


class DefaultAdapter(object):

    def __init__(self, request=None):
        self.request = request

    def get_current_site(self):
        if self.request:
            site = get_current_site(self.request)
        elif 'django.contrib.sites' in settings.INSTALLED_APPS:
            from django.contrib.sites.models import Site
            site = Site.objects.get_current()
        else:
            site = None
        return site

    def format_email_subject(self, subject):
        prefix = getattr(settings, 'ACTISTREAM_EMAIL_SUBJECT_PREFIX', None)<commit_msg>Handle SITE_ID=None<commit_after>from django.conf import settings
from django.template.loader import render_to_string
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.template import TemplateDoesNotExist

try:
    from django.utils.encoding import force_text
except ImportError:
    from django.utils.encoding import force_unicode as force_text

from .utils import import_attribute


class DefaultAdapter(object):

    def __init__(self, request=None):
        self.request = request

    def get_current_site(self):
        if self.request:
            site = get_current_site(self.request)
        elif ('django.contrib.sites' in settings.INSTALLED_APPS and
              settings.SITE_ID):
            from django.contrib.sites.models import Site
            site = Site.objects.get_current()
        else:
            site = None
        return site

    def format_email_subject(self, subject):
        prefix = getattr(settings, 'ACTISTREAM_EMAIL_SUBJECT_PREFIX', None)
{'fraction_non_alphanumeric': 0.06522781774580336, 'fraction_numerical': 0.0, 'mean_word_length': 3.4477611940298507, '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': '3909120', 'n_tokens_mistral': 572, 'n_tokens_neox': 548, 'n_words': 148}