File: filter.py

package info (click to toggle)
python-chocolate 0.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 100 kB
  • sloc: python: 29; makefile: 3
file content (10 lines) | stat: -rw-r--r-- 296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
import inspect


def _get_subdict(original_dict, subdict_keys):
    return {k:v for k,v in original_dict.items() if k in subdict_keys}

def filter_args(all_kwargs, func):
    args = inspect.getfullargspec(func).args
    filtered_kwargs = _get_subdict(all_kwargs, args)
    return filtered_kwargs