pynenc.util.asyncio_helper¶
Module Contents¶
Functions¶
Run a task synchronously and return its result. |
|
Run a task asynchronously and return its result. |
API¶
- pynenc.util.asyncio_helper.run_task_sync(func: Callable[pynenc.types.Params, pynenc.types.Result], *args: pynenc.types.Params.args, **kwargs: pynenc.types.Params.kwargs) pynenc.types.Result[source]¶
Run a task synchronously and return its result.
If the function is asynchronous, a new event loop is created and run to completion. This function must not be called from within an active event loop.
- async pynenc.util.asyncio_helper.run_task_async(func: Callable[pynenc.types.Params, pynenc.types.Result], *args: pynenc.types.Params.args, **kwargs: pynenc.types.Params.kwargs) pynenc.types.Result[source]¶
Run a task asynchronously and return its result.
If the function is asynchronous, it is awaited. If it is synchronous, it is called directly.