]L ihddlmZddlZddlZddlmZmZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZmZmZmZej,dk\rdd l mZndd lmZe d Gd d eeZe d GddeeZe d GddeeZGddeeZy)) annotationsN)CallableMapping)InitVar dataclassfield)Any)AnyByteReceiveStreamAnyByteSendStream AnyByteStreamAnyByteStreamConnectableObjectReceiveStreamObjectSendStream ObjectStreamObjectStreamConnectable) )overrideF)eqc~eZdZUdZded<dZded<dZded<ed Zd ed <dd Z ddZ ddZ e ddZ y)TextReceiveStreama Stream wrapper that decodes bytes to strings using the given encoding. Decoding is done using :class:`~codecs.IncrementalDecoder` which returns any completely received unicode characters as soon as they come in. :param transport_stream: any bytes-based receive stream :param encoding: character encoding to use for decoding bytes to strings (defaults to ``utf-8``) :param errors: handling scheme for decoding errors (defaults to ``strict``; see the `codecs module documentation`_ for a comprehensive list of options) .. _codecs module documentation: https://docs.python.org/3/library/codecs.html#codec-objects r transport_streamutf-8 InitVar[str]encodingstricterrorsFinitzcodecs.IncrementalDecoder_decodercJtj|}|||_y)N)r)codecsgetincrementaldecoderr!)selfrr decoder_classs X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anyio/streams/text.py __post_init__zTextReceiveStream.__post_init__1s44X> %V4 cK |jjd{}|jj|}|r|SB7$wN)rreceiver!decode)r%chunkdecodeds r'r,zTextReceiveStream.receive5sD//7799Emm**51G 9sAA%AcK|jjd{|jjy7wr+)racloser!resetr%s r'r1zTextReceiveStream.aclose<s3##**,,,  -sAA Ac.|jjSr+rextra_attributesr3s r'r6z"TextReceiveStream.extra_attributes@$$555r)Nrstrrr9returnNoner:r9r:r;r:zMapping[Any, Callable[[], Any]])__name__ __module__ __qualname____doc____annotations__rrrr!r(r,r1propertyr6r)r'rrsV +*$Hl$#FL#*/U*;H';566r)rc~eZdZUdZded<dZded<dZded <ed Zd ed <ddZ ddZ ddZ e ddZ y)TextSendStreama Sends strings to the wrapped stream as bytes using the given encoding. :param AnyByteSendStream transport_stream: any bytes-based send stream :param str encoding: character encoding to use for encoding strings to bytes (defaults to ``utf-8``) :param str errors: handling scheme for encoding errors (defaults to ``strict``; see the `codecs module documentation`_ for a comprehensive list of options) .. _codecs module documentation: https://docs.python.org/3/library/codecs.html#codec-objects r rrrrrr9rFrz Callable[..., tuple[bytes, int]]_encoderc8tj||_yr+)r# getencoderrH)r%rs r'r(zTextSendStream.__post_init__Ys))(3 r)cK|j||jd}|jj|d{y7w)Nr)rHrrsend)r%itemencodeds r'rLzTextSendStream.send\s9--dkk215##((111s>AAAcTK|jjd{y7wr+)rr1r3s r'r1zTextSendStream.aclose`s##**,,, (&(c.|jjSr+r5r3s r'r6zTextSendStream.extra_attributescr7r)N)rr9r:r;rMr9r:r;r=r>)r?r@rArBrCrrrrHr(rLr1rDr6rEr)r'rGrGEsV ('$Hl$FC16E1BH.B42-66r)rGceZdZUdZded<dZded<dZded<ed Zd ed <ed Z d ed<ddZ ddZ ddZ ddZ ddZeddZy) TextStreama A bidirectional stream that decodes bytes to strings on receive and encodes strings to bytes on send. Extra attributes will be provided from both streams, with the receive stream providing the values in case of a conflict. :param AnyByteStream transport_stream: any bytes-based stream :param str encoding: character encoding to use for encoding/decoding strings to/from bytes (defaults to ``utf-8``) :param str errors: handling scheme for encoding errors (defaults to ``strict``; see the `codecs module documentation`_ for a comprehensive list of options) .. _codecs module documentation: https://docs.python.org/3/library/codecs.html#codec-objects r rrrrrrFrr_receive_streamrG _send_streamcxt|j|||_t|j|||_y)N)rr)rrrUrGrV)r%rrs r'r(zTextStream.__post_init__s80  ! !HV +  ! !HV r)cRK|jjd{S7wr+)rUr,r3s r'r,zTextStream.receives!))113333s '%'cVK|jj|d{y7wr+)rVrL)r%rMs r'rLzTextStream.sends $$T***s )')cTK|jjd{y7wr+)rsend_eofr3s r'r[zTextStream.send_eofs##,,...rPcK|jjd{|jjd{y7'7wr+)rVr1rUr3s r'r1zTextStream.acloses?&&(((""))+++ )+s!A A!A A A  A c^i|jj|jjSr+)rVr6rUr3s r'r6zTextStream.extra_attributess4 00 ""33  r)Nr8r<rRr=r>)r?r@rArBrCrrrrUrVr(r,rLr[r1rDr6rEr)r'rTrThso"$#$Hl$#FL#).E):O&:#(e#4L.4 4+/,  r)rTc&eZdZddZeddZy)TextConnectablec||_y)zF :param connectable: the bytestream endpoint to wrap N) connectable)r%ras r'__init__zTextConnectable.__init__s 'r)chK|jjd{}t|S7wr+)raconnectrT)r%streams r'rdzTextConnectable.connects-''//11&!!2s 202N)rar)r:rT)r?r@rArbrrdrEr)r'r_r_s'""r)r_) __future__rr#syscollections.abcrr dataclassesrrrtypingr abcr r r rrrrr version_infortyping_extensionsr9rrGrTr_rEr)r'rns" -11   w* e'6+C0'6'6T e6%c*66D e2 c"2 2 j "-c2 "r)