ok

Mini Shell

Direktori : /opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyo

�
Bu�_c@@s�ddlmZddlZddlZddlZddlmZdd�Zd�Z	idd	6d
d6d
d6Z
e
jd�edd�D��d�Z
d�ZeZdefd��YZdS(i(tabsolute_importNi(tsixsapplication/octet-streamcC@s!|rtj|�dp|S|S(s�
    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`.
    i(t	mimetypest
guess_type(tfilenametdefault((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytguess_content_type	s	c@s�t�tj�r$�jd��nt�fd�dD��s�d|�f}y|jd�Wnttfk
rzq�X|Sntjr��jd��nt	j
j�d��d|�f�tjr��jd��n�S(s�
    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.

    :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.
    sutf-8c3@s|]}|�kVqdS(N((t.0tch(tvalue(sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pys	<genexpr>)ss"\
u%s="%s"tasciis%s*=%s(t
isinstanceRtbinary_typetdecodetanytencodetUnicodeEncodeErrortUnicodeDecodeErrortPY2temailtutilstencode_rfc2231(tnameR	tresult((R	sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytformat_header_param_rfc2231s 		u%22u"u\\u\cC@s7i|]-}|dkrdj|�tj|��qS(iu%{:02X}(i(tformatRtunichr(Rtcc((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pys
<dictcomp>Js	ic@s_�fd�}tjdjg�j�D]}tj|�^q(��}|j||�}|S(Nc@s�|jd�S(Ni(tgroup(tmatch(tneedles_and_replacements(sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytreplacerRst|(tretcompiletjointkeystescapetsub(R	RRtneedletpatternR((RsK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyt_replace_multipleQs
4cC@sAt|tj�r$|jd�}nt|t�}d||fS(s�
    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.
    sutf-8u%s="%s"(RRRR
R)t_HTML5_REPLACEMENTS(RR	((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytformat_header_param_html5^stRequestFieldcB@s_eZdZdded�Zeed��Zd�Zd�Z	d�Z
dddd�ZRS(s
    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`.
    cC@sI||_||_||_i|_|r<t|�|_n||_dS(N(t_namet	_filenametdatatheaderstdicttheader_formatter(tselfRR/RR0R2((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyt__init__�s				cC@s�t|t�rNt|�dkr3|\}}}q`|\}}t|�}nd}d}|}|||d|d|�}|jd|�|S(s�
        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.
        iRR2tcontent_typeN(RttupletlenRtNonetmake_multipart(tclst	fieldnameR	R2RR/R5t
request_param((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytfrom_tuples�scC@s|j||�S(sI
        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.
        (R2(R3RR	((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyt_render_part�scC@svg}|}t|t�r*|j�}nx<|D]4\}}|dk	r1|j|j||��q1q1Wdj|�S(sO
        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"; ...`.
        u; N(RR1titemsR8tappendR>R#(R3theader_partstpartstiterableRR	((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyt
_render_parts�s cC@s�g}dddg}xD|D]<}|jj|t�r|jd||j|f�qqWxL|jj�D];\}}||krl|r�|jd||f�q�qlqlW|jd�dj|�S(s=
        Renders the headers for this request field.
        sContent-DispositionsContent-TypesContent-Locationu%s: %su
(R0tgettFalseR@R?R#(R3tlinest	sort_keystsort_keytheader_nametheader_value((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pytrender_headers�s
%!
c
C@st|p	d|jd<|jdcdjd|jd|jfd|jff�g�7<||jd<||jd<d	S(
s|
        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.

        u	form-datasContent-Dispositionu; uunameufilenamesContent-TypesContent-LocationN(R0R#RDR-R.(R3tcontent_dispositionR5tcontent_location((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyR9�s'
N(t__name__t
__module__t__doc__R8R+R4tclassmethodR=R>RDRLR9(((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyR,}s
#	
		i (t
__future__Rtemail.utilsRRR!tpackagesRRRR*tupdatetrangeR)R+tformat_header_paramtobjectR,(((sK/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/fields.pyt<module>s"	)
	
	

Zerion Mini Shell 1.0