asyncify(
function: Callable[T_ParamSpec, T_Retval]
) -> Callable[T_ParamSpec, AwaitableTake a blocking function and create an async one that receives the same positional and keyword arguments.
Usage:
def blocking_func(arg1, arg2, kwarg1=None):
# blocking code
return result
result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
function: a blocking regular callable (e.g. a function)
An async function that takes the same positional and keyword arguments as the original one, that when called runs the same original function in a thread worker and returns the result.