Async Helpers#

Tools to help with async.

async wrap_sync_function_in_async(func, *args, **kwargs)[source]#

Utility function, that wraps both functions and coroutines in coroutines. Invokes func if it is just a callable and awaits, if it is a coroutine.

Parameters:
  • func (Callable) – Callable to wrap.

  • *args – Function args.

  • **kwargs – Function kwargs.

Return type:

Any

Returns:

What function returns.