ó
O'—^c           @   s”  d  Z  d d l Z e j d d k  r1d d l m Z d d l m Z m Z d d l m Z m	 Z	 d d l
 m Z d d	 l m Z y d d
 l m Z Wn! e k
 r¸ d d
 l m Z n Xd „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e Z e Z e Z e Z e Z  e! Z! nÇ d d l" m Z m Z m Z d d l# m Z d d l
 m Z d d	 l$ m Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e Z e% Z e& Z e' Z	 e( Z e Z e Z e Z e  Z  e) Z! y  d d l$ m* Z* m+ Z+ m, Z, Wnu e k
 rd d l m+ Z+ m, Z, y d d  l m* Z* Wqe k
 r‹d d	 l m Z d! e f d" „  ƒ  YZ* qXn Xd S(#   s5   Internal module for Python 2 backwards compatibility.iÿÿÿÿNi    i   (   t   unquote(   t   parse_qst   urlparse(   t   imapt   izip(   t   letters(   t   Queue(   t   StringIOc         G   sE   y t  |  | Œ SWn- t k
 r@ t |  ƒ j d ƒ } t  | ƒ SXd S(   s*    return the unicode representation of obj t   string_escapeN(   t   unicodet   UnicodeDecodeErrort   strt   encode(   t   objt   argst
   ascii_text(    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   safe_unicode   s
    c         C   s
   |  j  ƒ  S(   N(   t	   iteritems(   t   x(    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR      s    c         C   s
   |  j  ƒ  S(   N(   t   iterkeys(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR      s    c         C   s
   |  j  ƒ  S(   N(   t
   itervalues(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR       s    c         C   s#   t  |  t ƒ r |  S|  j d d ƒ S(   Ns   utf-8t   replace(   t
   isinstanceR   R   (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt	   nativestr#   s    c         C   s
   |  j  ƒ  S(   N(   t   decode(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   u&   s    c         C   s   |  S(   N(    (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   b)   s    c         C   s
   |  j  ƒ  S(   N(   t   next(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   ,   s    c         C   s   |  S(   N(    (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   byte_to_chr/   s    (   R   R    R   (   t   BytesIO(   t   ascii_lettersc         C   s   t  |  j ƒ  ƒ S(   N(   t   itert   items(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   >   s    c         C   s   t  |  j ƒ  ƒ S(   N(   R   t   keys(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   A   s    c         C   s   t  |  j ƒ  ƒ S(   N(   R   t   values(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   D   s    c         C   s
   t  |  ƒ S(   N(   t   chr(   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   G   s    c         C   s#   t  |  t ƒ r |  S|  j d d ƒ S(   Ns   utf-8R   (   R   R   R   (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   J   s    c         C   s   |  S(   N(    (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   M   s    c         C   s    t  |  t ƒ s |  j d ƒ S|  S(   Ns   latin-1(   R   t   bytesR   (   R   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR   P   s    (   t	   LifoQueuet   Emptyt   Full(   R&   R'   (   R%   R%   c           B   s5   e  Z d  Z d „  Z e d „ Z d „  Z d „  Z RS(   s>   Override queue methods to implement a last-in first-out queue.c         C   s   | |  _  g  |  _ d  S(   N(   t   maxsizet   queue(   t   selfR(   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   _initl   s    	c         C   s   | |  j  ƒ S(   N(   R)   (   R*   t   len(    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   _qsizep   s    c         C   s   |  j  j | ƒ d  S(   N(   R)   t   append(   R*   t   item(    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   _puts   s    c         C   s   |  j  j ƒ  S(   N(   R)   t   pop(   R*   (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   _getv   s    (   t   __name__t
   __module__t   __doc__R+   R,   R-   R0   R2   (    (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyR%   i   s
   		(-   R5   t   syst   version_infot   urllibR    R   R   t	   itertoolsR   R   t   stringR   R   R   t	   cStringIOR   R   t   ImportErrorR   R   R   R   R   R   R   R   R   t   unichrt   xranget
   basestringR	   R   R$   t   longt   urllib.parset   ioR)   R#   t   mapt   zipt   ranget   intR%   R&   R'   (    (    (    s/   /tmp/pip-unpacked-wheel-5e_doG/redis/_compat.pyt   <module>   sp   																		 