Ë
    ·�©j  ã                  ó0   — d dl mZ d dlmZ  G d„ d«      Zy)é    )Úannotations)Ú	Generatorc                  ól   — e Zd ZdZdd„Zef	 	 	 	 	 dd„Zdd„Zef	 	 	 	 	 dd„Zdd„Z	dd„Z
dd„Zdd	„Zy
)ÚStreamReaderzÄ
    Generator-based stream reader.

    This class doesn't support concurrent calls to :meth:`read_line`,
    :meth:`read_exact`, or :meth:`read_to_eof`. Make sure calls are
    serialized.

    c                ó0   — t        «       | _        d| _        y )NF)Ú	bytearrayÚbufferÚeof©Úselfs    úY/var/www/html/streamforge-license/venv/lib/python3.12/site-packages/websockets/streams.pyÚ__init__zStreamReader.__init__   s   € Ü“kˆŒØˆ�ó    c              #  óX  K  — d}d}	 | j                   j                  d|«      dz   }|dkD  rnIt        | j                   «      }||kD  r |d|› d|› d�«      ‚| j                  rt	        d|› d�«      ‚d	–— Œn||kD  r |d|› d|› d�«      ‚| j                   d	| }| j                   d	|…= |S ­w)
a  
        Read a LF-terminated line from the stream.

        This is a generator-based coroutine.

        The return value includes the LF character.

        Args:
            m: Maximum number bytes to read; this is a security limit.
            too_long_exc_type: exception to raise if the line ends in more
                than ``m`` bytes; defaults to :exc:`RuntimeError`.

        Raises:
            EOFError: If the stream ends without a LF.
            RuntimeError: If the line ends in more than ``m`` bytes.

        r   ó   
é   úread ú bytes, expected no more than ú bytesústream ends after z bytes, before end of lineN)r	   ÚfindÚlenr
   ÚEOFError)r   ÚmÚtoo_long_exc_typeÚnÚpÚrs         r   Ú	read_linezStreamReader.read_line   sÝ   è ø€ ð, ˆØˆØØ—‘× Ñ  ¨Ó*¨QÑ.ˆAØ�1ŠuØÜ�D—K‘KÓ ˆAØ�1ŠuÙ'Ø˜A˜3Ð<¸Q¸C¸vÐFóð ð �xŠxÜÐ!3°A°3Ð6PÐQÓRÐRÛð ð ˆqŠ5Ù# e¨A¨3Ð.LÈQÈCÈvÐ$VÓWÐWØ�K‰K˜˜ˆOˆØ�K‰K˜˜˜ˆOØˆùs   ‚B(B*c              #  ó(  K  — |dk\  sJ ‚t        | j                  «      |k  rP| j                  r't        | j                  «      }t        d|› d|› d�«      ‚d–— t        | j                  «      |k  rŒP| j                  d| }| j                  d|…= |S ­w)zø
        Read a given number of bytes from the stream.

        This is a generator-based coroutine.

        Args:
            n: How many bytes to read.

        Raises:
            EOFError: If the stream ends in less than ``n`` bytes.

        r   r   z bytes, expected r   N)r   r	   r
   r   )r   r   r   r   s       r   Ú
read_exactzStreamReader.read_exact>   s�   è ø€ ð �AŠvˆˆvÜ�$—+‘+Ó Ò"Ø�xŠxÜ˜Ÿ™Ó$�ÜÐ!3°A°3Ð6GÈÀsÈ&ÐQÓRÐRÛô	 �$—+‘+Ó Ó"ð
 �K‰K˜˜ˆOˆØ�K‰K˜˜˜ˆOØˆùs   ‚A/BÁ2 Bc              #  óÖ   K  — | j                   s:t        | j                  «      }||kD  r |d|› d|› d�«      ‚d–— | j                   sŒ:| j                  dd }| j                  dd…= |S ­w)až  
        Read all bytes from the stream.

        This is a generator-based coroutine.

        Args:
            m: Maximum number bytes to read; this is a security limit.
            too_long_exc_type: exception to raise if the stream ends in more
                than ``m`` bytes; defaults to :exc:`RuntimeError`.

        Raises:
            RuntimeError: If the stream ends in more than ``m`` bytes.

        r   r   r   N)r
   r   r	   )r   r   r   r   r   s        r   Úread_to_eofzStreamReader.read_to_eofU   sq   è ø€ ð& —(’(Ü�D—K‘KÓ ˆAØ�1ŠuÙ'Ø˜A˜3Ð<¸Q¸C¸vÐFóð ó ð —(“(ð �K‰K™ˆNˆØ�K‰KšˆNØˆùs   ‚AA)Á	 A)c              #  óJ   K  — 	 | j                   ry| j                  ryd–— Œ­w)zy
        Tell whether the stream has ended and all data was read.

        This is a generator-based coroutine.

        TFN)r	   r
   r   s    r   Úat_eofzStreamReader.at_eofs   s)   è ø€ ð Ø�{Š{ØØ�xŠxØó ð ùs   ‚!#c                ó\   — | j                   rt        d«      ‚| xj                  |z  c_        y)zà
        Write data to the stream.

        :meth:`feed_data` cannot be called after :meth:`feed_eof`.

        Args:
            data: Data to write.

        Raises:
            EOFError: If the stream has ended.

        ústream endedN)r
   r   r	   )r   Údatas     r   Ú	feed_datazStreamReader.feed_dataƒ   s$   € ð �8Š8Ü˜>Ó*Ð*Ø�Š�tÑŽr   c                ó@   — | j                   rt        d«      ‚d| _         y)z�
        End the stream.

        :meth:`feed_eof` cannot be called more than once.

        Raises:
            EOFError: If the stream has ended.

        r'   TN)r
   r   r   s    r   Úfeed_eofzStreamReader.feed_eof”   s   € ð �8Š8Ü˜>Ó*Ð*Øˆ�r   c                ó"   — | j                   dd…= y)zG
        Discard all buffered data, but don't end the stream.

        N)r	   r   s    r   ÚdiscardzStreamReader.discard¢   s   € ð
 �K‰Kš‰Nr   N)ÚreturnÚNone)r   Úintr   ztype[Exception]r.   ú Generator[None, None, bytearray])r   r0   r.   r1   )r.   zGenerator[None, None, bool])r(   zbytes | bytearrayr.   r/   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚRuntimeErrorr   r!   r#   r%   r)   r+   r-   © r   r   r   r      sr   „ ñóð .:ð(àð(ð +ð(ð 
*ó	(óTð4 .:ðàðð +ðð 
*ó	ó<ó ó"ôr   r   N)Ú
__future__r   Úcollections.abcr   r   r7   r   r   ú<module>r:      s   ðÝ "å %÷aò ar   