bridge.utils module#
Cross-cutting utilities.
- async bridge.utils.maybe_await(func, *args, **kwargs)[source]#
Wrap a function/method as an awaitable that may be async or sync, or to return a plain value.
- Parameters:
func (Callable[..., Any] | Any) – A function/method to call, or a plain value.
*args – Positional arguments to pass to the function if func is callable.
**kwargs – Keyword arguments to pass to the function if func is callable.
- Returns:
The result of calling the function, or the plain value.
- Return type:
Any