Exemple #1
0
def write_tas(tas):
    SharedData.TAS = tas

    tas_json = []

    for ta in tas:
        tas_json.append(ta.to_json())

    path = SharedData.get_ta_data()
    with open(path, "w") as _file:
        json.dump(tas_json, _file, indent=2)
Exemple #2
0
def load_tas() -> list:
    SharedData.TAS.clear()
    path = SharedData.get_ta_data()
    if not os.path.exists(path):
        return []

    with open(path, "r") as tas_file:
        tas_json = json.load(tas_file)

    for ta in tas_json:
        SharedData.TAS.append(TA.from_json(ta))

    return SharedData.TAS