Alex | 3bc95f6 | 2020-03-05 17:00:04 -0600 | [diff] [blame] | 1 | from cfg_checker.common.log import logger, logger_cli |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 2 | |
Alex | 3bc95f6 | 2020-03-05 17:00:04 -0600 | [diff] [blame] | 3 | from cfg_checker.common.other import Utils |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 4 | |
| 5 | |
Alex | 74dc135 | 2019-05-17 13:18:24 -0500 | [diff] [blame] | 6 | def nested_set(_d, _keys, _value): |
| 7 | # # import and deepcopy for safety |
| 8 | # from copy import deepcopy |
| 9 | # _d = deepcopy(_dict) |
| 10 | # process |
| 11 | for k in _keys[:-1]: |
| 12 | _d = _d.setdefault(k, {}) |
| 13 | _d[_keys[-1]] = _value |
| 14 | |
| 15 | |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 16 | utils = Utils() |
Alex Savatieiev | 5118de0 | 2019-02-20 15:50:42 -0600 | [diff] [blame] | 17 | logger = logger |
| 18 | logger_cli = logger_cli |