Conditions | 4 |
Total Lines | 19 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
17 | 1 | def __init__(self, locale_var, FILE_NAME, TRANSLATION_DATA): |
|
18 | path_to_locale_dir = os.path.abspath( |
||
19 | os.path.join(os.getcwd(), "./locale/{0}/".format(locale_var[0])) |
||
20 | ) |
||
21 | if os.path.exists(path_to_locale_dir) is False: |
||
22 | os.makedirs(path_to_locale_dir) |
||
23 | 1 | with open( |
|
24 | 1 | "{0}/{1}".format(path_to_locale_dir, FILE_NAME), |
|
25 | 1 | encoding="utf-8", |
|
26 | mode="w", |
||
27 | ) as f: |
||
28 | f.write(TRANSLATION_DATA) |
||
29 | |||
30 | 1 | with open( |
|
31 | "{0}/{1}".format(path_to_locale_dir, FILE_NAME), encoding="utf-8" |
||
32 | 1 | ) as f: |
|
33 | l_strip = f.read() |
||
34 | |||
35 | self.dic = ast.literal_eval(l_strip) |
||
36 | 1 | ||
54 |