<commit_before>import sqlite3 as lite
import sys
from validateRequest import validateRequest

databasePath = '../Leaderboard/guardians.db'

#Manages single user stat requests
#Request is read in as a list, always in the following order:
#[pvp|pve], [total|avg], [stat (aliases discussed below)], ([vs], [user1], [user2], ...)

def singleStatCommands(request, author):
    def handleRequest(request, author):
        #Removes !stat
        request = " ".join(request.split(" ")[1:])
        valid = validateRequest(request)
        if not valid:
            return "Request not valid."
        request = request.split(" ")
        #Builds table name from pvp|pve and total|avg
        realm = request[0]
        style = request[1]
        stat = request[2]
        
        if style == "avg":
            style = "pga"
        tableName = realm+style

        output = singleStatReq(tableName, stat, author)
        return output

    def singleStatReq(tableName, stat, author):
        con = lite.connect('../Leaderboard/guardians.db')
        with con:
            cur = con.cursor()
            cur.execute("SELECT " + stat + " FROM " + tableName + " WHERE Name = ?",(author,))
            row = cur.fetchone()
            value = row[0]
            output = author+", your " + tableName[3:] + " " + stat + " are: " + str(value)
            return output

    output = handleRequest(request, author)
    return output
<commit_msg>Fixed some grammar<commit_after>import sqlite3 as lite
import sys
from validateRequest import validateRequest

databasePath = '../Leaderboard/guardians.db'

#Manages single user stat requests
#Request is read in as a list, always in the following order:
#[pvp|pve], [total|avg], [stat (aliases discussed below)], ([vs], [user1], [user2], ...)

def singleStatCommands(request, author):
    def handleRequest(request, author):
        #Removes !stat
        request = " ".join(request.split(" ")[1:])
        valid = validateRequest(request)
        if not valid:
            return "Request not valid."
        request = request.split(" ")
        #Builds table name from pvp|pve and total|avg
        realm = request[0]
        style = request[1]
        stat = request[2]
        
        if style == "avg":
            style = "pga"
        tableName = realm+style

        output = singleStatReq(tableName, stat, author)
        return output

    def singleStatReq(tableName, stat, author):
        con = lite.connect('../Leaderboard/guardians.db')
        with con:
            cur = con.cursor()
            cur.execute("SELECT " + stat + " FROM " + tableName + " WHERE Name = ?",(author,))
            row = cur.fetchone()
            if not row:
                return "Value does not exist."    
            value = row[0]
            #output = author+", your " + tableName[3:] + " " + stat + " are: " + str(value)
            if "pga" in tableName:
                start = "Average "
            else:
                start = "Total "
            output = start + stat + " for " + author + ": " + str(value)
            return output

    output = handleRequest(request, author)
    return output

{'fraction_non_alphanumeric': 0.1223319528512265, 'fraction_numerical': 0.005734310289901242, 'mean_word_length': 2.1494483450351054, 'pattern_counts': {'":': 3, '<': 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': '4911891', 'n_tokens_mistral': 893, 'n_tokens_neox': 875, 'n_words': 267}