| Conditions | 3 |
| Total Lines | 11 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 7 | def unflatten(d, separator='_'): |
||
| 8 | new_dict = d.copy() |
||
| 9 | new_dict.clear() |
||
| 10 | keys = list(d.keys()) |
||
| 11 | for key in keys: |
||
| 12 | value = d.get(key, None) |
||
| 13 | new_value = unflatten( |
||
| 14 | value, separator=separator) if type_util.is_dict(value) else value |
||
| 15 | new_keys = key.split(separator) |
||
| 16 | keylist_util.set_item(new_dict, new_keys, new_value) |
||
| 17 | return new_dict |
||
| 18 |