Total Complexity | 1 |
Total Lines | 13 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from obdlib.obd.pids import * |
||
18 | class DictModes(dict): |
||
19 | pids = None |
||
20 | |||
21 | def __getitem__(self, key): |
||
22 | """ |
||
23 | Override the base getitem method, |
||
24 | because we need to set a mode before |
||
25 | retrieves value of dict |
||
26 | """ |
||
27 | # sets current mode |
||
28 | DictModes.pids.set_mode(key) |
||
29 | val = dict.__getitem__(self, key) |
||
30 | return val |
||
31 | |||
53 | self.modes = DictModes(pre_dict) |