Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pip/_vendor/urllib3/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pip/_vendor/urllib3/__pycache__/fields.cpython-312.pyc

�

4Μg�!�	��ddlmZddlZddlZddlZddlmZdd�Zd�Z	ddd	�Z
e
jedd
�D�cic]'}|dvr!ej|�dj|���)c}�d
�Zd�ZeZGd�de�Zycc}w)�)�absolute_importN�)�sixc�B�|rtj|�dxs|S|S)z�
    Guess the "Content-Type" of a file.

    :param filename:
        The filename to guess the "Content-Type" of using :mod:`mimetypes`.
    :param default:
        If no "Content-Type" can be guessed, default to `default`.
    r)�	mimetypes�
guess_type)�filename�defaults  �E/usr/local/lib/python3.12/site-packages/pip/_vendor/urllib3/fields.py�guess_content_typer
s'����#�#�H�-�a�0�;�G�;��N�c���t�tj�r�jd��t	�fd�dD��s|�d��d�}	|jd�|Stjr�jd��tjj�d��|�d����tjr�jd���S#ttf$rY�|wxYw)a!
    Helper function to format and quote a single header parameter using the
    strategy defined in RFC 2231.

    Particularly useful for header parameters which might contain
    non-ASCII values, like file names. This follows
    `RFC 2388 Section 4.4 <https://tools.ietf.org/html/rfc2388#section-4.4>`_.

    :param name:
        The name of the parameter, a string expected to be ASCII only.
    :param value:
        The value of the parameter, provided as ``bytes`` or `str``.
    :ret:
        An RFC-2231-formatted unicode string.
    �utf-8c3�&�K�|]}|�v���
y�w�N�)�.0�ch�values  �r�	<genexpr>z.format_header_param_rfc2231.<locals>.<genexpr>+s�����/�Y�r�r�U�{�Y�s�z"\
�="�"�asciiz*=)�
isinstancer�binary_type�decode�any�encode�UnicodeEncodeError�UnicodeDecodeError�PY2�email�utils�encode_rfc2231)�namer�results ` r�format_header_param_rfc2231r's���� �%����)����W�%���/�Y�/�/�#�U�+��	��M�M�'�"��M�
�w�w����W�%��
�K�K�&�&�u�g�6�E��e�$�E�
�w�w����W�%���L��!#�$6�7�	��	�s�
C�C�Cz%22z\\)r�\� )�z%{:02X}c
�����fd�}tjdj�j�D�cgc]}tj|���c}��}|j||�}|Scc}w)Nc�,���|jd�S)Nr)�group)�match�needles_and_replacementss �r�replacerz#_replace_multiple.<locals>.replacerSs���'����A��7�7r
�|)�re�compile�join�keys�escape�sub)rr/r0�needle�patternr&s `    r�_replace_multipler:Rse���8��j�j��	�	�3K�3P�3P�3R�S�3R��2�9�9�V�$�3R�S�T��G��[�[��5�
)�F��M��Ts�A.c��t|tj�r|jd�}t	|t
�}|�d|�d�S)a�
    Helper function to format and quote a single header parameter using the
    HTML5 strategy.

    Particularly useful for header parameters which might contain
    non-ASCII values, like file names. This follows the `HTML5 Working Draft
    Section 4.10.22.7`_ and matches the behavior of curl and modern browsers.

    .. _HTML5 Working Draft Section 4.10.22.7:
        https://w3c.github.io/html/sec-forms.html#multipart-form-data

    :param name:
        The name of the parameter, a string expected to be ASCII only.
    :param value:
        The value of the parameter, provided as ``bytes`` or `str``.
    :ret:
        A unicode string, stripped of troublesome characters.
    rrr)rrrrr:�_HTML5_REPLACEMENTS)r%rs  r�format_header_param_html5r=_s8��&�%����)����W�%���e�%8�9�E��u�%�%r
c�N�eZdZdZddefd�Zeefd��Zd�Zd�Z	d�Z
	d	d�Zy)
