MCPcopy
hub / github.com/nonebot/nonebot2 / is_coroutine_callable

Function is_coroutine_callable

nonebot/utils.py:222–229  ·  view source on GitHub ↗

检查 call 是否是一个 callable 协程函数

(call: Callable[..., Any])

Source from the content-addressed store, hash-verified

220
221
222def is_coroutine_callable(call: Callable[..., Any]) -> bool:
223 """检查 call 是否是一个 callable 协程函数"""
224 if inspect.isroutine(call):
225 return inspect.iscoroutinefunction(call)
226 if inspect.isclass(call):
227 return False
228 func_ = getattr(call, "__call__", None)
229 return inspect.iscoroutinefunction(func_)
230
231
232def is_gen_callable(call: Callable[..., Any]) -> bool:

Callers 4

_solveMethod · 0.90
_run_lifespan_funcMethod · 0.90
__call__Method · 0.90

Calls

no outgoing calls

Tested by 1