ok

Mini Shell

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

�

m��f9~����ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZddlmZmZmZddlmZm Z m!Z!ddl"m#Z#m$Z$m%Z%m&Z&m'Z'dd	l(m)Z)m*Z*m+Z+m,Z,dd
l-m.Z.ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8d
Z9erddl:m;Z;Gd�de<��Z=Gd�de<��Z>dee?deee?ee?e?fffd�Z@	d'dee?e?fde?dee?fd�ZAGd�d��ZBGd�d��ZCe6eCe2jD���Gd�d e3����ZEGd!�d"��ZFee3e?e?fZGGd#�d$e3��ZHGd%�d&��ZIdS)(�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�)�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)r/N��__name__�
__module__�__qualname__���H/opt/imunify360/venv/lib64/python3.11/site-packages/aiohttp/multipart.pyr/r/A��������Dr:r/c��eZdZdS)r0Nr5r9r:r;r0r0Er<r:r0�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�stringr?c�P�t|��ott|��kS�N)�boolr �set�rAs r;�is_tokenz+parse_content_disposition.<locals>.is_tokenLs���F�|�|�4���V��� 4�4r:c�:�|d|dcxkodkncS)Nr����"r9rFs r;�	is_quotedz,parse_content_disposition.<locals>.is_quotedOs,���a�y�F�2�J�-�-�-�-�#�-�-�-�-�-r:c�L���|��o|�d��dkS)N�'�)�count)rArGs �r;�
is_rfc5987z-parse_content_disposition.<locals>.is_rfc5987Rs)����x����:�F�L�L��$5�$5��$:�:r:c�,�|�d��S)N�*)�endswithrFs r;�is_extended_paramz4parse_content_disposition.<locals>.is_extended_paramUs�����s�#�#�#r:c��|�d��dz}|sdS|�d��r
||d�n	||d�}|���S)NrRrFrI)�findrS�isdigit)rA�pos�	substrings   r;�is_continuous_paramz6parse_content_disposition.<locals>.is_continuous_paramXsa���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�=rrIrMrN�utf-8�strictTFz\/)�strrD�join�mapr_�escaper�split�warnings�warnr/�pop�lower�strip�lstripr0r�UnicodeDecodeError)r>rKrPrTrZra�disptype�parts�params�item�key�value�encoding�_�failed�_valuerGs                @r;r1r1Is����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�filenamert�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��!dSrC)�
startswith)�.0rvrw�name_sufs   �r;�	<genexpr>z/content_disposition_filename.<locals>.<genexpr>�sP�����
�
�'�S�%�S�^�^�H�=U�=U�
�
�%�L�
�
�
�
�
�
r:rRrrIr[rMrNrdre)	�sorted�items�	enumeraterjrSrf�appendrgr)rtr}rs�fnparams�numrvrwry�tailrxr�s          @r;r2r2�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.
    �respr3�streamr,r?Nc�"�||_||_dSrC)r�r�)�selfr�r�s   r;�__init__z!MultipartResponseWrapper.__init__�s��
