ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/multipart.cpython-311.pyc

�

�܋f�~����ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZddlmZmZmZddlmZm Z m!Z!ddl"m#Z#m$Z$dd	l%m&Z&m'Z'm(Z(m)Z)m*Z*dd
l+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9dd
l:m;Z;dZ<erddl=m>Z>Gd�de?��Z@Gd�de?��ZAdeeBdeeeBeeBeBfffd�ZC	d(deeBeBfdeBdeeBfd�ZDGd�d��ZEGd�d��ZFe9eFe5jG���Gd �d!e6����ZHGd"�d#��ZIee6eBeBfZJGd$�d%e6��ZKGd&�d'��ZLdS))�N)�deque)�
TracebackType)�
TYPE_CHECKING�Any�
AsyncIterator�Deque�Dict�Iterator�List�Mapping�Optional�Sequence�Tuple�Type�Union�cast)�	parse_qsl�unquote�	urlencode)�CIMultiDict�CIMultiDictProxy�MultiMapping�)�ZLibCompressor�ZLibDecompressor)�CONTENT_DISPOSITION�CONTENT_ENCODING�CONTENT_LENGTH�CONTENT_TRANSFER_ENCODING�CONTENT_TYPE)�CHAR�TOKEN�parse_mimetype�reify)�
HeadersParser)�JsonPayload�LookupError�Order�Payload�
StringPayload�get_payload�payload_type)�StreamReader)�MultipartReader�MultipartWriter�BodyPartReader�BadContentDispositionHeader�BadContentDispositionParam�parse_content_disposition�content_disposition_filename)�ClientResponsec��eZdZdS)r1N��__name__�
__module__�__qualname__���H/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/multipart.pyr1r1B��������Dr<r1c��eZdZdS)r2Nr7r;r<r=r2r2Fr>r<r2�header�returnc�v��dtdtfd��dtdtfd�}dtdtf�fd�}dtdtfd�}dtdtfd�}d�ttjt����d	�d
tdtdtfd�}|sdifS|�d
��^}}�|��s%tj	t|����difSi}|�r�|�d��}	d|	vr%tj	t|����difS|	�dd��\}
}|
����
��}
|���}|
|vr%tj	t|����difS�|
��s"tj	t|	������||
��rP||��r||dd���}�n��|��s#tj	t|	������C�n_||
��r�||��r|�dd��\}}
}|pd}n#tj	t|	�������	t!||d��}n�#t"$r%tj	t|	����Y���wxYwd}||��r)d}||dd��d����}ne�|��rd}nW|rU|�d
|d��}||��r=|�d��||dd��d����}d}|r%tj	t|����difS|||
<|���|���|fS)N�stringrAc�P�t|��ott|��kS�N)�boolr"�set�rCs r=�is_tokenz+parse_content_disposition.<locals>.is_tokenMs���F�|�|�4���V��� 4�4r<c�:�|d|dcxkodkncS)Nr����"r;rHs r=�	is_quotedz,parse_content_disposition.<locals>.is_quotedPs,���a�y�F�2�J�-�-�-�-�#�-�-�-�-�-r<c�L���|��o|�d��dkS)N�'�)�count)rCrIs �r=�
is_rfc5987z-parse_content_disposition.<locals>.is_rfc5987Ss)����x����:�F�L�L��$5�$5��$:�:r<c�,�|�d��S)N�*)�endswithrHs r=�is_extended_paramz4parse_content_disposition.<locals>.is_extended_paramVs�����s�#�#�#r<c��|�d��dz}|sdS|�d��r
||d�n	||d�}|���S)NrTrFrK)�findrU�isdigit)rC�pos�	substrings   r=�is_continuous_paramz6parse_content_disposition.<locals>.is_continuous_paramYsa���k�k�#����"���	��5�&,�o�o�c�&:�&:�L�F�3�r�6�N�N��s�t�t��	�� � �"�"�"r<�)�chars�textr^c�6�tjd|�d�d|��S)Nz\\([z])z\1)�re�sub)r_r^s  r=�unescapez+parse_content_disposition.<locals>.unescape`s"���v�(�u�(�(�(�%��6�6�6r<�;r�=rrKrOrP�utf-8�strictTFz\/)�strrF�join�mapra�escaper!�split�warnings�warnr1�pop�lower�strip�lstripr2r�UnicodeDecodeError)r@rMrRrVr\rc�disptype�parts�params�item�key�value�encoding�_�failed�_valuerIs                @r=r3r3Js����5��5��5�5�5�5�.�#�.�$�.�.�.�.�;�3�;�4�;�;�;�;�;�;�$�#�$�$�$�$�$�$�#�C�#�D�#�#�#�#�-/�G�G�C��	�4�4H�4H�,I�,I�7�7�7�s�7�c�7�c�7�7�7�7����R�x���|�|�C�(�(��H�u��8�H�����
�1�&�9�9�:�:�:��R�x���F�
�<��y�y��|�|���d�?�?��M�5�f�=�=�>�>�>���8�O��Z�Z��Q�'�'�
��U��i�i�k�k���!�!���������&�=�=��M�5�f�=�=�>�>�>���8�O��x��}�}�+	 ��M�4�T�:�:�;�;�;��
 �
 ��
%�
%�'	 ��y����
� ���q��t��-�-����X�e�_�_�
��
�8��>�>�?�?�?��
��
�s�
#�
#� 	 ��z�%� � �
�%*�[�[��a�%8�%8�"��!�U�#�.�w����
�8��>�>�?�?�?��
���x��:�:����%�
�
�
��
�8��>�>�?�?�?���
����
�F��y����
#��� ���q��t��!3�!3�E�!:�!:�;�;�����%���	
#�����
#�"�.�.�E�!�H�.�.���9�V�$�$�#��I�I�a�L�L�L�$�H�V�A�b�D�\�%8�%8��%?�%?�@�@�E�"�F��
 ��
�9�&�A�A�B�B�B��R�x����s��y�<�|�>�>���V�#�#s�J)�)+K�K�filenamerv�namec�2�
�d|z�
|sdS�
|vr|�
S||vr||Sg}t�
fd�|���D����}t|��D]i\}\}}|�dd��\}}|�d��r
|dd�}|t|��kr|�|���i|sdSd�|��}d|vr/|�dd��\}	}}|	pd	}	t||	d
��S|S)Nz%s*c3�P�K�|] \}}|�����||fV��!dSrE)�
startswith)�.0rxry�name_sufs   �r=�	<genexpr>z/content_disposition_filename.<locals>.<genexpr>�sP�����
�
�'�S�%�S�^�^�H�=U�=U�
�
�%�L�
�
�
�
�
�
r<rTrrKr]rOrPrfrg)	�sorted�items�	enumeraterlrUrh�appendrir)rvrru�fnparams�numrxryr{�tailrzr�s          @r=r4r4�si����t�|�H����t�	�V�	�	��h���	
�����d�|�����
�
�
�
�+1�<�<�>�>�
�
�
�
�
��"+�8�!4�!4�	�	��C��#�u��i�i��Q�'�'�G�A�t��}�}�S�!�!�
!��C�R�C�y���s�3�x�x������U�#�#�#�#���	��4���������%�<�<�!&���S�!�!4�!4��H�a���*�7�H��5�(�H�5�5�5��r<c�~�eZdZdZ						dd�Zdd	�Zded
fd�Zdefd�Z	de
ed
fd
�Zdd�ZdS)�MultipartResponseWrapperzzWrapper around the MultipartReader.

    It takes care about
    underlying connection and close it when it needs in.
    �respr5�streamr.rANc�"�||_||_dSrE)r�r�)�selfr�r�s   r=�__init__z!MultipartResponseWrapper.__init__�s��
��	�����r<c��|SrEr;�r�s r=�	__aiter__z"MultipartResponseWrapper.__aiter__�����r<)r.r0c��PK�|����d{V��}|�t�|SrE��next�StopAsyncIteration�r��parts  r=�	__anext__z"MultipartResponseWrapper.__anext__��7�����Y�Y�[�[� � � � � � ���<�$�$��r<c�>�|jj���S)z2Returns True when all response data had been read.)r��content�at_eofr�s r=r�zMultipartResponseWrapper.at_eof�s���y� �'�'�)�)�)r<c��K�|j����d{V��}|j���r|����d{V��|S)z#Emits next multipart reader object.N)r�r�r��release�r�rws  r=r�zMultipartResponseWrapper.next�sh�����[�%�%�'�'�'�'�'�'�'�'���;�����	!��,�,�.�.� � � � � � � ��r<c��HK�|j����d{V��dS)z_Release the connection gracefully.

        All remaining content is read to the void.
        N)r�r�r�s r=r�z MultipartResponseWrapper.release�s4����
�i���!�!�!�!�!�!�!�!�!�!�!r<)r�r5r�r.rAN)rAr��rAN)
r8r9r:�__doc__r�r�rr�rFr�r
r�r�r;r<r=r�r��s������������"��
�	���������	�2�	3�����*��*�*�*�*��	�%�;�<�	=�����"�"�"�"�"�"r<r�c��eZdZdZdZdedddeddfd	�Zdedfd
�Z	defd�Z
deefd�Zd
d�de
defd�Zefdedefd�Zdedefd�Zdedefd�Zdefd�Zd%d�Zdd�deedefd�Zdd�deedeeeeffd�Zdd�deedeeeeffd�Zde
fd�Zdedefd�Zdedefd�Zdedefd �Z d!edefd"�Z!e"deefd#���Z#e"deefd$���Z$dS)&r0z&Multipart reader for single body part.i �boundary�headers�CIMultiDictProxy[str]r�rANc��||_||_||_d|_|j�t
d��}|�t
|��nd|_d|_t��|_
d|_d|_i|_
dS)NFr)r��	_boundary�_content�_at_eof�getr�int�_length�_read_bytesr�_unread�_prev_chunk�_content_eof�_cache)r�r�r�r��lengths     r=r�zBodyPartReader.__init__s{�����!�����
������!�!�.�$�7�7��&,�&8�s�6�{�{�{�d������%*�W�W���,0������&(����r<c��|SrEr;r�s r=r�zBodyPartReader.__aiter__r�r<c��PK�|����d{V��}|�t�|SrEr�r�s  r=r�zBodyPartReader.__anext__s5�����Y�Y�[�[� � � � � � ���<�$�$��r<c��FK�|����d{V��}|sdS|SrE)�readr�s  r=r�zBodyPartReader.nexts7�����Y�Y�[�[� � � � � � ���	��4��r<F��decoder�c���K�|jrdSt��}|js:|�|�|j���d{V����|j�:|r|�|��S|S)z�Reads body part data.

        decode: Decodes data following by encoding
                method from Content-Encoding header. If it missed
                data remains untouched
        r<N)r��	bytearray�extend�
read_chunk�
chunk_sizer�)r�r��datas   r=r�zBodyPartReader.read s������<�	��3��{�{���,�	@��K�K�d�o�o�d�o�>�>�>�>�>�>�>�>�?�?�?��,�	@��	%��;�;�t�$�$�$��r<�sizec��lK�|jrdS|jr|�|���d{V��}n|�|���d{V��}|xjt|��z
c_|j|jkrd|_|jr/|j����d{V��}d|ks
Jd���|S)zWReads body part content chunk of the specified size.

        size: chunk size
        r<NT�
z3reader did not read all the data or it is malformed)r�r��_read_chunk_from_length�_read_chunk_from_streamr��lenr��readline)r�r��chunk�clrfs    r=r�zBodyPartReader.read_chunk0s�����
�<�	��3��<�	=��6�6�t�<�<�<�<�<�<�<�<�E�E��6�6�t�<�<�<�<�<�<�<�<�E����C��J�J�&�����t�|�+�+��D�L��<�	E���/�/�1�1�1�1�1�1�1�1�D��4����D� ����r<c��K�|j�
Jd���t||j|jz
��}|j�|���d{V��}|S)Nz(Content-Length required for chunked read)r��minr�r�r�)r�r�r�r�s    r=r�z&BodyPartReader._read_chunk_from_lengthFsd�����|�'�'�)S�'�'�'���t�|�d�.>�>�?�?�
��m�(�(��4�4�4�4�4�4�4�4���r<c
���K�|t|j��dzks
Jd���|jdu}|r%|j�|���d{V��|_|j�|���d{V��}|xjt
|j�����z
c_|jdks
Jd���|j�J�|j|z}d|jz}|r|�|��}nF|�|tdt|j��t|��z
����}|dkr�tj��5tjdt���|j�||d���ddd��n#1swxYwY||kr|jd|�|_|t|j��|�}|sd	|_|j}||_|S)
NrPz<Chunk size must be greater or equal than boundary length + 2�zReading after EOFr�r�ignore)�categoryT)r�r�r�r�r�r�r�r�rX�maxrm�catch_warnings�filterwarnings�DeprecationWarning�unread_datar�)r�r��first_chunkr��windowrb�idx�results        r=r�z&BodyPartReader._read_chunk_from_streamNsV����
�C���'�'�!�+�+�+�+�I�
,�+�+��&�$�.���	>�%)�]�%7�%7��%=�%=�=�=�=�=�=�=�D���m�(�(��.�.�.�.�.�.�.�.�����S���!5�!5�!7�!7�8�8�8���� �1�$�$�$�&9�$�$�$���+�+�+��!�E�)�����&���	M��+�+�c�"�"�C�C��+�+�c�3�q�#�d�.>�*?�*?�#�c�(�(�*J�#K�#K�L�L�C��!�8�8��(�*�*�
8�
8��'��;M�N�N�N�N��
�)�)�&����,�7�7�7�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8��c�z�z�#'�#3�D�S�D�#9�� ��3�t�/�0�0�3�6�7�E��
$�#����!�� ����
s�>F�F#�&F#c��6K�|jrdS|jr|j���}n|j����d{V��}|�|j��rV|�d��}|j}|jdz}||ks||kr#d|_|j�|��dSn]|j����d{V��}|�|j��r
|dd�}|j�|��|S)z Reads body part by line by line.r<Nr��--T���)	r�r��popleftr�r�r�r��rstripr�)r��line�sliner��
last_boundary�	next_lines      r=r�zBodyPartReader.readlineps8�����<�	��3��<�	2��<�'�'�)�)�D�D���/�/�1�1�1�1�1�1�1�1�D��?�?�4�>�*�*�	+��K�K��(�(�E��~�H� �N�U�2�M��� � �E�]�$:�$:�#�����#�#�D�)�)�)��s�%;�
#�m�4�4�6�6�6�6�6�6�6�6�I��#�#�D�N�3�3�
!��C�R�C�y���L���	�*�*�*��r<c��|K�|jrdS|js)|�|j���d{V��|j�'dSdS)z0Like read(), but reads all the data to the void.N)r�r�r�r�s r=r�zBodyPartReader.release�se�����<�	��F��,�	3��/�/�$�/�2�2�2�2�2�2�2�2�2��,�	3�	3�	3�	3�	3r<)rzrzc��K�|�d����d{V��}|p|�d���}|�|��S)z;Like read(), but assumes that body part contains text data.Tr�Nrf��default)r��get_charsetr��r�rzr�s   r=r_zBodyPartReader.text�sZ�����Y�Y�d�Y�+�+�+�+�+�+�+�+���@�t�/�/��/�@�@���{�{�8�$�$�$r<c��K�|�d����d{V��}|sdS|p|�d���}tttt
ft
j|�|������S)z<Like read(), but assumes that body parts contains JSON data.Tr�Nrfr�)	r�r�rr	rhr�json�loadsr�r�s   r=r�zBodyPartReader.json�s������Y�Y�d�Y�+�+�+�+�+�+�+�+���	��4��@�t�/�/��/�@�@���D��c��N�D�J�t�{�{�8�/D�/D�$E�$E�F�F�Fr<c��2K�|�d����d{V��}|sgS|�|}n|�d���}	|����|��}n #t$rtd|z���wxYwt
|d|���S)zFLike read(), but assumes that body parts contain form urlencoded data.Tr�Nrfr�z'data cannot be decoded with %s encoding)�keep_blank_valuesrz)r�r�r�r�rs�
ValueErrorr)r�rzr��
real_encoding�decoded_datas     r=�formzBodyPartReader.form�s������Y�Y�d�Y�+�+�+�+�+�+�+�+���	��I���$�M�M� �,�,�W�,�=�=�M�	X��;�;�=�=�/�/�
�>�>�L�L��!�	X�	X�	X��F��V�W�W�W�	X������"�"�
�
�
�	
s�'A'�'Bc��|jS)z<Returns True if the boundary was reached or False otherwise.�r�r�s r=r�zBodyPartReader.at_eof��
���|�r<r�c��t|jvr|�|��}t|jvr|�|��S|S)z�Decodes data.

        Decoding is done according the specified Content-Encoding
        or Content-Transfer-Encoding headers value.
        )rr��_decode_content_transferr�_decode_content)r�r�s  r=r�zBodyPartReader.decode�sJ��%���4�4��0�0��6�6�D��t�|�+�+��'�'��-�-�-��r<c���|j�td�����}|dkr|S|dvr$t	|d����|��St