�RequestFielda
    A data container for request body parameters.

    :param name:
        The name of this request field. Must be unicode.
    :param data:
        The data/value body.
    :param filename:
        An optional filename of the request field. Must be unicode.
    :param headers:
        An optional dict-like object of headers to initially use for the field.
    :param header_formatter:
        An optional callable that is used to encode and format the headers. By
        default, this is :func:`format_header_param_html5`.
    Nc�n�||_||_||_i|_|rt	|�|_||_yr)�_name�	_filename�data�headers�dict�header_formatter)�selfr%rCr	rDrFs      r�__init__zRequestField.__init__�s6����
�!�����	�������=�D�L� 0��r
c��t|t�r&t|�dk(r|\}}}n|\}}t|�}nd}d}|}|||||��}|j	|��|S)a�
        A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.

        Supports constructing :class:`~urllib3.fields.RequestField` from
        parameter of key/value strings AND key/filetuple. A filetuple is a
        (filename, data, MIME type) tuple where the MIME type is optional.
        For example::

            'foo': 'bar',
            'fakefile': ('foofile.txt', 'contents of foofile'),
            'realfile': ('barfile.txt', open('realfile').read()),
            'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'),
            'nonamefile': 'contents of nonamefile field',

        Field names and filenames must be unicode.
        �N)r	rF)�content_type)r�tuple�lenr�make_multipart)�cls�	fieldnamerrFr	rCrK�
request_params        r�from_tupleszRequestField.from_tuples�st��$�e�U�#��5�z�Q��/4�,��$��!&���$�1�(�;���H��L��D���t�h�AQ�
�
�	�$�$�,�$�?��r
c�&�|j||�S)aI
        Overridable helper function to format a single header parameter. By
        default, this calls ``self.header_formatter``.

        :param name:
            The name of the parameter, a string expected to be ASCII only.
        :param value:
            The value of the parameter, provided as a unicode string.
        )rF)rGr%rs   r�_render_partzRequestField._render_part�s���$�$�T�5�1�1r
c���g}|}t|t�r|j�}|D])\}}|��	|j|j	||���+dj|�S)aO
        Helper function to format and quote a single header.

        Useful for single headers that are composed of multiple items. E.g.,
        'Content-Disposition' fields.

        :param header_parts:
            A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format
            as `k1="v1"; k2="v2"; ...`.
        �; )rrE�items�appendrTr4)rG�header_parts�parts�iterabler%rs      r�
_render_partszRequestField._render_parts�sd�������l�D�)�#�)�)�+�H�#�K�D�%�� ����T�.�.�t�U�;�<�$��z�z�%� � r
c�`�g}gd�}|D]B}|jj|d�s� |j|�d|j|����D|jj�D]#\}}||vs�|s�|j|�d|����%|jd�dj	|�S)z=
        Renders the headers for this request field.
        )�Content-Disposition�Content-Type�Content-LocationFz: z
)rD�getrXrWr4)rG�lines�	sort_keys�sort_key�header_name�header_values      r�render_headerszRequestField.render_headers�s�����O�	�!�H��|�|����%�0����(�D�L�L��4J�K�L�"�*.���);�);�)=�%�K���)�+���L�L�k�<�!H�I�*>�
	���W���|�|�E�"�"r
c��|xsd|jd<|jdxxdjd|jd|jfd|jff�g�z
cc<||jd<||jd<y	)
a|
        Makes this request field into a multipart request field.

        This method overrides "Content-Disposition", "Content-Type" and
        "Content-Location" headers to the request parameter.

        :param content_type:
            The 'Content-Type' of the request body.
        :param content_location:
            The 'Content-Location' of the request body.

        z	form-datar^rV�r%r	r_r`N)rDr4r\rArB)rG�content_dispositionrK�content_locations    rrNzRequestField.make_multipart�s���/B�.Q�\����*�+����*�+�u�z�z���"�"��t�z�z�*�[�$�.�.�,I�J��
�0
�	
�+�(4����^�$�+;����'�(r
)NNN)�__name__�
__module__�__qualname__�__doc__r=rH�classmethodrRrTr\rgrNrr
rr?r?~sJ���(��2�
1� �<U�!��!�F2�!�,#�(MQ�<r
r?)zapplication/octet-stream)�
__future__r�email.utilsr"rr2�packagesrrr'r<�update�range�unichr�formatr:r=�format_header_param�objectr?)�ccs0r�<module>r{s���&���	���'�V���������h�'��'�B�
�W��	�
�
�2��
�)�)�"�-�-�'���
�&�80��T<�6�T<��is�,B

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists