<commit_before>from pyramid_mailer.message import (
    Message,
)

import logging
log = logging.getLogger(__name__)

# TODO make this configurable
# FROM = '3things Status Updates <<EMAIL>>'
FROM = '<EMAIL>'

NOTIFICATION_TEMPLATE = """
Hi,

Please reply with your weekly status update! Three simple things that
you did last week, and three things you're planning on doing next week.

Cheers,
Friendly Robot
"""


def send_notification(mailer, user, for_week):
    year, week_number, day_number = for_week.isocalendar()
    subject = "Status Reminder for Week {} of {}".format(week_number,
                                                         year)
    message = Message(subject=subject,
                      sender=FROM,
                      recipients=[user.email_address],
                      body=NOTIFICATION_TEMPLATE)
    mailer.send(message)
    user.last_notified = for_week
    return message


CONFIRM_TEMPLATE = """
Thanks! I've got it.

Cheers,
Friendly Robot
"""


def send_confirm(mailer, user, reply_to_id=None, reply_to_subject=None):
    headers = {}

    if reply_to_id is not None:
        headers['In-Reply-To'] = reply_to_id

    if reply_to_subject is not None:
        subject = "Re: " + reply_to_subject
    else:
        subject = "Got your update!"

    message = Message(subject=subject,
                      sender=FROM,
                      recipients=[user.email_address],
                      body=CONFIRM_TEMPLATE,
                      extra_headers=headers,
                      )
    mailer.send(message)
    return message


WELCOME_MESSAGE_TEMPLATE = """
Hi there!

Welcome to the 3things status update email workflow awesomeness tool with
power features. Every week you'll get an email from me asking you to tell
me what what you've been doing this week, and what your planning on doing
next week. Just reply to that email and I'll make sure to let everyone else
on your team know what you've been up to.

You can also send me an email at any time before I remind you! I'll keep
track of all the emails you send me in a week and summarize them on Monday
morning.

See you next Friday!
Friendly Robot
"""


def welcome_user(mailer, user):
    message = Message(subject="Welcome to 3things!",
                      sender=FROM,
                      recipients=[user.email_address],
                      body=WELCOME_MESSAGE_TEMPLATE,
                      )
    mailer.send(message)
    return user
<commit_msg>Use nice name in FROM<commit_after>from pyramid_mailer.message import (
    Message,
)

import logging
log = logging.getLogger(__name__)

# TODO make this configurable
# FROM = '3things Status Updates <<EMAIL>>'
FROM = '3things Status Updates <<EMAIL>>'

NOTIFICATION_TEMPLATE = """
Hi,

Please reply with your weekly status update! Three simple things that
you did last week, and three things you're planning on doing next week.

Cheers,
Friendly Robot
"""


def send_notification(mailer, user, for_week):
    year, week_number, day_number = for_week.isocalendar()
    subject = "Status Reminder for Week {} of {}".format(week_number,
                                                         year)
    message = Message(subject=subject,
                      sender=FROM,
                      recipients=[user.email_address],
                      body=NOTIFICATION_TEMPLATE)
    mailer.send(message)
    user.last_notified = for_week
    return message


CONFIRM_TEMPLATE = """
Thanks! I've got it.

Cheers,
Friendly Robot
"""


def send_confirm(mailer, user, reply_to_id=None, reply_to_subject=None):
    headers = {}

    if reply_to_id is not None:
        headers['In-Reply-To'] = reply_to_id

    if reply_to_subject is not None:
        subject = "Re: " + reply_to_subject
    else:
        subject = "Got your update!"

    message = Message(subject=subject,
                      sender=FROM,
                      recipients=[user.email_address],
                      body=CONFIRM_TEMPLATE,
                      extra_headers=headers,
                      )
    mailer.send(message)
    return message


WELCOME_MESSAGE_TEMPLATE = """
Hi there!

Welcome to the 3things status update email workflow awesomeness tool with
power features. Every week you'll get an email from me asking you to tell
me what what you've been doing this week, and what your planning on doing
next week. Just reply to that email and I'll make sure to let everyone else
on your team know what you've been up to.

You can also send me an email at any time before I remind you! I'll keep
track of all the emails you send me in a week and summarize them on Monday
morning.

See you next Friday!
Friendly Robot
"""


def welcome_user(mailer, user):
    message = Message(subject="Welcome to 3things!",
                      sender=FROM,
                      recipients=[user.email_address],
                      body=WELCOME_MESSAGE_TEMPLATE,
                      )
    mailer.send(message)
    return user

{'fraction_non_alphanumeric': 0.07383498083518257, 'fraction_numerical': 0.0014121444422029454, 'mean_word_length': 2.4193103448275863, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '4017679', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1349, 'n_words': 477}