INNER CODE UNIT · Python

_convert_args_kwargs

python-cachier/cachier · src/cachier/core.py:151

def _convert_args_kwargs(func, _is_method: bool, args: tuple, kwds: dict) -> dict:
    """Convert mix of positional and keyword arguments to aggregated kwargs."""
    # unwrap if the function is functools.partial
    if hasattr(func, "func"):
        args = func.args + args
        kwds.update({k: v for k, v in func.keywords.items() if k not in kwds})
        func = func.func

    sig = inspect.signature(func)
    func_params = list(sig.parameters)

    # Separate regular parameters from VAR_POSITIONAL
    regular_params = []
    var_positional_name = None

    for param_name in func_params:
        param = sig.parameters[param_name]
        if param.kind == inspect.Parameter.VAR_POSITIONAL:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…