<commit_before>from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from premailer import transform


def send_game_accepted(user, game):
    context = {
        'username': user.username,
        'name': game.name,
        'game_url': game.get_absolute_url()
    }
    subject = u"Your game submission for '{}' as been accepted!".format(game.name)
    return send_email('game_accepted', context, subject, user.email)


def send_confirmation_link(user, confirmation_link):
    context = {
        'username': user.username,
        'confirmation_link': confirmation_link
    }
    subject = 'Confirm your email address'
    return send_email('email_confirmation', context, subject, user.email)


def send_account_creation(user, confirmation_link):
    context = {
        'username': user.username,
        'confirmation_link': confirmation_link
    }
    subject = 'Welcome to Lutris.net'
    return send_email('account_creation', context, subject, user.email)


def send_daily_mod_mail():
    from games.notifier import get_mod_mail_content
    from accounts.models import User
    context = get_mod_mail_content()
    if settings.DEBUG:
        moderators = [u[1] for u in settings.MANAGERS]
    else:
        moderators = [u.email for u in User.objects.filter(is_staff=True)]
    subject = 'Your daily moderator mail'
    return send_email('daily_mod_mail', context, subject, moderators)


def send_email(template, context, subject, recipients, sender=None):
    context.update({
        'STATIC_URL': settings.STATIC_URL,
        'MEDIA_URL': settings.MEDIA_URL,
    })
    sender = sender or settings.DEFAULT_FROM_EMAIL
    if isinstance(recipients, basestring):
        recipients = [recipients]
    subject = u"{} {}".format(settings.EMAIL_SUBJECT_PREFIX, subject)
    text_part = render_to_string('emails/{}.txt'.format(template), context)
    msg = EmailMultiAlternatives(
        subject=subject,
        body=text_part,
        to=recipients,
        from_email=sender
    )
    html_body = render_to_string('emails/{}.html'.format(template), context)
    html_part = transform(html_body, base_url='http://lutris.net')
    msg.attach_alternative(html_part, "text/html")
    return msg.send(False)
<commit_msg>Fix typo in email title<commit_after>from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from premailer import transform


def send_game_accepted(user, game):
    context = {
        'username': user.username,
        'name': game.name,
        'game_url': game.get_absolute_url()
    }
    subject = u"Your game submission for '{}' has been accepted!".format(game.name)
    return send_email('game_accepted', context, subject, user.email)


def send_confirmation_link(user, confirmation_link):
    context = {
        'username': user.username,
        'confirmation_link': confirmation_link
    }
    subject = 'Confirm your email address'
    return send_email('email_confirmation', context, subject, user.email)


def send_account_creation(user, confirmation_link):
    context = {
        'username': user.username,
        'confirmation_link': confirmation_link
    }
    subject = 'Welcome to Lutris.net'
    return send_email('account_creation', context, subject, user.email)


def send_daily_mod_mail():
    from games.notifier import get_mod_mail_content
    from accounts.models import User
    context = get_mod_mail_content()
    if settings.DEBUG:
        moderators = [u[1] for u in settings.MANAGERS]
    else:
        moderators = [u.email for u in User.objects.filter(is_staff=True)]
    subject = 'Your daily moderator mail'
    return send_email('daily_mod_mail', context, subject, moderators)


def send_email(template, context, subject, recipients, sender=None):
    context.update({
        'STATIC_URL': settings.STATIC_URL,
        'MEDIA_URL': settings.MEDIA_URL,
    })
    sender = sender or settings.DEFAULT_FROM_EMAIL
    if isinstance(recipients, basestring):
        recipients = [recipients]
    subject = u"{} {}".format(settings.EMAIL_SUBJECT_PREFIX, subject)
    text_part = render_to_string('emails/{}.txt'.format(template), context)
    msg = EmailMultiAlternatives(
        subject=subject,
        body=text_part,
        to=recipients,
        from_email=sender
    )
    html_body = render_to_string('emails/{}.html'.format(template), context)
    html_part = transform(html_body, base_url='http://lutris.net')
    msg.attach_alternative(html_part, "text/html")
    return msg.send(False)

{'fraction_non_alphanumeric': 0.104306427180264, 'fraction_numerical': 0.00043280675178532783, 'mean_word_length': 3.760041194644696, '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': '6372781', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1365, 'n_words': 312}