module documentation

Undocumented

Class AsyncAdaptedLock Undocumented
Class greenlet Undocumented
Function await_fallback Awaits an async function in a sync method.
Function await_only Awaits an async function in a sync method.
Function get_event_loop vendor asyncio.get_event_loop() for python 3.7 and above.
Function getcurrent Undocumented
Async Function greenlet_spawn Runs a sync function ``fn`` in a new greenlet.
Function is_exit_exception Undocumented
Class _AsyncIoGreenlet Undocumented
Function _util_async_run for test suite/ util only
Function _util_async_run_coroutine_function for test suite/ util only
Type Variable _T Undocumented
Variable _has_gr_context Undocumented
def await_fallback(awaitable: Awaitable[_T]) -> _T: (source)

Awaits an async function in a sync method. The sync method must be inside a :func:`greenlet_spawn` context. :func:`await_fallback` calls cannot be nested. :param awaitable: The coroutine to call.

def await_only(awaitable: Awaitable[_T]) -> _T: (source)

Awaits an async function in a sync method. The sync method must be inside a :func:`greenlet_spawn` context. :func:`await_only` calls cannot be nested. :param awaitable: The coroutine to call.

vendor asyncio.get_event_loop() for python 3.7 and above. Python 3.10 deprecates get_event_loop() as a standalone.

def getcurrent() -> greenlet: (source)

Undocumented

async def greenlet_spawn(fn: Callable[..., _T], *args: Any, _require_await: bool = False, **kwargs: Any) -> _T: (source)

Runs a sync function ``fn`` in a new greenlet. The sync function can then use :func:`await_only` to wait for async functions. :param fn: The sync callable to call. :param \*args: Positional arguments to pass to the ``fn`` callable. :param \*\*kwargs: Keyword arguments to pass to the ``fn`` callable.

def is_exit_exception(e: BaseException) -> bool: (source)

Undocumented

def _util_async_run(fn: Callable[..., Coroutine[Any, Any, Any]], *args: Any, **kwargs: Any) -> Any: (source)

for test suite/ util only

def _util_async_run_coroutine_function(fn: Callable[..., Coroutine[Any, Any, Any]], *args: Any, **kwargs: Any) -> Any: (source)

for test suite/ util only

Undocumented

Value
TypeVar('_T')
_has_gr_context = (source)

Undocumented