def _call_with_selection(func):
wrapped_kwonly_params = [<EOL>param for param in inspect.signature(func).parameters.values()<EOL>if param.kind == param.KEYWORD_ONLY]<EOL>sel_sig = inspect.signature(Selection)<EOL>default_sel_sig = sel_sig.replace(<EOL>parameters=[param.replace(default=None) if param.default is param.empty<EOL>else param<EOL>for param in sel_sig.parameters.values()])<EOL>@functools.wraps(func)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>extra_kw = {param.name: kwargs.pop(param.name)<EOL>for param in wrapped_kwonly_params if param.name in kwargs}<EOL>ba = default_sel_sig.bind(*args, **kwargs)<EOL>ba.arguments = ChainMap(<EOL>ba.arguments,<EOL>{name: param.default<EOL>for name, param in default_sel_sig.parameters.items()<EOL>if param.default is not param.empty})<EOL>sel = Selection(*ba.args, **ba.kwargs)<EOL>return func(sel, **extra_kw)<EOL><DEDENT>wrapper.__signature__ = Signature(<EOL>list(sel_sig.parameters.values()) + wrapped_kwonly_params)<EOL>return wrapper<EOL>
Decorator that passes a `Selection` built from the non-kwonly args.