<commit_before>from selenium import webdriver
from pync import Notifier
import time
import sys
import os

def formatGradeData(data, credits, result):

	credits = credits.split(" ")

	result += "~~~~~~ CREDITS SO FAR: " + credits[2] + " ~~~~~~\n\n"

	for i in range(len(data)):
		result += "Class: " + data[i][0] + "\n"
		result += "Mark: " + data[i][2] + "\n"
		result += "Grade: " + data[i][3] + "\n"
		result += "ClassAverage: " + data[i][4] + "\n"

		if(data[i][2] == ""):
			result += "Don't worry fam, you'll get your grade soon\n"
		elif(data[i][3] <= data[i][4]):
			result += "You beat class average, fuck ya! \n"

		result += "\n\n"

	return result

def check_if_new_data(old, new):

	#if(old == new):
	# 	return 

	#else:
	old = old.split("\n\n")
	new = new.split("\n\n")

	old_credits = old[1].split(' ')[4]
	new_credits = new[1].split(' ')[4]

	#if(float(old_credits) == float(new_credits)):
	#	return

	#else:
	for i in range(2, len(old) - 1):
		old_credits = old[i].split('\n')
		new_credits = new[i].split('\n')

		if(old_credits[2] != new_credits[2]):
			grade_num = new_credits[2].split(" ")[1]
			Notifier.notify("You have a new grade for " + old_credits[1] + 
			" of " + grade_num)
		if(old_credits[4] != new_credits[4]):
			grade_letter = new_credits[3].split(" ")[1]
			class_avg = new_credits[4].split(" ")[1]

			if(grade_num < class_avg):
				Notifier.notify("The class average for " + old_credits[1] + " was posted."
					+ "You beat the class average with a " + grade_letter + ".")
			else:
				Notifier.notify("The class average for " + old_credits[1] + " was posted."
					+ "You got an " + grade_letter + " in this class.")

def check_past_data(data):

	results = data.split('\n')
	credentials = results[0].split(" ")

	if(len(credentials) == 2):
		return credentials, True

	return None, False

def main():

	filename = 'workfile.txt'
	past_data = ''
	file_exists = False
	save = 'n'
	if(os.path.isfile(filename)):
		f = open(filename, 'r')
		past_data = f.read()
		f.close()
		file_exists = True

	credentials, saved = check_past_data(past_data)
	if(saved):<commit_msg>added a % at the end of the grade for nagee's whiny ass<commit_after>from selenium import webdriver
import time
import sys
import os

def notify(title, text):
    os.system("""
              osascript -e 'display notification "{}" with title "{}"'
              """.format(text, title))


def formatGradeData(data, credits, result):

	credits = credits.split(" ")

	result += "~~~~~~ CREDITS SO FAR: " + credits[2] + " ~~~~~~\n\n"

	for i in range(len(data)):
		result += "Class: " + data[i][0] + "\n"
		result += "Mark: " + data[i][2] + "\n"
		result += "Grade: " + data[i][3] + "\n"
		result += "ClassAverage: " + data[i][4] + "\n"

		if(data[i][2] == ""):
			result += "Don't worry fam, you'll get your grade soon\n"
		elif(data[i][3] <= data[i][4]):
			result += "You beat class average, fuck ya! \n"

		result += "\n\n"

	return result

def check_if_new_data(old, new):

	#if(old == new):
	# 	return 

	#else:
	old = old.split("\n\n")
	new = new.split("\n\n")

	old_credits = old[1].split(' ')[4]
	new_credits = new[1].split(' ')[4]

	#if(float(old_credits) == float(new_credits)):
	#	return

	#else:
	for i in range(2, len(old) - 1):
		old_credits = old[i].split('\n')
		new_credits = new[i].split('\n')

		if(old_credits[2] != new_credits[2]):

			grade_num = new_credits[2].split(" ")[1]
			notify("Grade Update", "You have a new grade for " + old_credits[1] + 
			" of " + grade_num + "%")

		if(old_credits[4] != new_credits[4]):

			grade_letter = new_credits[3].split(" ")[1]
			class_avg = new_credits[4].split(" ")[1]

			if(grade_num < class_avg):
				notify("Grade Update", "The class average for " + old_credits[1] + " was posted."
					+ "You beat the class average with a " + grade_letter + ".", )
			else:
				notify("Grade Update", "The class average for " + old_credits[1] + " was posted."
					+ "You got an " + grade_letter + " in this class.", )

def check_past_data(data):

	results = data.split('\n')
	credentials = results[0].split(" ")

	if(len(credentials) == 2):
		return credentials, True

	return None, False

def main():

	filename = 'workfile.txt'
	past_data = ''
	file_exists = False
	save = 'n'
	if(os.path.isfile(filename)):
		f = open(filename, 'r')
		past_data = f.read()
		f.close()
		file_exists = True

	credentials, saved = check_past_data(past_data)
	if(saved):
{'fraction_non_alphanumeric': 0.19378261856137963, 'fraction_numerical': 0.013160880417517586, 'mean_word_length': 3.6012526096033404, 'pattern_counts': {'":': 0, '<': 7, '<?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': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3758357', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1689, 'n_words': 406}