§
    §>jt!  ã                   óÈ   — d dl mZ d dlZd dlZd dlZd dlZdd„Zd„ ZdddœZ	e	 
                    d	„  ed d
¦  «        D ¦   «         ¦  «         d„ Zd„ ZeZ G d„ de¦  «        ZdS )é    )Úabsolute_importNúapplication/octet-streamc                 óB   — | rt          j        | ¦  «        d         p|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     ú0/usr/lib/python3/dist-packages/urllib3/fields.pyÚguess_content_typer   
   s,   € ð ð <ÝÔ# HÑ-Ô-¨aÔ0Ð;°GÐ;Ø€Nó    c                 óÜ  ‡— t          ‰t          j        ¦  «        r‰                     d¦  «        Št	          ˆfd„dD ¦   «         ¦  «        s7| ›d‰›d�}	 |                     d¦  «         |S # t          t          f$ r Y nw xY wt          j        r‰                     d¦  «        Št          j
                             ‰d¦  «        Š| ›d‰›�Št          j        r‰                     d¦  «        Š‰S )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-8c              3   ó    •K  — | ]}|‰v V — Œ	d S ©N© )Ú.0ÚchÚvalues     €r
   ú	<genexpr>z.format_header_param_rfc2231.<locals>.<genexpr>+   s'   øè è € Ð/Ð/˜rˆr�Uˆ{Ð/Ð/Ð/Ð/Ð/Ð/r   z"\
ú="ú"Úasciiz*=)Ú
isinstanceÚsixÚbinary_typeÚdecodeÚanyÚencodeÚUnicodeEncodeErrorÚUnicodeDecodeErrorÚPY2ÚemailÚutilsÚencode_rfc2231)Únamer   Úresults    ` r
   Úformat_header_param_rfc2231r'      s  ø€ õ  �%�œÑ)Ô)ð &Ø—’˜WÑ%Ô%ˆåÐ/Ð/Ð/Ð/ YÐ/Ñ/Ô/Ñ/Ô/ð Ø#˜t˜t U U UÐ+ˆð	Ø�MŠM˜'Ñ"Ô"Ð"ð ˆMøõ #Õ$6Ð7ð 	ð 	ð 	ØˆDð	øøøõ
 „wð &Ø—’˜WÑ%Ô%ˆõ ŒK×&Ò& u¨gÑ6Ô6€EØ˜˜˜e˜eÐ$€Eå
„wð &Ø—’˜WÑ%Ô%ˆà€Ls   ÁA, Á,B Á?B z%22z\\)r   ú\c                 óf   — i | ].}|d v¯t          j        |¦  «        d                     |¦  «        “Œ/S ))é   z%{:02X})r   ÚunichrÚformat)r   Úccs     r
   ú
<dictcomp>r.   J   sE   € ð ð ð àØ�WÐÐõ 	Œ
�2‰Œ˜
×)Ò)¨"Ñ-Ô-àÐÐr   é    c                 óÄ   ‡— ˆfd„}t          j        d                     d„ ‰                     ¦   «         D ¦   «         ¦  «        ¦  «        }|                     || ¦  «        }|S )Nc                 ó:   •— ‰|                       d¦  «                 S )Nr   )Úgroup)ÚmatchÚneedles_and_replacementss    €r
   Úreplacerz#_replace_multiple.<locals>.replacerS   s   ø€ Ø'¨¯ª°A©¬Ô7Ð7r   ú|c                 ó6   — g | ]}t          j        |¦  «        ‘ŒS r   )ÚreÚescape)r   Úneedles     r
   ú
<listcomp>z%_replace_multiple.<locals>.<listcomp>W   s"   € ÐSÐSÐS¨•2”9˜VÑ$Ô$ÐSÐSÐSr   )r8   ÚcompileÚjoinÚkeysÚsub)r   r4   r5   Úpatternr&   s    `   r
   Ú_replace_multiplerA   R   st   ø€ ð8ð 8ð 8ð 8ð 8õ ŒjØ�	Š	ÐSÐSÐ3K×3PÒ3PÑ3RÔ3RÐSÑSÔSÑTÔTñô €Gð �[Š[˜ 5Ñ)Ô)€Fà€Mr   c                 óš   — t          |t          j        ¦  «        r|                     d¦  «        }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.
    r   r   r   )r   r   r   r   rA   Ú_HTML5_REPLACEMENTS)r%   r   s     r
   Úformat_header_param_html5rD   _   sL   € õ& �%�œÑ)Ô)ð &Ø—’˜WÑ%Ô%ˆå˜eÕ%8Ñ9Ô9€Eà˜˜˜u˜u˜uÐ%Ð%r   c                   óV   — e Zd ZdZddefd„Zeefd„¦   «         Zd„ Zd„ Z	d„ Z
	 d	d„ZdS )
Ú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                 óx   — || _         || _        || _        i | _        |rt	          |¦  «        | _        || _        d S r   )Ú_nameÚ	_filenameÚdataÚheadersÚdictÚheader_formatter)Úselfr%   rJ   r   rK   rM   s         r
   Ú__init__zRequestField.__init__�   sC   € ð ˆŒ
