nat.utils.callable_utils#

Functions#

ainvoke_any(→ Any)

Execute any type of callable and return the result.

is_async_callable(→ bool)

Check if a function is async (coroutine function or async generator function).

Module Contents#

async ainvoke_any(
func: collections.abc.Callable[Ellipsis, Any],
*args: Any,
**kwargs: Any,
) Any#

Execute any type of callable and return the result.

Handles synchronous functions, asynchronous functions, generators, and async generators uniformly, returning the final result value.

Args:

func (Callable[…, Any]): The function to execute (sync/async function, generator, etc.)

Returns:

Any: The result of executing the callable

is_async_callable(
func: collections.abc.Callable[Ellipsis, Any],
) bool#

Check if a function is async (coroutine function or async generator function).

Args:

func (Callable[…, Any]): The function to check

Returns:

bool: True if the function is async, False otherwise