ó
    úÞ jZ  ã                  ó  • S SK Jr  SrS SKrS SKJrJrJr  S SKJ	r	J
r
  S SKJrJr  SSKJrJrJrJr  SS	KJrJrJrJrJrJr  \R4                  S
:¼  a  S SKJr  OS SKJr  \	" SS9 " S S\5      5       r " S S\\5      r " S S\5      rg)é    )Úannotations)ÚBufferedByteReceiveStreamÚBufferedByteStreamÚBufferedConnectableN)ÚCallableÚIterableÚMapping)Ú	dataclassÚfield)ÚAnyÚSupportsIndexé   )ÚClosedResourceErrorÚDelimiterNotFoundÚEndOfStreamÚIncompleteRead)ÚAnyByteReceiveStreamÚAnyByteStreamÚAnyByteStreamConnectableÚByteReceiveStreamÚ
ByteStreamÚByteStreamConnectable)é   é   )ÚoverrideF)Úeqc                  ó²   • \ rS rSr% SrS\S'   \" S\S9rS\S'   \" SSS	9r	S
\S'   SS jr
\SS j5       r\SS j5       rSS jrSSS jjrSS jrSS jrSrg)r   é   z†
Wraps any bytes-based receive stream and uses a buffer to provide sophisticated
receiving capabilities in the form of a byte stream.
r   Úreceive_streamF)ÚinitÚdefault_factoryÚ	bytearrayÚ_buffer)r    ÚdefaultÚboolÚ_closedc              ƒ  ób   #   • U R                   R                  5       I S h  v•N   SU l        g  N7f)NT)r   Úacloser&   ©Úselfs    ÚP/var/www/html/gaurav/venv/lib/python3.13/site-packages/anyio/streams/buffered.pyr(   Ú BufferedByteReceiveStream.aclose)   s)   é € Ø×!Ñ!×(Ñ(Ó*×*Ð*Øˆ�ñ 	+ùs   ‚/ -¡/c                ó,   • [        U R                  5      $ )z"The bytes currently in the buffer.)Úbytesr#   r)   s    r+   ÚbufferÚ BufferedByteReceiveStream.buffer-   s   € ô �T—\‘\Ó"Ð"ó    c                ó.   • U R                   R                  $ ©N)r   Úextra_attributesr)   s    r+   r4   Ú*BufferedByteReceiveStream.extra_attributes2   s   € à×"Ñ"×3Ñ3Ð3r1   c               ó:   • U R                   R                  U5        g)a  
Append data directly into the buffer.

Any data in the buffer will be consumed by receive operations before receiving
anything from the wrapped stream.

:param data: the data to append to the buffer (can be bytes or anything else
    that supports ``__index__()``)

