Total Complexity | 3 |
Total Lines | 13 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from benedict.core import clone |
||
2 | from benedict.utils import type_util |
||
3 | |||
4 | |||
5 | def subset(d, keys, *args): |
||
6 | new_dict = clone(d, empty=True) |
||
7 | if type_util.is_string(keys): |
||
8 | keys = [keys] |
||
9 | keys += args |
||
10 | for key in keys: |
||
11 | new_dict[key] = d.get(key, None) |
||
12 | return new_dict |
||
13 |