U
    W+d                  	   @   s  d dl Z zd dlZW n ek
r0   d dlZY nX zd dlmZ W n  ek
rb   d dlmZ Y nX ze jd e jjZW n  e	efk
r   dd ZY nX d dl
mZ d dlmZmZ d d	lmZmZmZmZmZmZ d d
lmZ d dlmZmZmZmZmZ d dlmZ d dlm Z  ej!rHe"Z#e$Z%d dl&m'Z'm(Z(m)Z) eZ*eZ+n8e#Z#e,Z%d dl'm-Z' d dl'm(Z(m)Z) dddZ*dddZ+dS )    N)encodebytes)encodestring~c                 C   s   | S N )xr   r   //tmp/pip-unpacked-wheel-dlxw5sjy/boto/compat.py<lambda>/       r	   )six)BytesIOStringIO)filterhttp_clientmap_threadurllibzip)Queue)parse_qsquoteunquoteurlparseurlsplit)unquote_plus)urlopen)ConfigParserNoOptionErrorNoSectionError)SafeConfigParser)r   r   utf-8c                 C   s   |  |}t||S r   )encoder   decode)valueencodingZbyte_stringr   r   r   unquote_strI   s    
r%   Freplacec                    sp   t | tj}|r| d} t| ||}|rli }| D ]0\}}	| }
 fdd|	D }|||
< q6|S |S )z>Parse a query handling unicode arguments properly in Python 2.asciic                    s   g | ]}|  qS r   )r"   ).0itemr$   errorsr   r   
<listcomp>b   s   z!parse_qs_safe.<locals>.<listcomp>)
isinstancer   	text_typer!   r   itemsr"   )qskeep_blank_valuesstrict_parsingr$   r+   Zis_text_typeZqs_dictresultnamer#   Zdecoded_nameZdecoded_valuer   r*   r   parse_qs_safeU   s    

r5   )r    )FFr    r&   ).osZ
simplejsonjsonImportErrorbase64r   r   path
expanduserAttributeErrorZboto.vendoredr   Zboto.vendored.sixr   r   Zboto.vendored.six.movesr   r   r   r   r   r   Zboto.vendored.six.moves.queuer   Z$boto.vendored.six.moves.urllib.parser   r   r   r   r   r   Z&boto.vendored.six.moves.urllib.requestr   PY3	ExceptionStandardErrorintZ	long_typeconfigparserr   r   r   r%   r5   longr   r   r   r   r   <module>   sF    
    