N)r#   Úextend)r*   Údatas     r+   Ú	feed_dataÚ#BufferedByteReceiveStream.feed_data6   s   € ð 	�‰×Ñ˜DÕ!r1   c              ƒ  ó  #   • US:  a  [        S5      eU R                  (       a  [        eU R                  (       a)  [	        U R                  S U 5      nU R                  S U2	 U$ [        U R                  [        5      (       a#  U R                  R                  U5      I S h  v•N $ U R                  R                  5       I S h  v•N n[        U5      U:”  a"  U R                  R                  X!S  5        US U $ U$  NY N97f)Né   z$max_bytes must be a positive integer)Ú
ValueErrorr&   r   r#   r.   Ú
isinstancer   r   ÚreceiveÚlenr7   )r*   Ú	max_bytesÚchunks      r+   r?   Ú!BufferedByteReceiveStream.receiveC   sÝ   é € Ø�q‹=ÜÐCÓDÐDà�<�<Ü%Ð%à�<�<Ü˜$Ÿ,™, z¨	Ð2Ó3ˆEØ—‘˜Z˜i˜ZÐ(ØˆLÜ˜×+Ñ+Ô->×?Ñ?Ø×,Ñ,×4Ñ4°YÓ?×?Ð?ð ×-Ñ-×5Ñ5Ó7×7ˆEÜ�5‹z˜IÓ%à—‘×#Ñ# E¨*Ð$5Ô6Ø˜Z˜iÐ(Ð(à�ñ @ñ 8ùs$   ‚B D Â"C<Â#!D ÃC>Ã8D Ã>D c              ƒ  óÜ  #   •  U[        U R                  5      -
  nUS::  a)  U R                  SU nU R                  SU2	 [        U5      $  [        U R                  [
        5      (       a$  U R                  R                  U5      I Sh  v•N nO#U R                  R                  5       I Sh  v•N n U R                  R                  U5        MË   NE N$! [         a  n[        UeSnAff = f7f)zý
Read exactly the given amount of bytes from the stream.

:param nbytes: the number of bytes to read
:return: the bytes read
:raises ~anyio.IncompleteRead: if the stream was closed before the requested
    amount of bytes could be read from the stream

r   N)
r@   r#   r.   r>   r   r   r?   r   r   r7   )r*   ÚnbytesÚ	remainingÚretvalrB   Úexcs         r+   Úreceive_exactlyÚ)BufferedByteReceiveStream.receive_exactly[   sÐ   é € ð Ø¤ T§\¡\Ó!2Ñ2ˆIØ˜A‹~ØŸ™ g vÐ.�Ø—L‘L  & Ð)Ü˜V“}Ð$ð.Ü˜d×1Ñ1Ô3D×EÑEØ"&×"5Ñ"5×"=Ñ"=¸iÓ"H×H‘Eà"&×"5Ñ"5×"=Ñ"=Ó"?×?‘Eð �L‰L×Ñ Ô&ñ ñ Iá?øÜó .Ü$¨#Ð-ûð.üsZ   ‚A	C,Á=C Â	CÂ
C ÂC,ÂC Â,CÂ-C Â1C,ÃC ÃC Ã
C)ÃC$Ã$C)Ã)C,c              ƒ  ó  #   • [        U5      nSn U R                  R                  X5      nUS:¼  a5  U R                  SU nU R                  SU[        U5      -   2	 [        U5      $ [        U R                  5      U:¼  a  [	        U5      e U R
                  R                  5       I Sh  v•N n[        [        U R                  5      U-
  S-   S5      nU R                  R                  U5        Mß   NF! [         a  n[        UeSnAff = f7f)aý  
Read from the stream until the delimiter is found or max_bytes have been read.

:param delimiter: the marker to look for in the stream
:param max_bytes: maximum number of bytes that will be read before raising
    :exc:`~anyio.DelimiterNotFound`
:return: the bytes read (not including the delimiter)
:raises ~anyio.IncompleteRead: if the stream was closed before the delimiter
    was found
:raises ~anyio.DelimiterNotFound: if the delimiter is not found within the
    bytes read up to the maximum allowed

r   Nr<   )r@   r#   Úfindr.   r   r   r?   r   r   Úmaxr7   )	r*   Ú	delimiterrA   Údelimiter_sizeÚoffsetÚindexÚfoundr8   rH   s	            r+   Úreceive_untilÚ'BufferedByteReceiveStream.receive_untilv   sö   é € ô ˜Y›ˆØˆØà—L‘L×%Ñ% iÓ8ˆEØ˜‹zØŸ™ V eÐ,�Ø—L‘LÐ!; 5¬3¨y«>Ñ#9Ð!;Ð<Ü˜U“|Ð#ô �4—<‘<Ó  IÓ-Ü'¨	Ó2Ð2ð.Ø!×0Ñ0×8Ñ8Ó:×:�ô
 œ˜TŸ\™\Ó*¨^Ñ;¸aÑ?ÀÓCˆFØ�L‰L×Ñ Ô%ñ) ñ ;øÜó .Ü$¨#Ð-ûð.üs=   ‚B	DÂC2 Â)C0Â*C2 Â.ADÃ0C2 Ã2
DÃ<DÄDÄD)r&   N©ÚreturnÚNone)rV   r.   )rV   zMapping[Any, Callable[[], Any]])r8   zIterable[SupportsIndex]rV   rW   )i   )rA   ÚintrV   r.   )rE   rX   rV   r.   )rN   r.   rA   rX   rV   r.   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   r"   r#   r&   r(   Úpropertyr/   r4   r9   r?   rI   rS   Ú__static_attributes__© r1   r+   r   r      sr   ‡ ñð
 )Ó(Ù E¸9ÑE€GˆYÓEÙ˜u¨eÑ4€GˆTÓ4ôð ó#ó ð#ð ó4ó ð4ô"öô0'÷6$&r1   r   c                  óX   ^ • \ rS rSrSrSU 4S jjr\SS j5       r\S	S j5       rSr	U =r
$ )
r   é�   zy
A full-duplex variant of :class:`BufferedByteReceiveStream`. All writes are passed
through to the wrapped stream as-is.
c                ó0   >• [         TU ]  U5        Xl        g)z*
:param stream: the stream to be wrapped

