ó
    Ö›‘hb  ã                   ó’   • % S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  \
" 5       r/ r\\   \S'   \" \5       " S S	5      5       rg
)z%
Helpers for working with producers.
é    )ÚList)Úimplementer)ÚIPushProducer)Ú	cooperate)ÚLoggerÚ__all__c                   óF   • \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rSrg)Ú_PullToPushé   a™  
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                 ó   • Xl         X l        g )N)Ú	_producerÚ	_consumer)ÚselfÚpullProducerÚconsumers      ÚfC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/internet/_producer_helpers.pyÚ__init__Ú_PullToPush.__init__3   s   € Ø%ŒØ!�ó    c              #   ó´  #   •  [         R                  SU R                  S9 nU R                  R                  5         SSS5        WR                  (       aZ  [         R                  SU R
                  S9 nU R
                  R                  5         SSS5        WR                  (       a  SU l        gSv •  M²  ! , (       d  f       N= f! , (       d  f       N>= f7f)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÷ð �y�yÜ×)Ñ)ØDØ!Ÿ^™^ð *ñ ð  Ø—N‘N×5Ñ5Ô7÷	ð
 ×$×$ð &*�D”NØØŠJñ! ÷õ ú÷
õ üs3   ‚ C¢B6½7CÁ4CÂ'CÂ6
CÃ CÃ
CÃCc                 ó@   • [        U R                  5       5      U l        g)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                 ój   • U R                   (       a  gSU l         U R                  R                  5         g)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                 ó8   • U R                   R                  5         g)z'
@see: C{IPushProducer.pauseProducing}
N)r#   Úpauser$   s    r   ÚpauseProducingÚ_PullToPush.pauseProducinge   s   € ð 	�‰×ÑÕr   c                 ó8   • U R                   R                  5         g)z(
@see: C{IPushProducer.resumeProducing}
N)r#   Úresumer$   s    r   r   Ú_PullToPush.resumeProducingk   s   € ð 	�‰×ÑÕr   c                 óX   • U R                  5         U R                  R                  5         g)z&
@see: C{IPushProducer.stopProducing}
N)r)   r   ÚstopProducingr$   s    r   r3   Ú_PullToPush.stopProducingq   s    € ð 	×ÑÔØ�‰×$Ñ$Õ&r   )r   r#   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r    r%   r)   r-   r   r3   Ú__static_attributes__© r   r   r
   r
      s1   † ñð0 €Iò"òò41ò
òò õ'r   r
   N)r9   Útypingr   Úzope.interfacer   Útwisted.internet.interfacesr   Útwisted.internet.taskr   Útwisted.loggerr   r   r   ÚstrÚ__annotations__r
   r;   r   r   Ú<module>rC      sS   ðò
õ å &å 5Ý +Ý !áƒx€ð €ˆˆc‰Ó ñ ˆ]Ó÷^'ð ^'ó ñ^'r   