MCPcopy Index your code
hub / github.com/RustPython/RustPython / shutdown_asyncgens

Method shutdown_asyncgens

Lib/asyncio/base_events.py:570–593  ·  view source on GitHub ↗

Shutdown all active asynchronous generators.

(self)

Source from the content-addressed store, hash-verified

568 self._asyncgens.add(agen)
569
570 async def shutdown_asyncgens(self):
571 """Shutdown all active asynchronous generators."""
572 self._asyncgens_shutdown_called = True
573
574 if not len(self._asyncgens):
575 # If Python version is <3.6 or we don't have any asynchronous
576 # generators alive.
577 return
578
579 closing_agens = list(self._asyncgens)
580 self._asyncgens.clear()
581
582 results = await tasks.gather(
583 *[ag.aclose() for ag in closing_agens],
584 return_exceptions=True)
585
586 for result, agen in zip(results, closing_agens):
587 if isinstance(result, Exception):
588 self.call_exception_handler({
589 'message': f'an error occurred during closing of '
590 f'asynchronous generator {agen!r}',
591 'exception': result,
592 'asyncgen': agen
593 })
594
595 async def shutdown_default_executor(self, timeout=None):
596 """Schedule the shutdown of the default executor.

Callers

nothing calls this directly

Calls 7

lenFunction · 0.85
listClass · 0.85
isinstanceFunction · 0.85
clearMethod · 0.45
gatherMethod · 0.45
acloseMethod · 0.45

Tested by

no test coverage detected