File: //opt/alt/python27/lib/python2.7/site-packages/urllib3/fields.pyo
�
�`Wc           @@  sg   d  d l  m Z d  d l Z d  d l Z d d l m Z d d � Z d �  Z d e	 f d	 �  �  YZ
 d S(
   i    (   t   absolute_importNi   (   t   sixs   application/octet-streamc         C@  s!   |  r t  j |  � d p | 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(   t   filenamet   default(    (    s?   /opt/alt/python27/lib/python2.7/site-packages/urllib3/fields.pyt   guess_content_type   s    	c         @  s�   t  �  f d �  d D� � s^ d |  �  f } y | j d � Wn t t f k
 rV q^ X| Sn  t j r� t �  t j � r� �  j d � �  n  t j	 j
 �  d � �  d |  �  f �  �  S(   s�  
    Helper function to format and quote a single header parameter.
    Particularly useful for header parameters which might contain
    non-ASCII values, like file names. This follows RFC 2231, as
    suggested by 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 a unicode string.
    c         3@  s   |  ] } | �  k Vq d  S(   N(    (   t   .0t   ch(   t   value(    s?   /opt/alt/python27/lib/python2.7/site-packages/urllib3/fields.pys	   <genexpr>#   s    s   "\
s   %s="%s"t   asciis   utf-8s   %s*=%s(   t   anyt   encodet   UnicodeEncodeErrort   UnicodeDecodeErrorR   t   PY3t
   isinstancet	   text_typet   emailt   utilst   encode_rfc2231(   t   nameR	   t   result(    (   R	   s?   /opt/alt/python27/lib/python2.7/site-packages/urllib3/fields.pyt   format_header_param   s    
t   RequestFieldc           B@  sY   e  Z d  Z d d d � Z e d �  � Z d �  Z d �  Z d �  Z	 d d d d � Z
 RS(   sK  
    A data container for request body parameters.
    :param name:
        The name of this request field.
    :param data:
        The data/value body.
    :param filename:
        An optional filename of the request field.
    :param headers:
        An optional dict-like object of headers to initially use for the field.
    c         C@  s@   | |  _  | |  _ | |  _ i  |  _ | r<