Passed
Push — main ( 7fd50c...38436d )
by Sat CFDI
02:15
created

satdigitalinvoice.initdb.InitDB.set_cwd()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import os
2
3
import diskcache
4
5
WORKING_DIR = 'working_dir'
6
7
8
class InitDB(diskcache.Cache):
9
    def __init__(self):
10
        super().__init__(directory=os.path.join(os.getcwd(), 'cache'))
11
12
    def set_cwd(self):
13
        cwd = self.get('working_dir', os.getcwd())
14
        os.chdir(cwd)
15
16
    def update_cwd(self, cwd):
17
        self['working_dir'] = cwd
18
        self.set_cwd()