%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/pollreactor.cpython-312.pyc

�

Ϫ�fV����dZddlZddlmZmZmZmZmZmZ	m
Z
ddlmZddl
mZddlmZddlmZee�Gd�d	ej&ej(��Zd
�Zd	dgZy)z�
A poll() based implementation of the twisted main loop.

To install the event loop (and you should do this before any connections,
listeners or connectors are added)::

    from twisted.internet import pollreactor
    pollreactor.install()
�N)�POLLERR�POLLHUP�POLLIN�POLLNVAL�POLLOUT�error�poll)�implementer)�	posixbase)�
IReactorFDSet)�logc�n�eZdZdZeezezZeZ	e
Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd	�Zd
�ZeZd�Zd�Zy
)�PollReactora^
    A reactor that uses poll(2).

    @ivar _poller: A L{select.poll} which will be used to check for I/O
        readiness.

    @ivar _selectables: A dictionary mapping integer file descriptors to
        instances of L{FileDescriptor} which have been registered with the
        reactor.  All L{FileDescriptor}s which are currently receiving read or
        write readiness notifications will be present as values in this
        dictionary.

    @ivar _reads: A dictionary mapping integer file descriptors to arbitrary
        values (this is essentially a set).  Keys in this dictionary will be
        registered with C{_poller} for read readiness notifications which will
        be dispatched to the corresponding L{FileDescriptor} instances in
        C{_selectables}.

    @ivar _writes: A dictionary mapping integer file descriptors to arbitrary
        values (this is essentially a set).  Keys in this dictionary will be
        registered with C{_poller} for write readiness notifications which will
        be dispatched to the corresponding L{FileDescriptor} instances in
        C{_selectables}.
    c��t�|_i|_i|_i|_t
jj|�y)zo
        Initialize polling object, file descriptor tracking dictionaries, and
        the base class.
        N)r	�_poller�_selectables�_reads�_writesr�PosixReactorBase�__init__)�selfs �>/usr/lib/python3/dist-packages/twisted/internet/pollreactor.pyrzPollReactor.__init__Cs7��
�v�������������"�"�+�+�D�1�c�6�	|jj|�d}||jvr	|tz}||j
vr	|tz}|dk7r|jj||�y||jvr|j|=yy#t$rY�zwxYw)z*Register/unregister an fd with the poller.rN)	r�
unregister�KeyErrorrrrr�registerr)r�fd�masks   r�_updateRegistrationzPollReactor._updateRegistrationNs���	��L�L�#�#�B�'���
������&�=�D�
������'�>�D��1�9��L�L�!�!�"�d�+��T�&�&�&��%�%�b�)�'���	��	�s�B�	B�Bc���	|j�}||||vr||=|j	|�yy#t$r-|jj�D]\}}||us�nYyY�OwxYw�N)�fileno�
BaseExceptionr�itemsr )r�
selectable�mdictr�fdess     r�_dictRemovezPollReactor._dictRemove`s���	��"�"�$�B�
�"�I���;��b�	��$�$�R�(����		�!�-�-�3�3�5�
���D���%��
��	�		�s�1�-A'�A'�&A'c��|j�}||jvr0||j|<d|j|<|j|�yy)z@Add a FileDescriptor for notification of data available to read.�N)r#rrr )r�readerrs   r�	addReaderzPollReactor.addReaderusI��
�]�]�_��
�T�[�[� �$*�D���b�!��D�K�K��O��$�$�R�(�!rc��|j�}||jvr0||j|<d|j|<|j|�yy)zAAdd a FileDescriptor for notification of data available to write.r+N)r#rrr )r�writerrs   r�	addWriterzPollReactor.addWriter}sJ��
�]�]�_��
�T�\�\�!�$*�D���b�!� �D�L�L����$�$�R�(�"rc�:�|j||j�S)z?Remove a Selectable for notification of data available to read.)r)r)rr,s  r�removeReaderzPollReactor.removeReader�s���������4�4rc�:�|j||j�S)z@Remove a Selectable for notification of data available to write.)r)r)rr/s  r�removeWriterzPollReactor.removeWriter�s���������5�5rc���|j|jD�cgc]}|j|��c}|jD�cgc]}|j|��c}�Scc}wcc}w)zD
        Remove all selectables, and return a list of them.
        )�
_removeAllrrr�rrs  r�	removeAllzPollReactor.removeAll�sU�����-1�[�[�9�r�T�
�
�r�
"�9�-1�\�\�:�r�T�
�
�r�
"�:�
�	
��9��:s�A�A"
c�f�|�t|dz�}	|jj|�}|j}|D].\}}	|j|}tj|||||��0y#t$r+}|jdt
jk(rYd}~y�d}~wwxYw#t$rY�twxYw)zPoll the poller for new events.Ni�r)�intrr	�SelectError�args�errno�EINTR�_doReadOrWriterrr
�callWithLogger)r�timeout�l�e�_drdwr�eventr&s        r�doPollzPollReactor.doPoll�s������'�D�.�)�G�	����!�!�'�*�A��#�#���	I�I�B��
�!�.�.�r�2�
�

���z�5�*�b�%�H�	I��
�	��v�v�a�y�E�K�K�'����		���
��
�s/�A-�B$�-	B!�6 B�B�B!�$	B0�/B0c�Z�|jD�cgc]}|j|��c}Scc}wr")rrr7s  r�
getReaderszPollReactor.getReaders�s%��04���<�"��!�!�"�%�<�<��<��(c�Z�|jD�cgc]}|j|��c}Scc}wr")rrr7s  r�
getWriterszPollReactor.getWriters�s%��04���=�"��!�!�"�%�=�=��=rIN)�__name__�
__module__�__qualname__�__doc__rrr�_POLL_DISCONNECTEDr�_POLL_INr�	_POLL_OUTrr r)r-r0r2r4r8rF�doIterationrHrK�rrrr$sb���2!�7�*�X�5���H��I�	2�*�$)�*)�)�5�6�
�I�,�K�=�>rrc�4�t�}ddlm}||�y)zInstall the poll() reactor.r)�installReactorN)r�twisted.internet.mainrV)�prVs  r�installrY�s���
�A�4��1�rrY)rOr=�selectrrrrrrr;r	�zope.interfacer
�twisted.internetr�twisted.internet.interfacesr�twisted.pythonr
r�_PollLikeMixinrrY�__all__rTrr�<module>rasq���
����'�&�5��
�]��M>�)�,�,�i�.F�.F�M>��M>�`��)�
$�r

Zerion Mini Shell 1.0