-
Notifications
You must be signed in to change notification settings - Fork 5
/
cache.py
57 lines (51 loc) · 1.56 KB
/
cache.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from config import multiply_difficulty
from config import context_all
cache_all_files = []
def cacheCreate(name):
cache_all_files.append({'cache': [], 'name': name, 'multiplier': multiply_difficulty})
def multiplierLess(name):
for i in cache_all_files:
if i['name'] == name:
i['multiplier'] -= 10
def multiplierReset(name):
for i in cache_all_files:
if i['name'] == name:
i['multiplier'] = multiply_difficulty
def getMulyiplier(name):
for i in cache_all_files:
if i['name'] == name:
return i['multiplier']
return 0
def listCache():
for i in cache_all_files:
print('\n'+'\033[92m'+i['name']+'\033[0m')
for j in i['cache']:
print(j)
def getCache(name):
for i in cache_all_files:
if i['name'] == name:
return i['cache']
return None
def cacheAdd(name,cache):
for i in cache_all_files:
if i['name'] == name:
i['cache'].append(cache)
def cacheExists(name):
for i in cache_all_files:
if i['name'] == name:
return True
return False
def emptyCache():
cache_all_files = []
def globalContextGet():
return context_all
def globalContextSet(value):
context_all = value
#return true if exist in cache, family with model equals a model_name
def existsInFamily(model_name, family):
model_name = str(model_name)
for cache in cache_all_files:
for i in cache['cache']:
if i['model'] == model_name and i['family'] == family:
return cache['name']
return False