def sample_args(func: Callable, *args: Callable, **kwargs: Callable):
    '\n    Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``.\n\n    Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value.\n\n    Examples\n    --------\n    >>> from scipy.ndimage import  rotate\n    >>>\n    >>> random_rotate = sample_args(rotate, angle=np.random.normal)\n    >>> random_rotate(x)\n    >>> # same as\n    >>> rotate(x, angle=np.random.normal())\n    '

    def wrapped(*args_, **kwargs_):
        return func(*args_, *[arg() for arg in args], **kwargs_, **{name: arg() for (name, arg) in kwargs.items()})
    return wrapped
Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``.

Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value.

Examples
--------
>>> from scipy.ndimage import  rotate
>>>
>>> random_rotate = sample_args(rotate, angle=np.random.normal)
>>> random_rotate(x)
>>> # same as
>>> rotate(x, angle=np.random.normal())
def sample_args(func: Callable, *args: Callable, **kwargs: Callable):
    '\n    Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``.\n\n    Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value.\n\n    Examples\n    --------\n    >>> from scipy.ndimage import  rotate\n    >>>\n    >>> random_rotate = sample_args(rotate, angle=np.random.normal)\n    >>> random_rotate(x)\n    >>> # same as\n    >>> rotate(x, angle=np.random.normal())\n    '

    def wrapped(*args_, **kwargs_):
        return func(*args_, *[arg() for arg in args], **kwargs_, **{name: arg() for (name, arg) in kwargs.items()})
    return wrapped