ó
    &ÝNj9  ã                   óV   • S r SSKrSSKrSSKrSSKJr   " S S\5      r " S S5      rg)zÙ
Attempt to generalize the "feeder" part of a `.Channel`: an object which can be
read from and closed, but is reading from a buffer fed by another thread.  The
read operations are blocking and can have a timeout set.
é    N)Úbc                   ó   • \ rS rSrSrSrg)ÚPipeTimeouté   zH
Indicates that a timeout was reached on a read from a `.BufferedPipe`.
© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/paramiko/buffered_pipe.pyr   r      s   † ñò 	r   r   c                   ó\   • \ rS rSrSrS rS rSS jrS rS r	S	 r
SS
 jrS rS rS rSrg)ÚBufferedPipeé'   zš
A buffer that obeys normal read (with timeout) & close semantics for a
file or socket, but is fed data from another thread.  This is used by
`.Channel`.
c                 óÔ   • [         R                  " 5       U l        [         R                  " U R                  5      U l        S U l        [        R                  " S5      U l        SU l        g )NÚBF)	Ú	threadingÚLockÚ_lockÚ	ConditionÚ_cvÚ_eventÚarrayÚ_bufferÚ_closed©Úselfs    r   Ú__init__ÚBufferedPipe.__init__.   sD   € Ü—^’^Ó%ˆŒ
Ü×&Ò& t§z¡zÓ2ˆŒØˆŒÜ—{’{ 3Ó'ˆŒØˆ�r   c                 ó:   • U R                   R                  U5        g ©N)r   Ú	frombytes©r   Údatas     r   Ú_buffer_frombytesÚBufferedPipe._buffer_frombytes5   s   € Ø�‰×Ñ˜tÕ$r   Nc                 ó<   • U R                   S U R                  5       $ r#   )r   Útobytes)r   Úlimits     r   Ú_buffer_tobytesÚBufferedPipe._buffer_tobytes8   s   € Ø�|‰|˜F˜UÐ#×+Ñ+Ó-Ð-r   c                 óN  • U R                   R                  5          Xl        U R                  (       d  [	        U R
                  5      S:”  a  UR                  5         OUR                  5         U R                   R                  5         g! U R                   R                  5         f = f)zÞ
Set an event on this buffer.  When data is ready to be read (or the
buffer has been closed), the event will be set.  When no data is
ready, the event will be cleared.

:param threading.Event event: the event to set/clear
r   N)	r   Úacquirer   r   Úlenr   ÚsetÚclearÚrelease)r   Úevents     r   Ú	set_eventÚBufferedPipe.set_event;   sj   € ð 	�
‰
×ÑÔð	!ØŒKð �|�|œs 4§<¡<Ó0°1Ó4Ø—	‘	•à—‘”à�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œAB ÂB$c                 ób  • U R                   R                  5          U R                  b  U R                  R                  5         U R	                  [        U5      5        U R                  R                  5         U R                   R                  5         g! U R                   R                  5         f = f)z±
Feed new data into this pipe.  This method is assumed to be called
from a separate thread, so synchronization is done.

:param data: the data to add, as a ``str`` or ``bytes``
N)	r   r/   r   r1   r'   r   r   Ú
notify_allr3   r%   s     r   ÚfeedÚBufferedPipe.feedR   st   € ð 	�
‰
×ÑÔð	!Ø�{‰{Ñ&Ø—‘—‘Ô!Ø×"Ñ"¤1 T£7Ô+Ø�H‰H×ÑÔ!à�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œAB ÂB.c                 ó  • U R                   R                  5          [        U R                  5      S:X  a   U R                   R	                  5         g U R                   R	                  5         g! U R                   R	                  5         f = f)a,  
Returns true if data is buffered and ready to be read from this
feeder.  A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.

:return:
    ``True`` if a `read` call would immediately return at least one
    byte; ``False`` otherwise.
r   FT©r   r/   r0   r   r3   r   s    r   Ú
read_readyÚBufferedPipe.read_readyb   se   € ð 	�
‰
×ÑÔð	!Ü�4—<‘<Ó  AÓ%Øð �J‰J×ÑÕ ð à�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œA- Á-B	c                 óø  • [        5       nU R                  R                  5          [        U R                  5      S:X  añ  U R
                  (       a  UU R                  R                  5         $ US:X  a
  [        5       e[        U R                  5      S:X  a›  U R
                  (       dŠ  [        R                  " 5       nU R                  R                  U5        Ub+  U[        R                  " 5       U-
  -  nUS::  a
  [        5       e[        U R                  5      S:X  a  U R
                  (       d  MŠ  [        U R                  5      U::  aX  U R                  5       nU R                  SS2	 U R                  b+  U R
                  (       d  U R                  R                  5         O U R                  U5      nU R                  SU2	 U R                  R                  5         U$ ! U R                  R                  5         f = f)aü  
Read data from the pipe.  The return value is a string representing
the data received.  The maximum amount of data to be received at once
is specified by ``nbytes``.  If a string of length zero is returned,
the pipe has been closed.

The optional ``timeout`` argument can be a nonnegative float expressing
seconds, or ``None`` for no timeout.  If a float is given, a
`.PipeTimeout` will be raised if the timeout period value has elapsed
before any data arrives.

:param int nbytes: maximum number of bytes to read
:param float timeout:
    maximum seconds to wait (or ``None``, the default, to wait forever)
:return: the read data, as a ``str`` or ``bytes``

:raises:
    `.PipeTimeout` -- if a timeout was specified and no data was ready
    before that timeout
r   g        N)Úbytesr   r/   r0   r   r   r3   r   Útimer   Úwaitr,   r   r2   )r   ÚnbytesÚtimeoutÚoutÚthens        r   ÚreadÚBufferedPipe.readt   sm  € ô* ‹gˆØ�
‰
×ÑÔð	!Ü�4—<‘<Ó  AÓ%Ø—<—<Øð0 �J‰J×ÑÕ ð- ˜c“>Ü%›-Ð'ô ˜4Ÿ<™<Ó(¨AÓ-°t·|·|ÜŸ9š9›;�DØ—H‘H—M‘M 'Ô*ØÑ*Ø¤4§9¢9£;°Ñ#5Ñ5˜Ø" c›>Ü"-£-Ð/ô ˜4Ÿ<™<Ó(¨AÓ-°t·|·|±|ô �4—<‘<Ó  FÓ*Ø×*Ñ*Ó,�Ø—L‘L¢�OØ—K‘KÑ+°T·\·\Ø—K‘K×%Ñ%Ô'øà×*Ñ*¨6Ó2�Ø—L‘L  & Ð)à�J‰J×ÑÔ àˆ
øð �J‰J×ÑÕ ús   ¦+G Á,CG Ä0BG ÇG9c                 ó\  • U R                   R                  5          U R                  5       nU R                  SS2	 U R                  b+  U R
                  (       d  U R                  R                  5         UU R                   R                  5         $ ! U R                   R                  5         f = f)z‘
Clear out the buffer and return all data that was in it.

:return:
    any data that was in the buffer prior to clearing it out, as a
    `str`
N)r   r/   r,   r   r   r   r2   r3   )r   rE   s     r   ÚemptyÚBufferedPipe.emptyª   sv   € ð 	�
‰
×ÑÔð	!Ø×&Ñ&Ó(ˆCØ—‘šQ�Ø—‘Ñ'°··Ø—‘×!Ñ!Ô#Øà�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œAB ÂB+c                 ó<  • U R                   R                  5          SU l        U R                  R	                  5         U R
                  b  U R
                  R                  5         U R                   R                  5         g! U R                   R                  5         f = f)z�
Close this pipe object.  Future calls to `read` after the buffer
has been emptied will return immediately with an empty string.
TN)r   r/   r   r   r8   r   r1   r3   r   s    r   ÚcloseÚBufferedPipe.close¼   si   € ð
 	�
‰
×ÑÔð	!ØˆDŒLØ�H‰H×ÑÔ!Ø�{‰{Ñ&Ø—‘—‘Ô!à�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œAA? Á?Bc                 óÔ   • U R                   R                  5          [        U R                  5      U R                   R	                  5         $ ! U R                   R	                  5         f = f)zQ
Return the number of bytes buffered.

:return: number (`int`) of bytes buffered
r<   r   s    r   Ú__len__ÚBufferedPipe.__len__Ê   sF   € ð 	�
‰
×ÑÔð	!Ü�t—|‘|Ó$à�J‰J×ÑÕ øˆD�J‰J×ÑÕ ús   œA ÁA')r   r   r   r   r   r#   )r   r	   r
   r   r   r    r'   r,   r5   r9   r=   rG   rJ   rM   rP   r   r   r   r   r   r   '   s:   † ñòò%ô.ò!ò.!ò !ô$4òl!ò$!õ
!r   r   )	r   r   r   rA   Úparamiko.utilr   ÚIOErrorr   r   r   r   r   Ú<module>rT      s0   ðñ&ó Û Û Ý ô	�'ô 	÷m!ò m!r   