Conditions | 6 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6.027 |
1 | """Configuration module.""" |
||
12 | 1 | def __init__(self, data=None): |
|
13 | 1 | if not hasattr(self, 'config_path_variable') or \ |
|
14 | not hasattr(self, 'parse_config'): |
||
15 | 1 | raise NotImplementedError('Config class does not implement all ' |
|
16 | 'required attributes.') |
||
17 | 1 | self.debug = True |
|
18 | 1 | if not data: |
|
19 | 1 | try: |
|
20 | 1 | with open(self.get_config_path()) as fd: |
|
21 | 1 | data = json.load(fd) |
|
22 | 1 | except ValueError as exc: |
|
23 | raise InvalidConfig(*exc.args) |
||
24 | 1 | self.parse_config(data) |
|
25 | |||
35 |