%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__/_pollingfile.cpython-312.pyc

�

Ϫ�f�!����dZddlmZddlmZmZdZdZGd�d�ZGd�d	�Z	dd
l
Z
dd
lZdd
lZdd
l
Z
ee�Gd�de��Zd
Zee�Gd�de��Zy
)z�
Implements a simple polling interface for file descriptors that don't work with
select() - this is pretty much only useful on Windows.
�)�implementer)�	IConsumer�
IPushProducerg��&�.>g�������?c��eZdZdZd�Zd�Zy)�_PollableResourceTc��d|_y�NT��active��selfs �?/usr/lib/python3/dist-packages/twisted/internet/_pollingfile.py�activatez_PollableResource.activates	�����c��d|_y�NFr
rs r�
deactivatez_PollableResource.deactivates	����rN)�__name__�
__module__�__qualname__rrr�rrrrs��
�F��rrc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�
_PollingTimerc�R�||_g|_d|_t|_d|_yr)�reactor�
_resources�
_pollTimer�MAX_TIMEOUT�_currentTimeout�_paused)r
rs  r�__init__z_PollingTimer.__init__ s&�����������*�����rc�Z�|jj|�|j�y�N)r�append�_checkPollingState)r
�ress  r�_addPollableResourcez"_PollingTimer._addPollableResource's �������s�#����!rc��|jD] }|js�|j�y|j�yr#)rr�
_startPolling�_stopPolling)r
�resources  rr%z _PollingTimer._checkPollingState+s9�����	 �H�����"�"�$��	 �

