o
    $¼"b·  ã                   @   sˆ   d Z ddlmZ ddlmZmZmZmZ zddlmZ W n e	y*   ddd„ZY nw z	dd	lm
Z
 W dS  e	yC   dd
d„Z
Y dS w )z™Backward compatibility layer with older version of six.

This is used to avoid virtualenv requring a version of six newer than what
the system may have.
é    )Úabsolute_import)ÚPY2ÚPY3Úbinary_typeÚ	text_type)Úensure_textúutf-8Ústrictc                 C   s4   t | tƒr|  ||¡S t | tƒr| S tdt| ƒ ƒ‚)zÎCoerce *s* to six.text_type.
        For Python 2:
        - `unicode` -> `unicode`
        - `str` -> `unicode`
        For Python 3:
        - `str` -> `str`
        - `bytes` -> decoded to `str`
        únot expecting type '%s')Ú
isinstancer   Údecoder   Ú	TypeErrorÚtype©ÚsÚencodingÚerrors© r   ú5/usr/lib/python3/dist-packages/virtualenv/util/six.pyr      s
   
	
r   )Ú
ensure_strc                 C   sZ   t | ttfƒstdt| ƒ ƒ‚trt | tƒr|  ||¡} | S tr+t | tƒr+|  ||¡} | S )zÉCoerce *s* to `str`.
        For Python 2:
        - `unicode` -> encoded to `str`
        - `str` -> `str`
        For Python 3:
        - `str` -> `str`
        - `bytes` -> decoded to `str`
        r
   )	r   r   r   r   r   r   Úencoder   r   r   r   r   r   r   #   s   	þr   N)r   r	   )Ú__doc__Ú
__future__r   Úsixr   r   r   r   r   ÚImportErrorr   r   r   r   r   Ú<module>   s    þþ