HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/anyio/streams/__pycache__/text.cpython-310.pyc
o

�h�@s
ddlmZddlZddlZddlmZmZddlmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZmZmZmZejdkrFdd	lmZndd	lmZe	d
d�Gdd
�d
ee��Ze	d
d�Gdd�dee��Ze	d
d�Gdd�dee��ZGdd�dee�ZdS)�)�annotationsN)�Callable�Mapping)�InitVar�	dataclass�field)�Any�)�AnyByteReceiveStream�AnyByteSendStream�
AnyByteStream�AnyByteStreamConnectable�ObjectReceiveStream�ObjectSendStream�ObjectStream�ObjectStreamConnectable)��)�overrideF)�eqc@speZdZUdZded<dZded<dZded<ed	d
�Zded<ddd�Z	ddd�Z
ddd�Zeddd��Z
dS)�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_stream�utf-8�InitVar[str]�encoding�strict�errorsF��initzcodecs.IncrementalDecoder�_decoder�str�return�NonecCst�|�}||d�|_dS)N)r)�codecs�getincrementaldecoderr)�selfrr�
decoder_class�r'�E/usr/local/CyberCP/lib/python3.10/site-packages/anyio/streams/text.py�
__post_init__1s
zTextReceiveStream.__post_init__c�s*�	|j��IdH}|j�|�}|r|Sq�N)r�receiver�decode)r%�chunk�decodedr'r'r(r+5s��zTextReceiveStream.receivec�s �|j��IdH|j��dSr*)r�acloser�reset�r%r'r'r(r/<s�zTextReceiveStream.aclose�Mapping[Any, Callable[[], Any]]cC�|jjSr*�r�extra_attributesr1r'r'r(r5@�z"TextReceiveStream.extra_attributesN�rr rr r!r"�r!r �r!r"�r!r2)�__name__�
__module__�__qualname__�__doc__�__annotations__rrrrr)r+r/�propertyr5r'r'r'r(rs



rc@speZdZUdZded<dZded<dZded	<ed
d�Zded
<ddd�Z	ddd�Z
ddd�Zeddd��Z
dS)�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
    rrrrrrr rFrz Callable[..., tuple[bytes, int]]�_encoderr!r"cCst�|�|_dSr*)r#�
getencoderrB)r%rr'r'r(r)YszTextSendStream.__post_init__�itemc�s*�|�||j�d}|j�|�IdHdS)Nr)rBrr�send)r%rD�encodedr'r'r(rE\s�zTextSendStream.sendc���|j��IdHdSr*)rr/r1r'r'r(r/`��zTextSendStream.acloser2cCr3r*r4r1r'r'r(r5cr6zTextSendStream.extra_attributesN)rr r!r"�rDr r!r"r9r:)r;r<r=r>r?rrrrBr)rEr/r@r5r'r'r'r(rAEs




rAc@s�eZdZUdZded<dZded<dZded<ed	d
�Zded<ed	d
�Z	d
ed<d!dd�Z
d"dd�Zd#dd�Zd$dd�Z
d$dd�Zed%dd��Zd S)&�
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_streamrA�_send_streamr r!r"cCs(t|j||d�|_t|j||d�|_dS)N)rr)rrrKrArL)r%rrr'r'r(r)�s��zTextStream.__post_init__c�s�|j��IdHSr*)rKr+r1r'r'r(r+�s�zTextStream.receiverDc�s�|j�|�IdHdSr*)rLrE)r%rDr'r'r(rE�s�zTextStream.sendc�rGr*)r�send_eofr1r'r'r(rM�rHzTextStream.send_eofc�s&�|j��IdH|j��IdHdSr*)rLr/rKr1r'r'r(r/�s�zTextStream.acloser2cCsi|jj�|jj�Sr*)rLr5rKr1r'r'r(r5�s
��zTextStream.extra_attributesNr7r8rIr9r:)r;r<r=r>r?rrrrKrLr)r+rErMr/r@r5r'r'r'r(rJhs





rJc@s$eZdZd
dd�Zeddd��Zd	S)�TextConnectable�connectabler
cCs
||_dS)zF
        :param connectable: the bytestream endpoint to wrap

        N)rO)r%rOr'r'r(�__init__�s
zTextConnectable.__init__r!rJc�s�|j��IdH}t|�Sr*)rO�connectrJ)r%�streamr'r'r(rQ�s�zTextConnectable.connectN)rOr
)r!rJ)r;r<r=rPrrQr'r'r'r(rN�s
rN)�
__future__rr#�sys�collections.abcrr�dataclassesrrr�typingr�abcr
rrr
rrrr�version_infor�typing_extensionsr rrArJrNr'r'r'r(�<module>s"(
*"5