Total Complexity | 3 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import os |
||
2 | |||
3 | import diskcache |
||
4 | |||
5 | WORKING_DIR = 'working_dir' |
||
6 | |||
7 | |||
8 | class InitDB(diskcache.Cache): |
||
9 | def __init__(self, base_path: str): |
||
10 | super().__init__(directory=os.path.join(base_path, 'init')) |
||
11 | self.base_path = base_path |
||
12 | |||
13 | def set_cwd(self): |
||
14 | cwd = self.get('working_dir', os.getcwd()) |
||
15 | os.chdir(cwd) |
||
16 | |||
17 | def update_cwd(self, cwd): |
||
18 | self['working_dir'] = cwd |
||
19 | self.set_cwd() |
||
20 |