Conditions | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """Filters for working with data structures, munging, etc...""" |
||
23 | def filter_keys(obj, keys): |
||
24 | """Filter a dictionary by keys. |
||
25 | |||
26 | Args: |
||
27 | string (dict): The dictionary to filter. |
||
28 | |||
29 | Returns: |
||
30 | string (dict): The filtered dict. |
||
31 | """ |
||
32 | if obj is None or not isinstance(keys, list): |
||
33 | return obj |
||
34 | newdict = {} |
||
35 | for k, v in obj.items(): |
||
36 | if k in keys: |
||
37 | continue |
||
38 | newdict[k] = v |
||
39 | return newdict |
||
40 |