Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_signals.py30 linesDownload Raw Back to _core
1from __future__ import annotations2 3from collections.abc import AsyncIterator4from contextlib import AbstractContextManager5from signal import Signals6 7from ._eventloop import get_async_backend8 9 10def open_signal_receiver(11    *signals: Signals,12) -> AbstractContextManager[AsyncIterator[Signals]]:13    """14    Start receiving operating system signals.15 16    :param signals: signals to receive (e.g. ``signal.SIGINT``)17    :return: an asynchronous context manager for an asynchronous iterator which yields18        signal numbers19    :raises NoEventLoopError: if no supported asynchronous event loop is running in the20        current thread21 22    .. warning:: Windows does not support signals natively so it is best to avoid23        relying on this in cross-platform applications.24 25    .. warning:: On asyncio, this permanently replaces any previous signal handler for26        the given signals, as set via :meth:`~asyncio.loop.add_signal_handler`.27 28    """29    return get_async_backend().open_signal_receiver(*signals)30 
codekingpro/portable-devtools · Team Ai