d|�����)Nr]�identity>�gzip�deflateT)rz�suppress_deflate_header�unknown content encoding: )r�r�rrpr�decompress_sync�RuntimeError�r�r�rzs   r=r�zBodyPartReader._decode_content�s����<�#�#�$4�b�9�9�?�?�A�A���z�!�!��K��*�*�*�#�!�(,�����o�d�#�#�
$�
�B��B�B�C�C�Cr<c��|j�td�����}|dkrt	j|��S|dkrt
j|��S|dvr|Std�	|�����)Nr]�base64�quoted-printable)�binary�8bit�7bit�%unknown content transfer encoding: {})
r�r�rrpr�	b64decode�binascii�a2b_qpr�formatrs   r=r�z'BodyPartReader._decode_content_transfer�s����<�#�#�$=�r�B�B�H�H�J�J���x����#�D�)�)�)�
�+�
+�
+��?�4�(�(�(�
�3�
3�
3��K��:�A�A�(�K�K���
r<r�c��|j�td��}t|��}|j�d|��S)z>Returns charset parameter from Content-Type header or default.r]�charset)r�r�r r#�
parameters)r�r��ctype�mimetypes    r=r�zBodyPartReader.get_charset�s?���� � ��r�2�2��!�%�(�(���"�&�&�y�'�:�:�:r<c��t|j�t����\}}t	|d��S)z|Returns name specified in Content-Disposition header.

        If the header is missing or malformed, returns None.
        r�r3r�r�rr4�r�r{rvs   r=rzBodyPartReader.name�s6��.�d�l�.>�.>�?R�.S�.S�T�T�	��6�+�F�F�;�;�;r<c��t|j�t����\}}t	|d��S)zReturns filename specified in Content-Disposition header.

        Returns None if the header is missing or malformed.
        r~rrs   r=r~zBodyPartReader.filename�s6��.�d�l�.>�.>�?R�.S�.S�T�T�	��6�+�F�J�?�?�?r<r�)%r8r9r:r�r��bytesr-r�rr�r�r