Ø!ˆŒØˆŒ	ØˆŒØð 	)Ý ™=œ=ˆDŒLØ 0ˆÔÐÐr   c                 óä   — t          |t          ¦  «        r/t          |¦  «        dk    r|\  }}}n|\  }}t          |¦  «        }nd}d}|} | ||||¬¦  «        }|                     |¬¦  «         |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   rM   )Úcontent_type)r   ÚtupleÚlenr   Úmake_multipart)ÚclsÚ	fieldnamer   rM   r   rJ   rR   Úrequest_params           r
   Úfrom_tupleszRequestField.from_tuplesŸ   s™   € õ$ �e�UÑ#Ô#ð 		Ý�5‰zŒz˜QŠˆØ/4Ñ,�˜$  à!&‘�˜$Ý1°(Ñ;Ô;��àˆHØˆLØˆDà˜Ø�t hÐAQð
ñ 
ô 
ˆð 	×$Ò$°,Ð$Ñ?Ô?Ð?àÐr   c                 ó.   — |                       ||¦  «        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.
        )rM   )rN   r%   r   s      r
   Ú_render_partzRequestField._render_partÃ   s   € ð ×$Ò$ T¨5Ñ1Ô1Ð1r   c                 óì   — g }|}t          |t          ¦  «        r|                     ¦   «         }|D ]0\  }}|�)|                     |                      ||¦  «        ¦  «         Œ1d                     |¦  «        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"; ...`.
        Nú; )r   rL   ÚitemsÚappendr[   r=   )rN   Úheader_partsÚpartsÚiterabler%   r   s         r
   Ú_render_partszRequestField._render_partsÐ   s   € ð ˆØˆÝ�l¥DÑ)Ô)ð 	,Ø#×)Ò)Ñ+Ô+ˆHà#ð 	=ð 	=‰KˆD�%ØÐ Ø—’˜T×.Ò.¨t°UÑ;Ô;Ñ<Ô<Ð<øà�zŠz˜%Ñ Ô Ð r   c                 ój  — g }g d¢}|D ]B}| j                              |d¦  «        r%|                     |›d| j         |         ›�¦  «         ŒC| j                              ¦   «         D ]%\  }}||vr|r|                     |›d|›�¦  «         Œ&|                     d¦  «         d                     |¦  «        S )z=
        Renders the headers for this request field.
        )úContent-DispositionúContent-TypeúContent-LocationFz: z
)rK   Úgetr_   r^   r=   )rN   ÚlinesÚ	sort_keysÚsort_keyÚheader_nameÚheader_values         r
   Úrender_headerszRequestField.render_headersæ   sà   € ð ˆàOÐOÐOˆ	Ø!ð 	Mð 	MˆHØŒ|×Ò ¨%Ñ0Ô0ð MØ—’¨(¨(¨(°D´LÀÔ4JÐ4JÐKÑLÔLÐLøà)-¬×);Ò);Ñ)=Ô)=ð 	Jð 	JÑ%ˆK˜Ø )Ð+Ð+Øð JØ—L’L¨k¨k¨k¸<¸<Ð!HÑIÔIÐIøà�Š�WÑÔÐØ�|Š|˜EÑ"Ô"Ð"r   c                 óà   — |pd| j         d<   | j         dxx         d                     d|                      d| j        fd| j        ff¦  «        g¦  «        z  cc<   || j         d<   || j         d<   d	S )
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-datare   r]   Ú r%   r   rf   rg   N)rK   r=   rc   rH   rI   )rN   Úcontent_dispositionrR   Úcontent_locations       r
   rU   zRequestField.make_multipartù   s˜   € ð /BÐ.QÀ\ˆŒÐ*Ñ+ØŒÐ*Ð+Ð+Ô+¨u¯zªzàØ×"Ò"Ø˜tœzÐ*¨[¸$¼.Ð,IÐJñô ðñ0
ô 0
ñ 	
Ð+Ð+Ñ+ð (4ˆŒ�^Ñ$Ø+;ˆŒÐ'Ñ(Ð(Ð(r   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rD   rO   ÚclassmethodrY   r[   rc   rn   rU   r   r   r
   rF   rF   ~   s©   € € € € € ðð ð( ØØ2ð1ð 1ð 1ð 1ð  Ø<Uð !ð !ð !ñ „[ð!ðF2ð 2ð 2ð!ð !ð !ð,#ð #ð #ð( MQð<ð <ð <ð <ð <ð <r   rF   )r   )Ú
__future__r   Úemail.utilsr"   r   r8   r   r   r'   rC   ÚupdateÚrangerA   rD   Úformat_header_paramÚobjectrF   r   r   r
   ú<module>r~      s   ðØ &Ð &Ð &Ð &Ð &Ð &à Ð Ð Ð Ø Ð Ð Ð Ø 	€	€	€	à 
€
€
€
ðð ð ð ð'ð 'ð 'ðV àðð Ð ð × Ò ðð à�%˜˜hÑ'Ô'ðñ ô ñô ð ð
ð 
ð 
ð&ð &ð &ð8 0Ð ðT<ð T<ð T<ð T<ð T<�6ñ T<ô T<ð T<ð T<ð T<r   