<commit_before>import email.utils

from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMessage

from detention_notifier.models import Detention, DetentionMailer, DetentionCC
from academics.models import AcademicYear, Enrollment

def get_body(detention):
    term_detentions = Detention.objects.filter(
                                        student=detention.student,
                                        term=detention.term,
                                        offense__mail=True
                                        ).order_by('detention date')
        
    detention_mailer = DetentionMailer.objects.get()
    
    if detention.offense:
        offense = detention.offense
    elif detention_mailer.blank_offense:
        offense = detention_mailer.blank_offense
    else:
        raise ValueError("Cannot get offense for internal detention {}".format(detention.id))
    
    out_term_detentions = []
    
    for term_detention in term_detentions:
        if term_detention.offense:
            out_term_detentions.append((term_detention, term_detention.offense))
        elif detention_mailer.blank_offense:
            out_term_detentions.append((term_detention, detention_mailer.blank_offense))
        else:
            raise ValueError("Cannot get offense for internal detention {}".format(detention.id))
    
    context = {
        'student': detention.student,
        'teacher': detention.teacher,<commit_msg>Typo fix<commit_after>import email.utils

from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMessage

from detention_notifier.models import Detention, DetentionMailer, DetentionCC
from academics.models import AcademicYear, Enrollment

def get_body(detention):
    term_detentions = Detention.objects.filter(
                                        student=detention.student,
                                        term=detention.term,
                                        offense__mail=True
                                        ).order_by('detention_date')
        
    detention_mailer = DetentionMailer.objects.get()
    
    if detention.offense:
        offense = detention.offense
    elif detention_mailer.blank_offense:
        offense = detention_mailer.blank_offense
    else:
        raise ValueError("Cannot get offense for internal detention {}".format(detention.id))
    
    out_term_detentions = []
    
    for term_detention in term_detentions:
        if term_detention.offense:
            out_term_detentions.append((term_detention, term_detention.offense))
        elif detention_mailer.blank_offense:
            out_term_detentions.append((term_detention, detention_mailer.blank_offense))
        else:
            raise ValueError("Cannot get offense for internal detention {}".format(detention.id))
    
    context = {
        'student': detention.student,
        'teacher': detention.teacher,
{'fraction_non_alphanumeric': 0.0688272636151019, 'fraction_numerical': 0.0, 'mean_word_length': 2.383050847457627, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2855300', 'n_tokens_mistral': 776, 'n_tokens_neox': 763, 'n_words': 159}