r�rFr�r�r�r�r�r�r�rhr_r	rr�rrr�r�r�r�r�r�r$rr~r;r<r=r0r0�sG������0�0��J�
)��
)�(?�
)�JV�
)�	
�
)�
)�
)�
)��=�)9�:������������H�U�O�����,1����D��U����� ,6���S��%�����,�#��%����� �#� �%� � � � �D������:3�3�3�3�7;�%�%�%�h�s�m�%�s�%�%�%�%�7;�G�G�G�h�s�m�G�x��S�RU�X��?W�G�G�G�G�7;�
�
�
�h�s�m�
�t�E�#�s�(�O�?T�
�
�
�
�(������
�5�
�U�
�
�
�
�
D�E�
D�e�
D�
D�
D�
D��U��u�����;�3�;�3�;�;�;�;��<�h�s�m�<�<�<��U�<��@�(�3�-�@�@�@��U�@�@�@r<r0)�orderc�@��eZdZdedededdf�fd�Zdeddfd�Z�xZS)	�BodyPartReaderPayloadry�args�kwargsrANc���t��j|g|�Ri|��i}|j�
|j|d<|j�
|j|d<|r|jdi|��dSdS)Nrr~�
attachmentT)r T)�superr�rr~�set_content_disposition)r�ryrrrv�	__class__s     �r=r�zBodyPartReaderPayload.__init__�s����������0��0�0�0��0�0�0�!#���:�!�"�Z�F�6�N��>�%�!&��F�:���	G�(�D�(�F�F�v�F�F�F�F�F�	G�	Gr<�writerc���K�|j}|�d����d{V��}|rN|�|�|�����d{V��|�d����d{V��}|�LdSdS)Ni)r�)r}r��writer�)r�r$�fieldr�s    r=r&zBodyPartReaderPayload.write	s���������&�&�E�&�2�2�2�2�2�2�2�2���	7��,�,�u�|�|�E�2�2�3�3�3�3�3�3�3�3�3��*�*��*�6�6�6�6�6�6�6�6�E��	7�	7�	7�	7�	7r<)r8r9r:r0rr�r&�
__classcell__�r#s@r=rr�s��������
G�n�
G�S�
G�C�
G�D�
G�
G�
G�
G�
G�
G�7�#�7�$�7�7�7�7�7�7�7�7r<rc�R�eZdZdZeZdZeZde	e
e
fdeddfd�Zde
dfd�Zdeedeffd	�Zed
ddefd���Zdefd
�Zdeedeffd�Zdd�Zdedeffd�Zdddedeffd�Zde
fd�Zdefd�Zdd�Zdd�Zdd�Zdd�Z dS)r.zMultipart body reader.Nr�r�rAc��||_d|���z���|_||_d|_d|_d|_g|_dS)Nz--FT)	r��
_get_boundary�encoder�r��
_last_partr��_at_bofr�)r�r�r�s   r=r�zMultipartReader.__init__sT�������!3�!3�!5�!5�5�=�=�?�?�����
�NR���������$&����r<r0c��|SrEr;r�s r=r�zMultipartReader.__aiter__%s	���r<c��PK�|����d{V��}|�t�|SrEr�r�s  r=r�zMultipartReader.__anext__*r�r<�responser5c�Z�|�|||j|j����}|S)z�Constructs reader instance from HTTP response.

        :param response: :class:`~aiohttp.client.ClientResponse` instance
        )�response_wrapper_clsr�r�)�clsr2�objs   r=�
from_responsezMultipartReader.from_response2s7���&�&��c�c�(�*�H�,<�=�=�
�
���
r<c��|jS)z@Returns True if the final boundary was reached, false otherwise.r�r�s r=r�zMultipartReader.at_eof@r�r<c��0K�|jrdS|����d{V��|jr"|����d{V��d|_n|����d{V��|jrdS|����d{V��|_|jS)z#Emits the next multipart body part.NF)r��_maybe_release_last_partr/�_read_until_first_boundary�_read_boundary�fetch_next_partr.r�s r=r�zMultipartReader.nextDs�����
�<�	��4��+�+�-�-�-�-�-�-�-�-�-��<�	(��1�1�3�3�3�3�3�3�3�3�3� �D�L�L��%�%�'�'�'�'�'�'�'�'�'��<�	��4� $� 4� 4� 6� 6�6�6�6�6�6�6�����r<c��K�|jsA|����d{V��}|�dS|����d{V��|j�?dSdS)z=Reads all the body parts to the void till the final boundary.N)r�r�r�r�s  r=r�zMultipartReader.releaseVsy�����,�	!������$�$�$�$�$�$�D��|����,�,�.�.� � � � � � � �	�,�	!�	!�	!�	!�	!r<c��dK�|����d{V��}|�|��S)z"Returns the next body part reader.N)�
_read_headers�_get_part_reader)r�r�s  r=r=zMultipartReader.fetch_next_part^s?�����*�*�,�,�,�,�,�,�,�,���$�$�W�-�-�-r<r�c�.�|�td��}t|��}|jdkr@|j�t|��||j��S|�||j��S|�|j||j��S)z�Dispatches the response by the `Content-Type` header.

        Returns a suitable reader instance.

        :param dict headers: Response headers
        r]�	multipart)r�r r#�type�multipart_reader_clsr��part_reader_clsr�)r�r�rrs    r=rAz MultipartReader._get_part_readeres������L�"�-�-��!�%�(�(���=�K�'�'��(�0�!�t�D�z�z�'�4�=�9�9�9��,�,�W�d�m�D�D�D��'�'������O�O�Or<c�(�t|jt��}|jdks
