%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pyudev/_os/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pyudev/_os/__pycache__/poll.cpython-312.pyc

�

9*�b���0�dZddlZddlmZGd�d�Zy)z�
    pyudev._os.poll
    ===============

    Operating system interface for pyudev.

    .. moduleauthor:: Sebastian Wiesner  <lunaryorn@gmail.com>
�N)�eintr_retry_callc�v�eZdZdZej
ejd�Zed��Z	e
d��Zd�Zd	d�Z
d�Zy)
�PollzwA poll object.

    This object essentially provides a more convenient interface around
    :class:`select.poll`.

    )�r�wc��||zdk7S)Nr�)�events�events  �1/usr/lib/python3/dist-packages/pyudev/_os/poll.py�
_has_eventzPoll._has_event+s����~��"�"�c���ttj�}|D]K\}}|jj	|�}|stdt
|�����|j||��M||�S)aGListen 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�}�rc��||_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)�selfrs  r�__init__z
Poll.__init__As��"��rNc�r�t|jt|jj|���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_eventsrrr)r�timeouts  rrz	Poll.pollJs,��"�D�&�&�'7����8K�8K�W�'U�V�W�Wrc#��K�|D]�\}}|j|tj�rtdt	|�����|j|tj
�rtdt	|�����|j|tj�r|df��|j|tj�r|df��|j|tj�s��|df����y�w)z�Parse ``events``.

        ``events`` is a list of events as returned by
        :meth:`select.poll.poll()`.

        Yield all parsed events.

        zFile descriptor not open: zError while polling fd: rr�hN)	r
r�POLLNVAL�IOErrorr�POLLERR�POLLIN�POLLOUT�POLLHUP)rr
r�
event_masks    rr"zPoll._parse_events]s�����%�	�N�B�
����z�6�?�?�;�� :�4��8�*�E�F�F����z�6�>�>�:�� 8��b��
�C�D�D����z�6�=�=�9��#�g�
����z�6�>�>�:��#�g�
����z�6�>�>�:��#�g�
�	�s�C#C/�&	C/)N)�__name__�
__module__�__qualname__�__doc__rr)r*r�staticmethodr
�classmethodrrrr"r	rrrr!sQ���"�=�=�v�~�~�>�N��#��#�����""�X�&rr)r0r�pyudev._utilrrr	rr�<module>r4s ��"��*�P�Pr

Zerion Mini Shell 1.0