Ë
    9*ªb³  ã                   ó0   — d Z ddlZddlmZ  G d„ d«      Zy)z•
    pyudev._os.poll
    ===============

    Operating system interface for pyudev.

    .. moduleauthor:: Sebastian Wiesner  <lunaryorn@gmail.com>
é    N)Úeintr_retry_callc                   óv   — e Zd ZdZej
                  ej                  dœZed„ «       Z	e
d„ «       Zd„ Zd	d„Zd„ Zy)
ÚPollzwA poll object.

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

    )ÚrÚwc                 ó   — | |z  dk7  S )Nr   © )ÚeventsÚevents     ú1/usr/lib/python3/dist-packages/pyudev/_os/poll.pyÚ
_has_eventzPoll._has_event+   s   € à˜‰~ Ñ"Ð"ó    c                 óä   — t        t        j                  «      }|D ]K  \  }}| j                  j	                  |«      }|st        dt        |«      › �«      ‚|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.

        zUnknown event type: )r   ÚselectÚpollÚ_EVENT_TO_MASKÚgetÚ
ValueErrorÚreprÚregister)Úclsr
   ÚnotifierÚfdr   Úmasks         r   Ú
for_eventszPoll.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,   € ô" �D×&Ñ&Ô'7¸¿¹×8KÑ8KÈWÓ'UÓVÓWÐWr   c              #   óâ  K  — |D ]æ  \  }}| j                  |t        j                  «      rt        dt	        |«      › �«      ‚| j                  |t        j
                  «      rt        dt	        |«      › �«      ‚| j                  |t        j                  «      r|df–— | j                  |t        j                  «      r|df–— | j                  |t        j                  «      sŒá|df–— Œè y­w)z˜Parse ``events``.

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

        Yield all parsed events.

        zFile descriptor not open: zError while polling fd: r   r   ÚhN)	r   r   ÚPOLLNVALÚIOErrorr   ÚPOLLERRÚPOLLINÚPOLLOUTÚPOLLHUP)r   r
   r   Ú
event_masks       r   r"   zPoll._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__r   r)   r*   r   Ústaticmethodr   Úclassmethodr   r   r   r"   r	   r   r   r   r   !   sQ   „ ñð "Ÿ=™=¨v¯~©~Ñ>€Nàñ#ó ð#ð ñó ðò""óXó&r   r   )r0   r   Úpyudev._utilr   r   r	   r   r   ú<module>r4      s    ðñ"ó õ *÷Pò Pr   