(fn, *args, **kwargs)
return fn(*ba.args, **ba.kwargs)
Call function without known all the arguments

    Args:
        fn: function
        args: arguments
        kwargs: key-values
    
    Returns:
        as the fn returns
Call function without known all the arguments
Call function without known all the arguments
def inject_call(fn, *args, **kwargs):
    """
    Call function without known all the arguments

    Args:
        fn: function
        args: arguments
        kwargs: key-values
    
    Returns:
        as the fn returns
    """
    assert callable(fn), "first argument must be callable"

    st = inspect.signature(fn)
    fn_kwargs = {
        key: kwargs[key]
        for key in st.parameters.keys() if key in kwargs
    }
    ba = st.bind(*args, **fn_kwargs)
    ba.apply_defaults()
    return fn(*ba.args, **ba.kwargs)
def inject_call ( fn , * args , * * kwargs ) : assert callable ( fn ) , "first argument must be callable" st = inspect . signature ( fn ) fn_kwargs = { key : kwargs [ key ] for key in st . parameters . keys ( ) if key in kwargs } ba = st . bind ( * args , * * fn_kwargs ) ba . apply_defaults ( ) return fn ( * ba . args , * * ba . kwargs )