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

Function is_gen_callable

nonebot/utils.py:232–237  ·  view source on GitHub ↗

检查 call 是否是一个生成器函数

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

Source from the content-addressed store, hash-verified

230
231
232def is_gen_callable(call: Callable[..., Any]) -> bool:
233 """检查 call 是否是一个生成器函数"""
234 if inspect.isgeneratorfunction(call):
235 return True
236 func_ = getattr(call, "__call__", None)
237 return inspect.isgeneratorfunction(func_)
238
239
240def is_async_gen_callable(call: Callable[..., Any]) -> bool:

Callers 2

_solveMethod · 0.90
test_is_gen_callableFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_is_gen_callableFunction · 0.72