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