<commit_before>from collections import defaultdict
from contextlib import contextmanager
from email.utils import formatdate, make_msgid
import os
import smtplib
from email.mime.text import MIMEText

from sqlalchemy import not_
from jinja2 import Template

from cfg import config, parse_cfg_date, pretty_date
import database as db
from database.model import Team
from geotools import openroute_link, gmaps_link
from geotools.routing import MapPoint


@contextmanager
def smtp_session():
    session = smtplib.SMTP(config.MAIL_SERVER, config.MAIL_PORT)
    if config.MAIL_USERNAME is not None:
        session.starttls()
        session.login(config.MAIL_USERNAME, config.MAIL_PASSWORD)

    try:<commit_msg>Check if mail username is setz<commit_after>from collections import defaultdict
from contextlib import contextmanager
from email.utils import formatdate, make_msgid
import os
import smtplib
from email.mime.text import MIMEText

from sqlalchemy import not_
from jinja2 import Template

from cfg import config, parse_cfg_date, pretty_date
import database as db
from database.model import Team
from geotools import openroute_link, gmaps_link
from geotools.routing import MapPoint


@contextmanager
def smtp_session():
    session = smtplib.SMTP(config.MAIL_SERVER, config.MAIL_PORT)
    if hasattr(config, "MAIL_USERNAME") and config.MAIL_USERNAME is not None:
        session.starttls()
        session.login(config.MAIL_USERNAME, config.MAIL_PASSWORD)

    try:
{'fraction_non_alphanumeric': 0.05115961800818554, 'fraction_numerical': 0.001364256480218281, 'mean_word_length': 5.242553191489361, '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': '891863', 'n_tokens_mistral': 429, 'n_tokens_neox': 435, 'n_words': 141}