��	�����r:c��|SrCr9�r�s r;�	__aiter__z"MultipartResponseWrapper.__aiter__�����r:)r,r.c��PK�|����d{V��}|�t�|SrC��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�rus  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�r3r�r,r?N)r?r��r?N)
r6r7r8�__doc__r�r�rr�rDr�r
r�r�r9r: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)&r.z&Multipart reader for single body part.i �boundary�headers�CIMultiDictProxy[str]r�r?Nc��||_||_||_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��|SrCr9r�s r;r�zBodyPartReader.__aiter__r�r:c��PK�|����d{V��}|�t�|SrCr�r�s  r;r�zBodyPartReader.__anext__s5�����Y�Y�[�[� � � � � � ���<�$�$��r:c��FK�|����d{V��}|sdS|SrC)�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)
NrNz<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�rV�maxrk�catch_warnings�filterwarnings�DeprecationWarning�unread_datar�)r�r��first_chunkr��windowr`�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:)rxrxc��K�|�d����d{V��}|p|�d���}|�|��S)z;Like read(), but assumes that body part contains text data.Tr�Nrd��default)r��get_charsetr��r�rxr�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�Nrdr�)	r�r�rr	rfr�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���K�|�d����d{V��}|sgS|�|}n|�d���}t|����|��d|���S)zFLike read(), but assumes that body parts contain form urlencoded data.Tr�Nrdr�)�keep_blank_valuesrx)r�r�rr�r�)r�rxr��
real_encodings    r;�formzBodyPartReader.form�s������Y�Y�d�Y�+�+�+�+�+�+�+�+���	��I���$�M�M� �,�,�W�,�=�=�M���K�K�M�M� � ��/�/�"�"�
�
�
�	
r:c��|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�6�|j�td�����}|dkr t	j|tj��S|dkr"t	j|dtjz��S|dkr|Std|�����)Nr[�deflate�gzip��identity�unknown content encoding: )r�r�rrn�zlib�
decompress�	MAX_WBITS�RuntimeError�r�r�rxs   r;r�zBodyPartReader._decode_content�s����<�#�#�$4�b�9�9�?�?�A�A���y� � ��?�4�$�.��9�9�9�
��
�
��?�4��d�n�)<�=�=�=�
��
#�
#��K��F�H�F�F�G�G�Gr:c��|j�td�����}|dkrt	j|��S|dkrt
j|��S|dvr|Std�	|�����)Nr[�base64�quoted-printable)�binary�8bit�7bit�%unknown content transfer encoding: {})
r�r�rrnr�	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�rr!�
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}�r1r�r�rr2�r�ryrts   r;r}zBodyPartReader.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�)%r6r7r8r�r��bytesr+r�rr�r�r
r�rDr�r�r�r�r�r�r�rfr]r	rr�rrr�r�r�r�r�r�r"r}r|r9r:r;r.r.�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�
�
�
�
�
H�E�
H�e�
H�
H�
H�
H��U��u�����;�3�;�3�;�;�;�;��<�h�s�m�<�<�<��U�<��@�(�3�-�@�@�@��U�@�@�@r:r.)�orderc�@��eZdZdedededdf�fd�Zdeddfd�Z�xZS)	�BodyPartReaderPayloadrw�args�kwargsr?Nc���t��j|g|�Ri|��i}|j�
|j|d<|j�
|j|d<|r|jdi|��dSdS)Nr}r|�
attachmentT)rT)�superr�r}r|�set_content_disposition)r�rwrrrt�	__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.writes���������&�&�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:)r6r7r8r.rr�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�r?c��||_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:r.c��|SrCr9r�s r;r�zMultipartReader.__aiter__ s	���r:c��PK�|����d{V��}|�t�|SrCr�r�s  r;r�zMultipartReader.__anext__%r�r:�responser3c�Z�|�|||j|j����}|S)z�Constructs reader instance from HTTP response.

        :param response: :class:`~aiohttp.client.ClientResponse` instance
        )�response_wrapper_clsr�r�)�clsr0�objs   r;�
from_responsezMultipartReader.from_response-s7���&�&��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.next?s�����
�<�	��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.releaseQsy�����,�	!������$�$�$�$�$�$�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_partYs?�����*�*�,�,�,�,�,�,�,�,���$�$�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�rr!�type�multipart_reader_clsr��part_reader_clsr�)r�r�rrs    r;r?z MultipartReader._get_part_reader`s������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)NrAz!multipart/* content type expectedr�z$boundary missed for Content-Type: %s�Fz&boundary %r is too long (70 chars max))r!r�rrBr�
ValueErrorr�)r�rr�s   r;r*zMultipartReader._get_boundaryts���!�$�,�|�"<�=�=���}��+�+�+�-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��SrC)r�rmr�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�)rIrGr�r�r��r�r�s  r;r9z*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�TrNzInvalid boundary z, expected )rIr�r�r�r�r�r�rG)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�ror�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;r8z(MultipartReader._maybe_release_last_part�sx�����?�&��?�)�)�+�+�
0��o�-�-�/�/�/�/�/�/�/�/�/��L����� 7�8�8�8�"�D�O�O�O�	'�&r:r�)r?r�)!r6r7r8r�r�r2rCr.rDrrfr+r�rr�r
rr��classmethodr5rDr�r�r�r;r?r*rrIr9r:r>r8r9r: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�r?c�"��|�|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��UnicodeEncodeErrorrG�_boundary_valuerr��_parts)r�rWr�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��|SrCr9r�s r;�	__enter__zMultipartWriter.__enter__�r�r:�exc_type�exc_val�exc_tbc��dSrCr9)r�rcrdres    r;�__exit__zMultipartWriter.__exit__�s	��	
�r:c�*�t|j��SrC)�iterr`r�s r;�__iter__zMultipartWriter.__iter__�s���D�K� � � r:c�*�t|j��SrC)r�r`r�s r;�__len__zMultipartWriter.__len__�s���4�;���r:c��dS)NTr9r�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)zyWrap boundary parameter value in quotes, if necessary.

        Reads self.boundary and returns a unicode sting.
        rYz*boundary value contains invalid characters�\s\\�"s\"rJ)	r�r_�match�_valid_tchar_regexr��search�_invalid_qdtext_char_regexrG�replace)r�rw�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)NrY)r�r�r�s r;r�zMultipartWriter.boundarys���~�$�$�W�-�-�-r:r4r�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�r4r��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<�<Brc��|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�r�r�N)r[rrrr	r)r�r�rrnrrr
r�rfrr`r�)r�rrx�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.Nrz)rr}r$)r�r4r�s   r;�append_jsonzMultipartWriter.append_jsonDs3���?�!�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�rZ)	r{rrr�listr�rr}r()r�r4r�r�s    r;�append_formzMultipartWriter.append_formMs����#��'�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.rNrN�)r`r�r�r�r��_binary_headers)r��totalr�rxr�s     r;r�zMultipartWriter.sizebs�����+/�;�	�	�'�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--
)r`r$r�r��MultipartPayloadWriter�enable_compression�enable_encoding�	write_eof)r�r"r�r�rxr��ws       r;r$zMultipartWriter.writevs�����+/�;�	(�	(�'�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:)rVN)r?r-rC)T)(r6r7r8r�rfr
r�rbr�
BaseExceptionrrgr
�_Partrjr�rlrDrnr_�compilersru�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"r?Nc�>�||_d|_d|_d|_dSrC)�_writer�	_encoding�	_compress�_encoding_buffer)r�r"s  r;r�zMultipartPayloadWriter.__init__�s%�����(,���"���59����r:rxc�h�|dkr||_t��|_dS|dkr	d|_dSdS)Nrr)r�r�r�)r�rxs  r;r�z&MultipartPayloadWriter.enable_encoding�sE���x���%�D�N�$-�K�K�D�!�!�!�
�+�
+�
+�/�D�N�N�N�,�
+r:r��strategyc��|dkrdtjzntj}tj||���|_dS)Nr�r�)�wbitsr�)r�r�compressobjr�)r�rxr��	zlib_modes    r;r�z)MultipartPayloadWriter.enable_compression�s>��,4�v�+=�+=�B���'�'�D�N�?�	��)�	�H�M�M�M����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�	b64encoderKs  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��hK�|j� |r|j�|��}|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������>�%��
���/�/��6�6�����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�)r6r7r8rr�rfr�r��Z_DEFAULT_STRATEGYr�r�r�rr$r9r:r;r�r��s�������:�s�:�t�:�:�:�:�0��0��0�0�0�0�(��9P�N�N��N�36�N�	
�N�N�N�N�	R�	R�	R�	R�,��,�4�,�,�,�,�,�,r:r�)r|)Jrrr�r_r[rkr��collectionsr�typesr�typingrrrrr	r
rrr
rrrrr�urllib.parserrr�	multidictrrr�hdrsrrrrr�helpersrr r!r"�httpr#rr$r%r&r'r(r)r*�streamsr+�__all__�
client_reqrepr3�RuntimeWarningr/r0rfr1r2r�r.�	try_firstrr,r�r-r�r9r: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,"�,"�,"�,"�,"�,"�,"�,"�^w@�w@�w@�w@�w@�w@�w@�w@�t��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�N4,�4,�4,�4,�4,�4,�4,�4,�4,�4,r:

Zerion Mini Shell 1.0