pywry.utils¶
Utility functions for async operations.
pywry.utils.async_helpers.run_async
¶
Run an async function synchronously.
Create a new event loop, run the coroutine, and close the loop.
| PARAMETER | DESCRIPTION |
|---|---|
func
|
The async function to wrap.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable
|
A synchronous wrapper function. |
pywry.utils.async_helpers.async_task
¶
Mark a function as an async task.
A simple passthrough wrapper for async functions.
| PARAMETER | DESCRIPTION |
|---|---|
func
|
The async function to wrap.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable
|
The wrapped async function. |
pywry.utils.async_helpers.run_in_thread
¶
Run a function in a new thread.
| PARAMETER | DESCRIPTION |
|---|---|
func
|
The function to run in a thread.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable
|
A wrapper that starts the function in a new thread and returns the thread object. |