<commit_before>import requests
import json

#merchant 1(grocery): "57cf75cea73e494d8675ec4b #good
#merchant 2(clothes): 57cf75cea73e494d8675ec50  #ok 
#merchant 3(personal): 57cf75cea73e494d8675ec51 #worst
def get_purchase_by_account(account_id):
    purchase_url="http://api.reimaginebanking.com/accounts/{}/purchases?key=<KEY>".format(account_id)
    purchases=requests.get(purchase_url)
    purchases=json.loads(purchases.text)
    l=[]
    for purchase in purchases:
        purchase_amount=purchase["amount"]
        l.append(purchase_amount)
    return l

def get_purchase_amounts():
    account_url="http://api.reimaginebanking.com/accounts?key=<KEY>"
    all_accounts=requests.get(account_url)
    all_accounts=json.loads(all_accounts.text)
    users = []
    for account in all_accounts:
        acc=[] #list of lists. [[clothes], [groceries], [personal]]
        account_id=account["_id"]
        #do something with this
        l=get_purchase_by_account(account_id)
        clothes=l[0:12]
        groceries=l[12:-6]
        personal=l[-6:]
        acc.append(clothes)
        acc.append(groceries)
        acc.append(personal)
        users.append(acc)
    return users

def overlayPurchases(l):
    overlayed = []
    for i in range(len(l[0])): #syncs to monthly basis ie clothes
        overlayed.append(l[0][i])
        i1 = (len(l[1])//len(l[0]))*i
        i2 = i1 + (len(l[1])//len(l[0]))
        overlayed[i] += sum(l[1][i1:i2])
        if i % 2==0:
            overlayed[i] += l[2][i//2]
    return overlayed

def getScore():
    x = get_purchase_amounts()
    stds = []
    for i in x:
        w = overlayPurchases(i) #later change to using overlay
        mean  = sum(w)/len(w)
        sumOfSquares = 0
        for j in w:
            sumOfSquares += (j-mean)**2
        std = (sumOfSquares/len(w))**0.5
        stds.append(std)
    return stds

def main():
    print(getScore())
main()
<commit_msg>Fixed Credit Score error<commit_after>import requests
import json

#merchant 1(grocery): "57cf75cea73e494d8675ec4b #good
#merchant 2(clothes): 57cf75cea73e494d8675ec50  #ok 
#merchant 3(personal): 57cf75cea73e494d8675ec51 #worst
def get_purchase_by_account(account_id):
    purchase_url="http://api.reimaginebanking.com/accounts/{}/purchases?key=<KEY>".format(account_id)
    purchases=requests.get(purchase_url)
    purchases=json.loads(purchases.text)
    l=[]
    for purchase in purchases:
        purchase_amount=purchase["amount"]
        l.append(purchase_amount)
    return l

def get_purchase_amounts():
    account_url="http://api.reimaginebanking.com/accounts?key=<KEY>"
    all_accounts=requests.get(account_url)
    all_accounts=json.loads(all_accounts.text)
    users = []
    for account in all_accounts:
        acc=[] #list of lists. [[clothes], [groceries], [personal]]
        account_id=account["_id"]
        #do something with this
        l=get_purchase_by_account(account_id)
        clothes=l[0:12]
        groceries=l[12:-6]
        personal=l[-6:]
        acc.append(clothes)
        acc.append(groceries)
        acc.append(personal)
        users.append(acc)
    return users

def overlayPurchases(l):
    overlayed = []
    for i in range(len(l[0])): #syncs to monthly basis ie clothes
        overlayed.append(l[0][i])
        i1 = (len(l[1])//len(l[0]))*i
        i2 = i1 + (len(l[1])//len(l[0]))
        overlayed[i] += sum(l[1][i1:i2])
        if i % 2==0:
            overlayed[i] += l[2][i//2]
    return overlayed

def getScore():
    x = get_purchase_amounts()
    stds = []
    for i in x[:-1]:
        w = overlayPurchases(i)
        mean  = sum(w)/len(w)
        sumOfSquares = 0
        for j in w:
            sumOfSquares += (j-mean)**2
        std = (sumOfSquares/len(w))**0.5
        stds.append(std)
    return stds

def main():
    print(getScore())
main()

{'fraction_non_alphanumeric': 0.13986928104575164, 'fraction_numerical': 0.03895424836601307, 'mean_word_length': 2.9362139917695473, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2233630', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1416, 'n_words': 248}