K i0ddlmZddlmZGddZy)) annotations) GeneratorcPeZdZdZd dZd dZd dZd dZddZddZ d dZ 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. c0t|_d|_y)NF) bytearraybuffereofselfs X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/websockets/streams.py__init__zStreamReader.__init__sk c#dKd}d} |jjd|dz}|dkDrnLt|j}||kDrtd|d|d|jrt d|dd q||kDrtd|d|d|jd |}|jd |=|Sw) 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 read  bytes, expected no more than  bytesstream ends after z bytes, before end of lineN)r findlen RuntimeErrorr EOFError)r mnprs r read_linezStreamReader.read_lines     *Q.A1uDKK A1u"U1#-KA3f#UVVxx!3A36PQRR  q5qc)Gs&QR R KKO KKOsB.B0c#(K|dk\sJt|j|krP|jr't|j}td|d|ddt|j|krP|jd|}|jd|=|Sw)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. rrz bytes, expected rN)rr r r)r rrrs r read_exactzStreamReader.read_exact6sAv v$++"xx $!3A36Gs&QRR  $++" KKO KKOs A/B2 Bc#K|js=t|j}||kDrtd|d|dd|js=|jdd}|jdd=|Sw)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. Raises: RuntimeError: If the stream ends in more than ``m`` bytes. rrrN)r rr r)r rrrs r read_to_eofzStreamReader.read_to_eofMsj((DKK A1u"U1#-KA3f#UVV  (( KKN KKNs A A, A,c#JK |jry|jrydw)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_eofzStreamReader.at_eofcs){{xx s!#c\|jr td|xj|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 rr )r datas r feed_datazStreamReader.feed_datass$ 88>* * t rc@|jr tdd|_y)z End the stream. :meth:`feed_eof` cannot be called more than once. Raises: EOFError: If the stream has ended. r'TN)r rr s r feed_eofzStreamReader.feed_eofs 88>* *rc"|jdd=y)zG Discard all buffered data, but don't end the stream. N)r r s r discardzStreamReader.discards KKNrN)returnNone)rintr.Generator[None, None, bytes])rr0r.r1)r.zGenerator[None, None, bool])r(bytesr.r/) __name__ __module__ __qualname____doc__rrr!r#r%r)r+r-rr rrs0 D., " rrN) __future__rcollections.abcrrr7rr r:s"%QQr