N)ÚsuperÚ__init__Ú_stream)r*   ÚstreamÚ	__class__s     €r+   rf   ÚBufferedByteStream.__init__£   s   ø€ ô
 	‰Ñ˜Ô Ø�r1   c              ƒ  óT   #   • U R                   R                  5       I S h  v•N   g  N7fr3   )rg   Úsend_eofr)   s    r+   rl   ÚBufferedByteStream.send_eof«   s   é € à�l‰l×#Ñ#Ó%×%Ó%ùs   ‚( &¡(c              ƒ  óV   #   • U R                   R                  U5      I S h  v•N   g  N7fr3   )rg   Úsend)r*   Úitems     r+   ro   ÚBufferedByteStream.send¯   s   é € à�l‰l×Ñ Ó%×%Ó%ùs   ‚)¡'¢))rg   )rh   r   rU   )rp   r.   rV   rW   )rY   rZ   r[   r\   r]   rf   r   rl   ro   r`   Ú__classcell__)ri   s   @r+   r   r   �   s5   ø† ñ÷
ð ó&ó ð&ð ó&ó ö&r1   r   c                  ó6   • \ rS rSrSrSS jr\SS j5       rSrg)	r   é´   a_  
Wraps a byte stream connectable to produce :class:`BufferedByteStream` connections.

Use this when you want the streams returned by :meth:`connect` to have the buffered
receive API (e.g. :meth:`~BufferedByteReceiveStream.receive_exactly` and
:meth:`~BufferedByteReceiveStream.receive_until`).

:param connectable: the byte stream connectable to wrap
c                ó   • Xl         g)z.
:param connectable: the connectable to wrap

N©Úconnectable)r*   rw   s     r+   rf   ÚBufferedConnectable.__init__¿   s
   € ð
 'Õr1   c              ƒ  óh   #   • U R                   R                  5       I S h  v•N n[        U5      $  N7fr3   )rw   Úconnectr   )r*   rh   s     r+   rz   ÚBufferedConnectable.connectÆ   s,   é € à×'Ñ'×/Ñ/Ó1×1ˆÜ! &Ó)Ð)ñ 2ùs   ‚2 0¡2rv   N)rw   r   )rV   r   )	rY   rZ   r[   r\   r]   rf   r   rz   r`   ra   r1   r+   r   r   ´   s    † ñô'ð ó*ó ó*r1   r   ) Ú
__future__r   Ú__all__ÚsysÚcollections.abcr   r   r	   Údataclassesr
   r   Útypingr   r   Ú r   r   r   r   Úabcr   r   r   r   r   r   Úversion_infor   Útyping_extensionsr   r   r   ra   r1   r+   Ú<module>r†      s‡   ðÝ "ð€ó ß 7Ñ 7ß (ß %ç RÓ R÷÷ ð ×Ñ�wÓÞå*ñ ˆeÑô{&Ð 1ó {&ó ð{&ô|&Ð2°Jô &ô.*Ð/õ *r1   