<commit_before>import os.path as op
import configparser
import smtplib
from email.mime.text import MIMEText


def fetch_config(prj_number):
    config = configparser.ConfigParser()
    ini_file = op.join(op.dirname(op.abspath(__file__)), "config.ini")
    if op.exists(ini_file):
        config.read(ini_file)
        if prj_number in config:
            server = config[prj_number]["server"]
            sender = config[prj_number]["sender"]
            receiver = config[prj_number]["receiver"]
            return server, sender, receiver
    else:
        return None, None, None


def notify(prj_number, prj_path, port=25):
    mail_server, mail_sender, mail_recipients = fetch_config(prj_number)
    if mail_server:
        mail_text = f"warning - rvt model {prj_number} at path {prj_path} is corrupt!"
        msg = MIMEText(mail_text)
        msg['From'] = mail_sender
        msg['To'] = mail_recipients
        msg['Subject'] = f"{prj_number} - rvt model corrupt"

        with smtplib.SMTP(f"{mail_server}:{port}") as smtp_con:
            smtp_con.send_message(msg)<commit_msg>send_mail - journal excerpt added<commit_after>import os.path as op
import configparser
import smtplib
from email.mime.text import MIMEText


def fetch_config(prj_number):
    config = configparser.ConfigParser()
    ini_file = op.join(op.dirname(op.abspath(__file__)), "config.ini")
    if op.exists(ini_file):
        config.read(ini_file)
        if prj_number in config:
            server = config[prj_number]["server"]
            sender = config[prj_number]["sender"]
            receiver = config[prj_number]["receiver"]
            return server, sender, receiver
    else:
        return None, None, None


def notify(prj_number, prj_path, journal_excerpt, port=25):
    mail_server, mail_sender, mail_recipients = fetch_config(prj_number)
    if mail_server:
        mail_text = f"warning - rvt model {prj_number} at path {prj_path} is corrupt! \nsee journal: {journal_excerpt}"
        msg = MIMEText(mail_text)
        msg['From'] = mail_sender
        msg['To'] = mail_recipients
        msg['Subject'] = f"{prj_number} - rvt model corrupt!!"

        with smtplib.SMTP(f"{mail_server}:{port}") as smtp_con:
            smtp_con.send_message(msg)
{'fraction_non_alphanumeric': 0.1094306049822064, 'fraction_numerical': 0.0017793594306049821, 'mean_word_length': 3.1725417439703154, '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': '7216495', 'n_tokens_mistral': 746, 'n_tokens_neox': 736, 'n_words': 160}