%PDF- %PDF-
Direktori : /lib/python3/dist-packages/pyudev/_os/__pycache__/ |
Current File : //lib/python3/dist-packages/pyudev/_os/__pycache__/poll.cpython-312.pyc |
� 9*�b� � �0 � d Z ddlZddlmZ G d� d� Zy)z� pyudev._os.poll =============== Operating system interface for pyudev. .. moduleauthor:: Sebastian Wiesner <lunaryorn@gmail.com> � N)�eintr_retry_callc �v � e Zd ZdZej ej d�Zed� � Z e d� � Zd� Zd d�Z d� Zy) �PollzwA poll object. This object essentially provides a more convenient interface around :class:`select.poll`. )�r�wc � � | |z dk7 S )Nr � )�events�events �1/usr/lib/python3/dist-packages/pyudev/_os/poll.py� _has_eventzPoll._has_event+ s � ���~��"�"� c �� � t t j � }|D ]K \ }}| j j |� }|st dt |� � �� �|j ||� �M | |� S )aG Listen for ``events``. ``events`` is a list of ``(fd, event)`` pairs, where ``fd`` is a file descriptor or file object and ``event`` either ``'r'`` or ``'w'``. If ``r``, listen for whether that is ready to be read. If ``w``, listen for whether the channel is ready to be written to. zUnknown event type: )r �select�poll�_EVENT_TO_MASK�get� ValueError�repr�register)�clsr �notifier�fdr �masks r � for_eventszPoll.for_events/ sq � � $�F�K�K�0��� (�I�B���%�%�)�)�%�0�D�� �#7��U��}�!E�F�F����b�$�'� (� �8�}�r c � � || _ y)z�Create a poll object for the given ``notifier``. ``notifier`` is the :class:`select.poll` object wrapped by the new poll object. N)� _notifier)�selfr s r �__init__z Poll.__init__A s � � "��r Nc �r � t | j t | j j |� � � S )a{ Poll for events. ``timeout`` is an integer specifying how long to wait for events (in milliseconds). If omitted, ``None`` or negative, wait until an event occurs. Return a list of all events that occurred before ``timeout``, where each event is a pair ``(fd, event)``. ``fd`` is the integral file descriptor, and ``event`` a string indicating the event type. If ``'r'``, there is data to read from ``fd``. If ``'w'``, ``fd`` is writable without blocking now. If ``'h'``, the file descriptor was hung up (i.e. the remote side of a pipe was closed). )�list� _parse_eventsr r r )r �timeouts r r z Poll.pollJ s, � �"