���rc�H�|j�|j�|_yyr#)r�_reschedulers rr)z_PollingTimer._startPolling3s!���?�?�"�"�.�.�0�D�O�#rc�`�|j�"|jj�d|_yyr#)r�cancelrs rr*z_PollingTimer._stopPolling7s(���?�?�&��O�O�"�"�$�"�D�O�'rc��d|_yr	)r rs r�_pausez_PollingTimer._pause<s	����rc�2�d|_|j�yr)r r%rs r�_unpausez_PollingTimer._unpause?s��������!rc�|�|js0|jj|j|j�Syr#)r r�	callLaterr�
_pollEventrs rr-z_PollingTimer._rescheduleCs/���|�|��<�<�)�)�$�*>�*>����P�P�rc��d}g}|jD]@}|js�||j�z
}|js�0|j|��B|j}|r"|j|dzz}|t
kr%t
}n|jdz}|tkDrt}||_|r|j�|_yy)Ngg�?g@)	rr�	checkWorkr$r�MIN_TIMEOUTrr-r)r
�	workUnits�	anyActiver+�
newTimeouts     rr6z_PollingTimer._pollEventGs����	��	����	/�H�����X�/�/�1�1�	��?�?��$�$�X�.�	/��)�)�
���-�-��S��A�J��K�'�(�
��-�-��3�J��K�'�(�
�)����"�.�.�0�D�O�rN)rrrr!r'r%r)r*r1r3r-r6rrrrrs0���"� �1�#�
�"�Q�1rrNc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�_PollableReadPipec�.�||_||_||_yr#)�pipe�receivedCallback�lostCallback)r
r@rArBs    rr!z_PollableReadPipe.__init__js����	� 0���(��rc��d}g}		tj|jd�\}}}|sn6tj|j|d�\}}|j|��^dj|�}|r|j|�|r|j�t|�S#tj$rd}Y�XwxYw)Nr�r)�	win32pipe�
PeekNamedPiper@�	win32file�ReadFiler$�win32api�error�joinrA�cleanup�len)	r
�finished�fullDataRead�buffer�bytesToRead�result�hr�data�dataBufs	         rr8z_PollableReadPipe.checkWorkps��������	
�.7�.E�.E�d�i�i�QR�.S�+���V�"��$�-�-�d�i�i��d�K���D��#�#�D�)���(�(�<�(����!�!�'�*���L�L�N��7�|����>�>�
����
�s�&B%�5B%�%B=�<B=c�D�|j�|j�yr#)rrBrs rrLz_PollableReadPipe.cleanup�s���������rc�v�	tj|j�y#tj$rYywxYwr#)rI�CloseHandler@�
pywintypesrJrs r�closez_PollableReadPipe.close�s1��	�� � ����+�����	��	�s�"�8�8c�$�|j�yr#)rZrs r�
stopProducingz_PollableReadPipe.stopProducing�s���
�
�rc�$�|j�yr#)rrs r�pauseProducingz _PollableReadPipe.pauseProducing�s�����rc�$�|j�yr#)rrs r�resumeProducingz!_PollableReadPipe.resumeProducing�s���
�
�rN)
rrrr!r8rLrZr\r^r`rrrr>r>hs%��)��.����rr>ic�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�_PollableWritePipec���d|_d|_d|_d|_g|_||_||_	tj|tjdd�y#tj$rYywxYw)NFr)�
disconnecting�producer�producerPaused�streamingProducer�outQueue�	writePiperBrE�SetNamedPipeHandleState�PIPE_NOWAITrYrJ)r
rirBs   rr!z_PollableWritePipe.__init__�ss��"�����
�#���!"�����
�"���(���	��-�-��9�0�0�$��
�����	��	�s�&A�A0�/A0c��d|_yr	)rdrs rrZz_PollableWritePipe.close�s
��!��rc�`�|j�"d|_|jj�yyr	)rerfr^rs r�
bufferFullz_PollableWritePipe.bufferFull�s)���=�=�$�"&�D���M�M�(�(�*�%rc��|j�D|jr|jr,d|j_|jj�yy)NFT)rergrfr`rs r�bufferEmptyz_PollableWritePipe.bufferEmpty�s?���=�=�$��'�'�D�,?�,?�+0�D�M�M�(��M�M�)�)�+��rc���|j�td|�d|j�d���|js|j�y||_||_|s|j�yy)awRegister to receive data from a producer.

        This sets this selectable to be a consumer for a producer.  When this
        selectable runs out of data on a write() call, it will ask the producer
        to resumeProducing(). A producer should implement the IProducer
        interface.

        FileDescriptor provides some infrastructure for producer methods.
        NzCannot register producer z, because producer z was never unregistered.)re�RuntimeErrorrr\rgr`)r
re�	streamings   r�registerProducerz#_PollableWritePipe.registerProducer�sa���=�=�$��#+�T�]�]�<��
��{�{��"�"�$�$�D�M�%.�D�"���(�(�*�rc��d|_y)z;Stop consuming data from a producer, without disconnecting.N)rers r�unregisterProducerz%_PollableWritePipe.unregisterProducer�s	����
rc��|j�	tj|j�|j
�y#tj
$rY�&wxYwr#)rrIrXrirYrJrBrs r�writeConnectionLostz&_PollableWritePipe.writeConnectionLost�sK������	�� � ����0�	
��������	��	�s�A�A�Ac�|�ttt|�vrtd��|jj|�y)z�
        Append a C{list} or C{tuple} of bytes to the output buffer.

        @param seq: C{list} or C{tuple} of C{str} instances to be appended to
            the output buffer.

        @raise TypeError: If C{seq} contains C{unicode}.
        �%Unicode not allowed in output buffer.N)�str�map�type�	TypeErrorrh�extend)r
�seqs  r�
writeSequencez _PollableWritePipe.writeSequence�s0���#�d�C�.� ��C�D�D��
�
���S�!rc��t|t�rtd��|jry|jj|�t
tt|j��tkDr|j�yy)z�
        Append some bytes to the output buffer.

        @param data: C{str} to be appended to the output buffer.
        @type data: C{str}.

        @raise TypeError: If C{data} is C{unicode} instead of C{str}.
        rzN)�
isinstancer{r~rdrhr$�sumr|rM�FULL_BUFFER_SIZErn)r
rTs  r�writez_PollableWritePipe.write�s`���d�C� ��C�D�D������
�
���T�"��s�3��
�
�&�'�*:�:��O�O��;rc���d}|js?|jr|j�y	tj|j
dd�|jr�|jjd�}d}	tj|j
|d�\}}||z
}t|�|kDr"|jjd||d�	|S|jr��|j�}|s|jr|j�|S#tj$r|j�|cYSwxYw#tj$r|j�Y|SwxYw)Nrr)
rhrdrxrG�	WriteFilerirYrJ�poprM�insertrIrp)r
�numBytesWrittenrT�errCode�
nBytesWritten�resumeds      rr8z_PollableWritePipe.checkWorksN�����}�}��!�!��(�(�*��
'��#�#�D�N�N�C��>��m�m��=�=�$�$�Q�'�D��G�

�)2�)<�)<�T�^�^�T�SW�)X�&��� �=�0���t�9�}�,��M�M�(�(��D���,@�A��
��%�m�m��&�&�(�G��t�1�1��(�(�*����+�#�#�
'��(�(�*�&�&�
'���>�>�
��(�(�*����
�s#�!D�8$D9�%D6�5D6�9#E �E N)
rrrr!rZrnrprtrvrxr�r�r8rrrrbrb�s4��� "�+�
�+�.��"��"rrb)�__doc__�zope.interfacer�twisted.internet.interfacesrrr9rrrrYrIrGrEr>r�rbrrr�<module>r�s���
�'�@�������?1�?1�J����
�]��0�)�0��0�f��
�Y��C�*�C��Cr

Zerion Mini Shell 1.0