aboutsummaryrefslogtreecommitdiff
path: root/modules/hashes.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-18 18:20:22 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-07-18 18:20:22 +0300
commiteb7c9b58fc2fbab205d4bc9f708800870dcda3fb (patch)
tree337bc9e4e6793aa072c2e2a8c10e3a3f7daf6a95 /modules/hashes.py
parentf865d3e11647dfd6c7b2cdf90dde24680e58acd8 (diff)
parent7f7db1700bda40ba3171a49b6a4ef38f868b7d0a (diff)
Merge branch 'dev' into release_candidate
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):