Return True if func is a coroutine function (a function defined with async def syntax, and doesn't contain yield), or a function decorated with @asyncio.coroutine. Note: copied and modified from Python 3.5's builtin coroutines.py to avoid importing asyncio directly, which in turns a
(func: object)
| 48 | |
| 49 | |
| 50 | def iscoroutinefunction(func: object) -> bool: |
| 51 | """Return True if func is a coroutine function (a function defined with async |
| 52 | def syntax, and doesn't contain yield), or a function decorated with |
| 53 | @asyncio.coroutine. |
| 54 | |
| 55 | Note: copied and modified from Python 3.5's builtin coroutines.py to avoid |
| 56 | importing asyncio directly, which in turns also initializes the "logging" |
| 57 | module as a side-effect (see issue #8). |
| 58 | """ |
| 59 | return inspect.iscoroutinefunction(func) or getattr(func, "_is_coroutine", False) |
| 60 | |
| 61 | |
| 62 | def is_async_function(func: object) -> bool: |