Jd���d|jvr"td|jtz���|jd}t
|��dkrtd|z���|S)NrCz!multipart/* content type expectedr�z$boundary missed for Content-Type: %s�Fz&boundary %r is too long (70 chars max))r#r�r rDrr�r�)r�rr�s   r=r,zMultipartReader._get_boundaryys���!�$�,�|�"<�=�=���}��+�+�+�-P�+�+�+��X�0�0�0��6���l�9S�S���
��&�z�2���x�=�=�2����E��P�Q�Q�Q��r<c��K�|jr|j���S|j����d{V��SrE)r�ror�r�r�s r=�	_readlinezMultipartReader._readline�sJ�����<�	&��<�#�#�%�%�%��]�+�+�-�-�-�-�-�-�-�-�-r<c���K�	|����d{V��}|dkrtd|jz���|���}||jkrdS||jdzkr	d|_dS�p)NTr<z#Could not find starting boundary %rr�)rJr�r�r�r��r�r�s  r=r;z*MultipartReader._read_until_first_boundary�s�����	��.�.�*�*�*�*�*�*�*�*�E���|�|� �9�T�^�L�����L�L�N�N�E����&�&����$�.�5�0�0�0�#�����	r<c���K�|����d{V�����}||jkrdS||jdzkr�d|_|����d{V��}|����d{V��}|dd�dkr|j�|��dS|j�||g��dStd|�d|j�����)Nr�TrPzInvalid boundary z, expected )rJr�r�r�r�r�r�r�)r�r��epiloguer�s    r=r<zMultipartReader._read_boundary�s�����~�~�'�'�'�'�'�'�'�'�/�/�1�1���D�N�"�"��D�
�d�n�u�,�
,�
,��D�L�!�^�^�-�-�-�-�-�-�-�-�H�"�n�n�.�.�.�.�.�.�.�.�I���!��}��%�%���#�#�I�.�.�.�.�.�
��#�#�Y��$9�:�:�:�:�:��W��W�W�T�^�W�W�X�X�Xr<c��K�dg}	|j����d{V��}|���}|�|��|sn�Lt	��}|�|��\}}|S)Nr<)r�r�rqr�r%�
parse_headers)r��linesr��parserr��raw_headerss      r=r@zMultipartReader._read_headers�s��������	��-�0�0�2�2�2�2�2�2�2�2�E��K�K�M�M�E��L�L������
��	�����%�3�3�E�:�:�����r<c���K�|j�e|j���s|j����d{V��|j�|jj��d|_dSdS)z8Ensures that the last read body part is read completely.N)r.r�r�r�r�r�s r=r:z(MultipartReader._maybe_release_last_part�sx�����?�&��?�)�)�+�+�
0��o�-�-�/�/�/�/�/�/�/�/�/��L����� 7�8�8�8�"�D�O�O�O�	'�&r<r�)rAr�)!r8r9r:r�r�r4rEr0rFrrhr-r�rr�r
rr��classmethodr7rFr�r�r�r=rAr,rrJr;r<r@r:r;r<r=r.r.s$������ � �4�� ��$�O�'���S�� 1�'�L�'�T�'�'�'�'��	�'�	(�����
�	�%�)�>�9�:�	;�������"��
"�����[���������	�%�)�>�9�:�	;�����$!�!�!�!�.�	� �.�0�	1�.�.�.�.�P�(�P�
� �.�0�	1�P�P�P�P�(�s����� .��.�.�.�.�
����Y�Y�Y�Y�.
�
�
�
�#�#�#�#�#�#r<r.c�N��eZdZdZd dedeeddf�fd�
Zd!d�Zd	eee	d
ee	dee
ddfd�Zdee
fd
�Zdefd�Zdefd�Zejd��Zejd��Zedefd���Zedefd���Zd"dedeeedefd�Zdedefd�Z	d"dedeeedefd�Z	d"de e!e"eefe#eeffdeeedefd�Z$edeefd���Z%d#dededdfd�Z&�xZ'S)$r/zMultipart body writer.�mixedN�subtyper�rAc�"��|�|ntj��j}	|�d��|_n#t
$rt
d��d�wxYwd|�d|j��}t���	d|���g|_
dS)N�asciiz(boundary should contain ASCII only charsz
multipart/z; boundary=)�content_type)�uuid�uuid4�hexr-r��UnicodeEncodeErrorr��_boundary_valuer!r��_parts)r�rXr�rr#s    �r=r�zMultipartWriter.__init__�s����'�3�8�8�����9I��	S�%�_�_�W�5�5�D�N�N��!�	S�	S�	S��G�H�H�d�R�	S����G�W�G�G��1E�G�G��
������E��2�2�2�#%����s	�:�Ac��|SrEr;r�s r=�	__enter__zMultipartWriter.__enter__�r�r<�exc_type�exc_val�exc_tbc��dSrEr;)r�rdrerfs    r=�__exit__zMultipartWriter.__exit__�s	��	
�r<c�*�t|j��SrE)�iterrar�s r=�__iter__zMultipartWriter.__iter__�s���D�K� � � r<c�*�t|j��SrE)r�rar�s r=�__len__zMultipartWriter.__len__�s���4�;���r<c��dS)NTr;r�s r=�__bool__zMultipartWriter.__bool__�s���tr<s\A[!#$%&'*+\-.^_`|~\w]+\Zs[\x00-\x08\x0A-\x1F\x7F]c�N�|j}tj|j|��r|�d��Stj|j|��rtd���|�dd��}|�dd��}d|�d��zdzS)zzWrap boundary parameter value in quotes, if necessary.

        Reads self.boundary and returns a unicode string.
        rZz*boundary value contains invalid characters�\s\\�"s\"rL)	r�ra�match�_valid_tchar_regexr��search�_invalid_qdtext_char_regexr��replace)r�ry�quoted_value_contents   r=r`zMultipartWriter._boundary_value�s���&���
�8�D�+�U�3�3�	)��<�<��(�(�(�
�9�T�4�e�<�<�	K��I�J�J�J� %�}�}�U�G�<�<��3�;�;�D�&�I�I���)�0�0��9�9�9�C�?�?r<c�6�|j�d��S)NrZ)r�r�r�s r=r�zMultipartWriter.boundarys���~�$�$�W�-�-�-r<r6r�c�8�|�t��}t|t��r/|j�|��|�|��S	t
||���}|�|��S#t$rtd|z���wxYw)N�r�zCannot create payload from %r)	r�
isinstancer)r��update�append_payloadr+r'�	TypeError)r�r6r��payloads    r=r�zMultipartWriter.appends����?�!�m�m�G��c�7�#�#�		4��K���w�'�'�'��&�&�s�+�+�+�
4�%�c�7�;�;�;���*�*�7�3�3�3���
G�
G�
G�� ?�#� E�F�F�F�
G���s�A<�<Br�c��|j�td�����}|r|dvrt	d|�����|dkrd}|j�t
d�����}|dvr"t	d�|�����|dkrd}|j}|� |s|st|��|jt<|j
�|||f��|S)	z)Adds a new body part to multipart writer.r])r�r�r�rr�N)r]rrrrr)r�r�rrprrrr�rhrrar�)r�r�rz�te_encodingr�s     r=r~zMultipartWriter.append_payload)s)��#*�/�"5�"5���#
�#
��%�'�'�	��	H��(G�G�G��F�H�F�F�G�G�G��z�!�!��H�&-�_�%8�%8�%��&
�&
��%�'�'�	��J�J�J��:�A�A�+�N�N���
��(�"�"��K��|����X����.1�$�i�i�G�O�N�+�����G�X�{�;�<�<�<��r<c�j�|�t��}|�t||�����S)zHelper to append JSON part.Nr{)rr~r&)r�r6r�s   r=�append_jsonzMultipartWriter.append_jsonIs3���?�!�m�m�G��"�"�;�s�G�#D�#D�#D�E�E�Er<c�6�t|ttf��sJ�|�t��}t|t��r!t	|�����}t
|d���}|�t||d�����S)z&Helper to append form urlencoded part.NT)�doseqz!application/x-www-form-urlencoded)r�r[)	r|rrr�listr�rr~r*)r�r6r�r�s    r=�append_formzMultipartWriter.append_formRs����#��'�2�3�3�3�3�3��?�!�m�m�G��c�7�#�#�	$��s�y�y�{�{�#�#�C���D�)�)�)���"�"���g�4W�
�
�
�
�
�	
r<c��d}|jD]^\}}}|s	|s|j�dS|tdt|j��zdz|jzt|j��zdz��z
}�_|dt|j��zdzz
}|S)zSize of the payload.rNrP�)rar�r�r�r��_binary_headers)r��totalr�rzr�s     r=r�zMultipartWriter.sizegs�����+/�;�	�	�'�D�(�K��
�;�
�$�)�*;��t�t��S���d�n�%�%�&����)���d�*�+�+�	,�
����
�E�E�	��S���(�(�(�1�,�,���r<Tr$�close_boundaryc��`K�|jD]�\}}}|�d|jzdz���d{V��|�|j���d{V��|s|rst	|��}|r|�|��|r|�|��|�|���d{V��|����d{V��n|�|���d{V��|�d���d{V����|r(|�d|jzdz���d{V��dSdS)zWrite body.r�r�Ns--
)rar&r�r��MultipartPayloadWriter�enable_compression�enable_encoding�	write_eof)r�r$r�r�rzr��ws       r=r&zMultipartWriter.write{s�����+/�;�	(�	(�'�D�(�K��,�,�u�t�~�5��?�@�@�@�@�@�@�@�@�@��,�,�t�3�4�4�4�4�4�4�4�4�4��	
)�;�	
)�*�6�2�2���3��(�(��2�2�2��3��%�%�k�2�2�2��j�j��m�m�#�#�#�#�#�#�#��k�k�m�m�#�#�#�#�#�#�#�#��j�j��(�(�(�(�(�(�(�(�(��,�,�w�'�'�'�'�'�'�'�'�'�'��	C��,�,�u�t�~�5�	�A�B�B�B�B�B�B�B�B�B�B�B�	C�	Cr<)rWN)rAr/rE)T)(r8r9r:r�rhr
r�rcr�
BaseExceptionrrhr
�_Partrkr�rmrFrora�compilertrv�propertyr`r�rrr)r�r~r�rrrrr�r�r&r(r)s@r=r/r/�s������� � �&�&��&��#��&�RV�&�&�&�&�&�&�"����
��4�
�.�/�
��-�(�
���'�	
�

�
�
�
�
�!�(�5�/�!�!�!�!� �� � � � ��$�����$���$A�B�B��!+���,H�!I�!I��
�@��@�@�@��X�@�>�.�#�.�.�.��X�.�
4�
4�#�
4���c�1B�(C�
4�w�
4�
4�
4�
4��g��'�����B@D�F�F��F�!)�,�s�*;�!<�F�	�F�F�F�F�04�
�
�
�8�E�#�s�(�O�,�g�c�3�h�.?�?�
@�
��,�s�+�,�
�
�	
�
�
�
�*��h�s�m�����X��&C�C�#�C�t�C�t�C�C�C�C�C�C�C�Cr<r/c�j�eZdZdeddfd�Zdeddfd�Zdejfdede	ddfd	�Z
d
d
�Zdeddfd�Z
dS)r�r$rANc�>�||_d|_d|_d|_dSrE)�_writer�	_encoding�	_compress�_encoding_buffer)r�r$s  r=r�zMultipartPayloadWriter.__init__�s%�����(,���37���59����r<rzc�h�|dkr||_t��|_dS|dkr	d|_dSdS)Nrr)r�r�r�)r�rzs  r=r�z&MultipartPayloadWriter.enable_encoding�sE���x���%�D�N�$-�K�K�D�!�!�!�
�+�
+�
+�/�D�N�N�N�,�
+r<r��strategyc�4�t|d|���|_dS)NT)rzrr�)rr�)r�rzr�s   r=r�z)MultipartPayloadWriter.enable_compression�s'��(��$(��
�
�
����r<c��,K�|j�=|j���}|r"d|_|�|���d{V��|jdkr@|jr;|j�t
j|j�����d{V��dSdSdS)Nr)r��flushr&r�r�r�r�	b64encoderLs  r=r�z MultipartPayloadWriter.write_eof�s������>�%��N�(�(�*�*�E��
(�!%����j�j��'�'�'�'�'�'�'�'�'��>�X�%�%��$�
R��l�(�(��)9�$�:O�)P�)P�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�&�%�
R�
Rr<r�c��tK�|j�&|r$|j�|���d{V��}|sdS|jdkr�|j}|�J�|�|��|rxtt
|��d��\}}|d|dz�||dzd�c}|_|r8tj|��}|j	�
|���d{V��dSdSdS|jdkr4|j	�
tj|�����d{V��dS|j	�
|���d{V��dS)Nrr�r)
r��compressr�r�r��divmodr�rr�r�r&r
�b2a_qp)r�r��buf�div�mod�	enc_chunk�b64chunks       r=r&zMultipartPayloadWriter.write�s������>�%��
�"�n�5�5�e�<�<�<�<�<�<�<�<�����F��>�X�%�%��'�C��?�?�?��J�J�u�����
7�!�#�c�(�(�A�.�.���S�47�	�#��'�	�N�C��a��	�	�N�0�	�4�0��7�%�/�	�:�:�H��,�,�,�X�6�6�6�6�6�6�6�6�6�6�6�
7�
7�7�7��^�1�
1�
1��,�$�$�X�_�U�%;�%;�<�<�<�<�<�<�<�<�<�<�<��,�$�$�U�+�+�+�+�+�+�+�+�+�+�+r<r�)r8r9r:rr�rhr��zlib�Z_DEFAULT_STRATEGYr�r�r�rr&r;r<r=r�r��s�������:�s�:�t�:�:�:�:�0��0��0�0�0�0�(��9P�
�
��
�36�
�	
�
�
�
�
�	R�	R�	R�	R�,��,�4�,�,�,�,�,�,r<r�)r~)Mrr
r�rar\rmr��collectionsr�typesr�typingrrrrr	r
rrr
rrrrr�urllib.parserrr�	multidictrrr�compression_utilsrr�hdrsrrrrr �helpersr!r"r#r$�httpr%r�r&r'r(r)r*r+r,�streamsr-�__all__�
client_reqrepr5�RuntimeWarningr1r2rhr3r4r�r0�	try_firstrr.r�r/r�r;r<r=�<module>r�s���
�
�
�
���������	�	�	�	��������������������������������������������������������� 7�6�6�6�6�6�6�6�6�6�A�A�A�A�A�A�A�A�A�A�?�?�?�?�?�?�?�?���������������8�7�7�7�7�7�7�7�7�7�7�7�������������������������"�!�!�!�!�!����.�-�-�-�-�-�-�	�	�	�	�	�.�	�	�	�	�	�	�	�	��	�	�	�`$��S�M�`$�
�8�C�=�$�s�C�x�.�(�)�`$�`$�`$�`$�H,6����C��H���%(��
�c�]�����B,"�,"�,"�,"�,"�,"�,"�,"�^{@�{@�{@�{@�{@�{@�{@�{@�|��n�E�O�4�4�4�7�7�7�7�7�G�7�7�5�4�7�*t#�t#�t#�t#�t#�t#�t#�t#�n	�g�s�C�� ��DC�DC�DC�DC�DC�g�DC�DC�DC�N7,�7,�7,�7,�7,�7,�7,�7,�7,�7,r<

Zerion Mini Shell 1.0