aboutsummaryrefslogtreecommitdiff
path: root/modules/hashes.py
diff options
context:
space:
mode:
authorLeon Feng <523684+leon0707@users.noreply.github.com>2023-07-18 04:24:14 -0400
committerGitHub <noreply@github.com>2023-07-18 04:24:14 -0400
commita3730bd9becd2f1f5d209885b694b0dec178d110 (patch)
tree8ac9948d89606f7519df786f07f6ddb93c3d2720 /modules/hashes.py
parentd6668347c8b85b11b696ac56777cc396e34ee1f9 (diff)
parent871b8687a82bb2ca907d8a49c87aed7635b8fc33 (diff)
Merge branch 'dev' into fix-11805
Diffstat (limited to 'modules/hashes.py')
-rw-r--r--modules/hashes.py33
1 files changed, 3 insertions, 30 deletions
diff --git a/modules/hashes.py b/modules/hashes.py
index 8b7ea0ac..b7a33b42 100644
--- a/modules/hashes.py
+++ b/modules/hashes.py
@@ -1,38 +1,11 @@
import hashlib
-import json
import os.path
-import filelock
-
from modules import shared
-from modules.paths import data_path
-
-
-cache_filename = os.path.join(data_path, "cache.json")
-cache_data = None
-
-
-def dump_cache():
- with filelock.FileLock(f"{cache_filename}.lock"):
- with open(cache_filename, "w", encoding="utf8") as file:
- json.dump(cache_data, file, indent=4)
-
-
-def cache(subsection):
- global cache_data
-
- if cache_data is None:
- with filelock.FileLock(f"{cache_filename}.lock"):
- if not os.path.isfile(cache_filename):
- cache_data = {}
- else:
- with open(cache_filename, "r", encoding="utf8") as file:
- cache_data = json.load(file)
-
- s = cache_data.get(subsection, {})
- cache_data[subsection] = s
+import modules.cache
- return s
+dump_cache = modules.cache.dump_cache
+cache = modules.cache.cache
def calculate_sha256(filename):