-
Notifications
You must be signed in to change notification settings - Fork 0
/
declaration.py
51 lines (43 loc) · 1.35 KB
/
declaration.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
import re
from functools import wraps
from core import Factory,ConfigAdvanced
import logging
class VNode:
def __init__(self):
self.path = ''
self.name = ''
self.value = 0
self.other = {}
def build(self,data:object):
dtype = type(data)
if dtype is list:
return self.__buildList(data)
elif dtype is str:
return self.__buildString(data)
return None
def __buildList(self,data:list):
self.value = data[1]
self.path = data[0]
self.name = re.split(r' |/|\\',self.path)[-1:]
self.name = self.name[0]
self.other = data[2:]
return self
def __buildString(self,data:str):
self.value = data.split(';')[1]
self.path = data.split(';')[0]
self.name = re.split(r' |/|\\',self.path)[-1:]
self.name = self.name[0]
return self
cache=[
{'name': 'TagManager','method':'load_tags','store': None},
{'name': 'IndexManager','method':'load_files','store': None},
{'name': 'TagManager','method':'load_tags','store': None}
]
def invalidate(func):
@wraps(func)
def execute_and_invalidate(*args, **kwargs):
func(*args, **kwargs)
logging.info(func.__name__ + " has triggered validation !")
return execute_and_invalidate
factory = Factory()
config = ConfigAdvanced()