File: //usr/local/CyberCP/lib/python3.10/site-packages/websockets/__pycache__/streams.cpython-310.pyc
o
�h� � @ s* d dl mZ d dlmZ G dd� d�ZdS )� )�annotations)� Generatorc @ s` e Zd ZdZddd�Zdd d
�Zddd
�Zddd�Zddd�Zd dd�Z ddd�Z
ddd�ZdS )!�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.
�return�Nonec C s t � | _d| _d S )NF)� bytearray�buffer�eof��self� r �E/usr/local/CyberCP/lib/python3.10/site-packages/websockets/streams.py�__init__ s
zStreamReader.__init__�m�int�Generator[None, None, bytes]c c s� � d}d} | j �d|�d }|dkrn#t| j �}||kr(td|� d|� d���| jr3td|� d ���d
V q||krFtd|� d|� d���| j d
|� }| j d
|�= |S )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.
Raises:
EOFError: If the stream ends without a LF.
RuntimeError: If the stream ends in more than ``m`` bytes.
r T�
� �read � bytes, expected no more than � bytes�stream ends after z bytes, before end of lineN)r �find�len�RuntimeErrorr �EOFError)r r �n�p�rr r r
� read_line s&