From 7fa2ff08274aca594af3f66b4388b80ed7bd4df8 Mon Sep 17 00:00:00 2001 From: justuser31 Date: Sat, 13 May 2023 18:41:28 +0300 Subject: [PATCH] Fix creating broken mine.json --- tests/data.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/data.py b/tests/data.py index f6ef995..3f155aa 100644 --- a/tests/data.py +++ b/tests/data.py @@ -1,19 +1,18 @@ import json from os.path import isfile -from os import system as sys # Money -# {username: balance, ...} -class money(): +# {username: [balance, OpenKey], ...} +class users(): def read(): - if not isfile("money.json"): - sys('echo "{}" > money.json') - with open('money.json', 'r') as openfile: + if not isfile("users.json"): + sys('echo "{}" > users.json') + with open('users.json', 'r') as openfile: data = json.load(openfile) return data def write(data): js = json.dumps(data, indent=4) - with open("money.json", "w") as outfile: + with open("users.json", "w") as outfile: outfile.write(js) # Mining + Registrations @@ -22,7 +21,8 @@ class money(): class mine(): def read(): if not isfile("mine.json"): - sys('echo "[]" > mine.json') + #sys('echo "[]" > mine.json') + mine.write([]) with open('mine.json', 'r') as openfile: data = json.load(openfile) return data @@ -46,16 +46,16 @@ class pay(): with open("pay.json", "w") as outfile: outfile.write(js) -# Keys -# {"user32532": "762eagdfgtars5e34", ...} -class keys(): +# Ways +# [bore.pub:5423, bore.pub:2239, ...] +class ways(): def read(): - if not isfile("keys.json"): - sys('echo "{}" > keys.json') - with open('keys.json', 'r') as openfile: + if not isfile("ways.json"): + sys('echo "[]" > ways.json') + with open('ways.json', 'r') as openfile: data = json.load(openfile) return data def write(data): js = json.dumps(data, indent=4) - with open("keys.json", "w") as outfile: + with open("ways.json", "w") as outfile: outfile.write(js)