Hacked By AnonymousFox

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

�

�܋f����ddlZddlmZmZmZmZddlmZddlm	Z	m
Z
ddlmZm
Z
mZddlmZddlmZd	ZGd
�d��ZdS)�N)�Any�Iterable�List�Optional)�	urlencode)�	MultiDict�MultiDictProxy�)�hdrs�	multipart�payload)�guess_filename)�Payload)�FormDatac
��eZdZdZ			ddeededeeddfd	�Z	e
defd
���Zdddd�ded
edeedeedeeddfd�Zdeddfd�Z
dejfd�Zdejfd�Zdefd�ZdS)rztHelper class for form body generation.

    Supports multipart/form-data and application/x-www-form-urlencoded.
    �TN�fields�quote_fields�charset�returnc�>�tjd��|_g|_d|_d|_||_||_t|t��r"t|�����}nt|ttf��s|f}|j
|�dS)N�	form-dataF)r�MultipartWriter�_writer�_fields�
_is_multipart�
_is_processed�
_quote_fields�_charset�
isinstance�dict�list�items�tuple�
add_fields)�selfrrrs    �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/formdata.py�__init__zFormData.__init__s���!�0��=�=���"$���"���"���)�����
��f�d�#�#�	��&�,�,�.�.�)�)�F�F��F�T�5�M�2�2�	��Y�F����� � � � �c��|jS�N)r�r&s r'�is_multipartzFormData.is_multipart's���!�!r))�content_type�filename�content_transfer_encoding�name�valuer.r/r0c��t|tj��rd|_n(t|tt
tf��r|�|�|}td|i��}|�'t|t��std|z���|�*t|tj��rt||��}|�||d<d|_i}|�=t|t��std|z���||tj<d|_|�=t|t��std|z���||tj
<d|_|j�|||f��dS)NTr1z,filename must be an instance of str. Got: %sr/z0content_type must be an instance of str. Got: %sz=content_transfer_encoding must be an instance of str. Got: %s)r �io�IOBaser�bytes�	bytearray�
memoryviewr�str�	TypeErrorrr�CONTENT_TYPE�CONTENT_TRANSFER_ENCODINGr�append)r&r1r2r.r/r0�type_options�headerss        r'�	add_fieldzFormData.add_field+s����e�R�Y�'�'�	 �!%�D���
���y�*�=�
>�
>�	 ���$=�$E���'0�&�$��'@�'@����
�8�S�(A�(A���A�H�L���
���
�5�"�)� <� <��%�e�T�2�2�H���'/�L��$�!%�D�����#��l�C�0�0�
��I�L�X����*6�G�D�%�&�!%�D��$�0��7��=�=�
��'�)B�C����7P�G�D�2�3�!%�D������\�7�E�:�;�;�;�;�;r)c�B�t|��}|�r|�d��}t|tj��r't|d��}|�||��n�t|ttf��r(|�	|�
����nmt|ttf��r/t|��dkr|\}}|�||��n"td�|�����|��
dSdS)Nr�unknown�zxOnly io.IOBase, multidict and (name, file) pairs allowed, use .add_field() for passing more complex parameters, got {!r})r"�popr r4r5rr@r	r�extendr#r$�lenr:�format)r&r�to_add�rec�k�fps      r'r%zFormData.add_fieldsYs���f�����	��*�*�Q�-�-�C��#�r�y�)�)�
�"�3�	�2�2�����q�#�&�&�&�&��C�.�)�!<�=�=�
��
�
�c�i�i�k�k�*�*�*�*��C�$���/�/�	
�C��H�H��M�M����2����q�"�%�%�%�%� �8�8>��s�������	�	�	�	�	r)c��g}|jD]#\}}}|�|d|f���$|j�|jnd}|dkrd}nd|z}tjt|d|������|���S)Nr1zutf-8z!application/x-www-form-urlencodedz-application/x-www-form-urlencoded; charset=%sT)�doseq�encoding)r.)rr=rr
�BytesPayloadr�encode)r&�datar>�_r2rr.s       r'�_gen_form_urlencodedzFormData._gen_form_urlencodedqs�����&*�l�	7�	7�"�L�!�U��K�K��f�-�u�5�6�6�6�6�#'�=�#<�$�-�-�'���g���>�L�L�M�PW�W�L��#��d�$��9�9�9�@�@�B�B�%�
�
�
�	
r)c
�H�|jrtd���|jD]�\}}}	tj|vr.tj||tj||j���}ntj|||j���}n8#t$r+}tdt|���d|�d|����|�d}~wwxYw|rC|j	dd	|ji|��|j
�J�|j
�tjd��|j�|����d
|_|jS)zAEncode a list of fields using the multipart/form-data MIME formatz$Form data has been processed already)r.r?rN)r?rNzCan not serialize value type: z
 headers: z	
 value: NrrT)r)r�RuntimeErrorrrr;r
�get_payloadr�	Exceptionr:�type�set_content_dispositionrr?�popall�CONTENT_LENGTHr�append_payload)r&�
dispparamsr?r2�part�excs      r'�_gen_form_datazFormData._gen_form_data�s�����	G��E�F�F�F�*.�,�	.�	.�&�J���
��$��/�/�"�.��%,�T�->�%?� '�!%��	���D�D�#�.��w������D����
�
�
��i�15�e�����g�g�g�u�u�N���������
�����
?�,��,����.2�.@��DN����
�|�/�/�/���#�#�D�$7��>�>�>��L�'�'��-�-�-�-�!����|�s�AA>�>
B3�&B.�.B3c�`�|jr|���S|���Sr+)rr`rSr,s r'�__call__zFormData.__call__�s1����	/��&�&�(�(�(��,�,�.�.�.r))rTN)�__name__�
__module__�__qualname__�__doc__rr�boolrr9r(�propertyr-r@r%r
rOrSrrr`rrbrr)r'rrs���������!#�!�!%�	!�!���
�!��!��#��	!�

�!�!�!�!�&�"�d�"�"�"��X�"�'+�"&�37�,<�,<�,<��,<��,<�
�s�m�,<��3�-�
,<�$,�C�=�,<�
�,<�,<�,<�,<�\�#��$�����0
�g�&:�
�
�
�
�$#�	� 9�#�#�#�#�J/�'�/�/�/�/�/�/r)r)r4�typingrrrr�urllib.parser�	multidictrr	�rrr
�helpersrr�__all__rrr)r'�<module>ros���	�	�	�	�0�0�0�0�0�0�0�0�0�0�0�0�"�"�"�"�"�"�/�/�/�/�/�/�/�/�&�&�&�&�&�&�&�&�&�&�#�#�#�#�#�#�������
��^/�^/�^/�^/�^/�^/�^/�^/�^/�^/r)

Hacked By AnonymousFox1.0, Coded By AnonymousFox