<commit_before>#!/usr/bin/env python3

import configparser

import requests
from bs4 import BeautifulSoup
import os

from smtplib import SMTP
from email.mime.text import MIMEText

class GradeChangeEmailer:
    """Emails about changes in the grade page of the FH Aachen."""

    def __init__(self, config_path="default.ini"):
        """Reads in config from config_path (default: default.ini)
        and sets configuration accordingly."""

        if os.path.isfile(config_path):
            config = configparser.ConfigParser()
            config.read(config_path)
            self.mail_adress        = config["Email"]["Adress"]
            self.mail_server        = config["Email"]["Server"]
            self.mail_password      = config["Email"]["Password"]
            self.qis_user           = config["QIS"]["Username"]
            self.qis_password       = config["QIS"]["Password"]
        else:
            print("Please provide a configuration file named 'default.ini'.")
            exit()

    def send_mail(self, text):<commit_msg>Change the scripts working directory to it's own directory.<commit_after>#!/usr/bin/env python3

import configparser

import requests
from bs4 import BeautifulSoup
import os

from smtplib import SMTP
from email.mime.text import MIMEText

class GradeChangeEmailer:
    """Emails about changes in the grade page of the FH Aachen."""

    def __init__(self, config_path="default.ini"):
        """Reads in config from config_path (default: default.ini)
        and sets configuration accordingly."""

        abspath = os.path.abspath(__file__)
        dir_name = os.path.dirname(abspath)
        os.chdir(dir_name)

        if os.path.isfile(config_path):
            config = configparser.ConfigParser()
            config.read(config_path)
            self.mail_adress        = config["Email"]["Adress"]
            self.mail_server        = config["Email"]["Server"]
            self.mail_password      = config["Email"]["Password"]
            self.qis_user           = config["QIS"]["Username"]
            self.qis_password       = config["QIS"]["Password"]
        else:
            print("Please provide a configuration file named 'default.ini'.")
            exit()

    def send_mail(self, text):
{'fraction_non_alphanumeric': 0.10819234194122886, 'fraction_numerical': 0.0017809439002671415, 'mean_word_length': 2.5497630331753554, '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': '267425', 'n_tokens_mistral': 615, 'n_tokens_neox': 626, 'n_words': 160}