U
    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	k
rV   dddZY nX zdd	lm
Z
 W n e	k
r   dd
dZ
Y nX dS )zBackward 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   s8   t | tr| ||S t | tr$| S tdt|  dS )zCoerce *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'N)
isinstancer   decoder   	TypeErrortypesencodingerrors r   5/usr/lib/python3/dist-packages/virtualenv/util/six.pyr      s
    	

r   )
ensure_strc                 C   sX   t | ttfstdt|  tr:t | tr:| ||} ntrTt | trT| ||} | S )zCoerce *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	   )r   r	   )__doc__Z
__future__r   Zsixr   r   r   r   r   ImportErrorr   r   r   r   r   <module>   s   