MCPcopy
hub / github.com/AstrBotDevs/AstrBot / run_maybe_async

Function run_maybe_async

astrbot/dashboard/async_utils.py:16–20  ·  view source on GitHub ↗
(
    operation: Callable[[], T | Awaitable[T]] | T | Awaitable[T],
)

Source from the content-addressed store, hash-verified

14
15
16async def run_maybe_async(
17 operation: Callable[[], T | Awaitable[T]] | T | Awaitable[T],
18) -> T:
19 result: Any = operation() if callable(operation) else operation
20 return await resolve_maybe_awaitable(result)

Callers 15

_reload_providersMethod · 0.90
_runFunction · 0.90
_runFunction · 0.90
_runFunction · 0.90
_run_fileFunction · 0.90
_runFunction · 0.90
_runFunction · 0.90
_runFunction · 0.90
_runFunction · 0.90
_runFunction · 0.90

Calls 2

operationFunction · 0.85
resolve_maybe_awaitableFunction · 0.85

Tested by

no test coverage detected