1 # Save and resume progress in lightcards
9 dired = f"{os.path.expanduser('~')}/.cache/lightcards/"
13 """Generate hash of stack for name of pickle file"""
14 return hashlib.md5(str([str(x) for x in stra]).encode("utf-8")).hexdigest()
18 """mkdir -p equivalent"""
19 if not os.path.exists(dired):
24 """Write pickle file"""
27 pickle.dump(obj, open(f"{dired}/{name_gen(stra)}.p", "wb"))
32 file = f"{dired}/{name_gen(stra)}.p"
34 if os.path.exists(file):
35 return pickle.load(open(file, "rb"))
41 """Delete pickle file"""
42 file = f"{dired}/{name_gen(stra)}/"
43 if os.path.exists(file):