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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
The async function to wrap. |
required |
Returns:
| Type | 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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
The async function to wrap. |
required |
Returns:
| Type | Description |
|---|---|
Callable
|
The wrapped async function. |
pywry.utils.async_helpers.run_in_thread
¶
Run a function in a new thread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
The function to run in a thread. |
required |
Returns:
| Type | Description |
|---|---|
Callable
|
A wrapper that starts the function in a new thread and returns the thread object. |