HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/anyio/streams/__pycache__/text.cpython-310.pyc
o

���g��@s�ddlmZddlZddlmZmZddlmZmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZedd	�Gd
d�dee��Zedd	�Gdd
�d
ee��Zedd	�Gdd�dee��ZdS)�)�annotationsN)�Callable�Mapping)�InitVar�	dataclass�field)�Any�)�AnyByteReceiveStream�AnyByteSendStream�
AnyByteStream�ObjectReceiveStream�ObjectSendStream�ObjectStreamF)�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"�=/usr/local/lib/python3.10/dist-packages/anyio/streams/text.py�
__post_init__)s
zTextReceiveStream.__post_init__c�s*�	|j��IdH}|j�|�}|r|Sq�N)r�receiver�decode)r �chunk�decodedr"r"r#r&-s��zTextReceiveStream.receivec�s �|j��IdH|j��dSr%)r�acloser�reset�r r"r"r#r*4s�zTextReceiveStream.aclose�Mapping[Any, Callable[[], Any]]cC�|jjSr%�r�extra_attributesr,r"r"r#r08�z"TextReceiveStream.extra_attributesN�rrrrrr�rr�rr�rr-)�__name__�
__module__�__qualname__�__doc__�__annotations__rrrrr$r&r*�propertyr0r"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
    rrrrrrrrFrz Callable[..., tuple[bytes, int]]�_encoderrrcCst�|�|_dSr%)r�
getencoderr=)r rr"r"r#r$QszTextSendStream.__post_init__�itemc�s*�|�||j�d}|j�|�IdHdS)Nr)r=rr�send)r r?�encodedr"r"r#r@Ts�zTextSendStream.sendc���|j��IdHdSr%)rr*r,r"r"r#r*X��zTextSendStream.acloser-cCr.r%r/r,r"r"r#r0[r1zTextSendStream.extra_attributesN)rrrr�r?rrrr4r5)r6r7r8r9r:rrrr=r$r@r*r;r0r"r"r"r#r<=s




r<c@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_streamr<�_send_streamrrrcCs(t|j||d�|_t|j||d�|_dS)N)rr)rrrFr<rG)r rrr"r"r#r$ys��zTextStream.__post_init__c�s�|j��IdHSr%)rFr&r,r"r"r#r&�s�zTextStream.receiver?c�s�|j�|�IdHdSr%)rGr@)r r?r"r"r#r@�s�zTextStream.sendc�rBr%)r�send_eofr,r"r"r#rH�rCzTextStream.send_eofc�s&�|j��IdH|j��IdHdSr%)rGr*rFr,r"r"r#r*�s�zTextStream.acloser-cCsi|jj�|jj�Sr%)rGr0rFr,r"r"r#r0�s
��zTextStream.extra_attributesNr2r3rDr4r5)r6r7r8r9r:rrrrFrGr$r&r@rHr*r;r0r"r"r"r#rE`s





rE)�
__future__rr�collections.abcrr�dataclassesrrr�typingr�abcr
rrr
rrrrr<rEr"r"r"r#�<module>s 
*"