+
    Dfjb                        a  R t0 t R t^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ]! 4       t. t] ^ k ]! ]4       ! R R4      4       tR	# )
z%
Helpers for working with producers.
)List)implementer)IPushProducer)	cooperate)Loggerc                   R   a  ] tR t^t o RtRtR tR tR tR t	R t
R tR	 tR
tV tR# )_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                    Wn         W n        R # )N)	_producer	_consumer)selfpullProducerconsumers   &&&D/usr/lib/python3/dist-packages/twisted/internet/_producer_helpers.py__init___PullToPush.__init__3   s    %!    c              #    "    \         P                  RV P                  R7      ;_uu_ 4       pV P                  P                  4        RRR4       XP                  '       dh   \         P                  RV P
                  R7      ;_uu_ 4       pV P
                  P                  4        RRR4       XP                  '       d
   RV n        R# Rx  K    + '       g   i     L; i  + '       g   i     LD; i5i)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.
Tz+while calling resumeProducing on {producer})producerNz.while calling unregisterProducer on {consumer})r   )_logfailuresHandledr
   resumeProducingfailedr   unregisterProducer	_finished)r   op
handlingops   &  r   _pull_PullToPush._pull7   s      %%= &  ..0 yyy))D!^^ *    NN557	
 $$$ &*DNJ 
 s@   +C5CC5")C5C"&C5 C5C	C5"C2	-C5c                B    \        V P                  4       4      V n        R# )zo
This should be called by the consumer when the producer is registered.

Start streaming data to the consumer.
N)r   r   	_coopTaskr   s   &r   startStreaming_PullToPush.startStreamingQ   s     #4::<0r   c                p    V P                   '       d   R# RV n         V P                  P                  4        R# )zp
This should be called by the consumer when the producer is
unregistered.

Stop streaming data to the consumer.
NT)r   r    stopr!   s   &r   stopStreaming_PullToPush.stopStreamingY   s'     >>>r   c                :    V P                   P                  4        R# )z'
@see: C{IPushProducer.pauseProducing}
N)r    pauser!   s   &r   pauseProducing_PullToPush.pauseProducinge   s     	r   c                :    V P                   P                  4        R# )z(
@see: C{IPushProducer.resumeProducing}
N)r    resumer!   s   &r   r   _PullToPush.resumeProducingk   s     	r   c                Z    V P                  4        V P                  P                  4        R# )z&
@see: C{IPushProducer.stopProducing}
N)r&   r
   stopProducingr!   s   &r   r0   _PullToPush.stopProducingq   s      	$$&r   )r   r    r   r
   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r"   r&   r*   r   r0   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s9     0 I"41
 ' 'r   r   c                V    V ^8  d   Qh/ ^ \         9   d   \        \        ,          ;R&   # )   __all__)__conditional_annotations__r   str)formats   "r   __annotate__r@      s"        c r   N)r=   r6   typingr   zope.interfacer   twisted.internet.interfacesr   twisted.internet.taskr   twisted.loggerr   r   r<   r   r@   )r=   s   @r   <module>rF      sN   
  & 5 + !x   ]^' ^' ^'r   