MCPcopy Create free account
hub / github.com/pytest-dev/pytest / iscoroutinefunction

Function iscoroutinefunction

src/_pytest/compat.py:68–77  ·  view source on GitHub ↗

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 couroutines.py to avoid importing asyncio directly, which in turns

(func: object)

Source from the content-addressed store, hash-verified

66
67
68def iscoroutinefunction(func: object) -> bool:
69 """Return True if func is a coroutine function (a function defined with async
70 def syntax, and doesn't contain yield), or a function decorated with
71 @asyncio.coroutine.
72
73 Note: copied and modified from Python 3.5's builtin couroutines.py to avoid
74 importing asyncio directly, which in turns also initializes the "logging"
75 module as a side-effect (see issue #8).
76 """
77 return inspect.iscoroutinefunction(func) or getattr(func, "_is_coroutine", False)
78
79
80def is_async_function(func: object) -> bool:

Callers 2

is_generatorFunction · 0.85
is_async_functionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected