Skip to content

Callers

method_caller = standard_method_caller module-attribute

An alias of the standard method_caller type that implements method calling.

Caller

Represents function callers.

Source code in src/funcs/callers.py
20
21
22
23
24
25
26
27
28
29
@final
@frozen()
class Caller:
    """Represents function callers."""

    args: DynamicTuple[Any]
    kwargs: StringDict[Any]

    def __call__(self, function: DynamicCallable[R]) -> R:
        return function(*self.args, **self.kwargs)

caller(*args: Any, **kwargs: Any) -> Caller

Creates a Caller that calls the given function with *args and **kwargs.

Parameters:

Name Type Description Default
*args Any

The arguments to use.

()
**kwargs Any

The keyword arguments to use.

{}

Returns:

Type Description
Caller

The Caller created.

Source code in src/funcs/callers.py
32
33
34
35
36
37
38
39
40
41
42
43
def caller(*args: Any, **kwargs: Any) -> Caller:
    """Creates a [`Caller`][funcs.callers.Caller] that calls the given
    `function` with `*args` and `**kwargs`.

    Arguments:
        *args: The arguments to use.
        **kwargs: The keyword arguments to use.

    Returns:
        The [`Caller`][funcs.callers.Caller] created.
    """
    return Caller(args, kwargs)