检查 call 是否是一个 callable 协程函数
(call: Callable[..., Any])
| 220 | |
| 221 | |
| 222 | def 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 | |
| 232 | def is_gen_callable(call: Callable[..., Any]) -> bool: |
no outgoing calls