
bc           @@ sD  d  d l  m Z m Z d d l m Z d e f d     YZ d e f d     YZ e d k r@i d d	 6d
 d 6d d 6d d 6d d 6Z	 e e	  Z
 e d  e d d d x" e
 D] Z e d e d d q We d  e e	 d e Z	 e d  e d d d x( e	 j   D] Z e d e d d qWe d  n  d S(   i    (   t   absolute_importt   print_functioni   (   t   BidirMapt   SortedDictIteratorc           B@ s    e  Z d    Z d   Z e Z RS(   c         C@ s   | |  _  | |  _ d  S(   N(   t   sorted_dictt   keys(   t   selfR   R   (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyt   __init__   s    	c         C@ s2   y |  j  j d  SWn t k
 r- t  n Xd  S(   Ni    (   R   t   popt
   IndexErrort   StopIteration(   R   (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyt   __next__   s    (   t   __name__t
   __module__R   R   t   next(    (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyR      s   		t
   SortedDictc           B@ s2   e  Z i  e d   Z d   Z d   Z d   Z RS(   c         K@ s    t  j |  | |  | |  _ d S(   s  
        WARNING: SortedDict() with ignore_case==True will
                 drop entries differing only in capitalisation!
                 Eg: SortedDict({'auckland':1, 'Auckland':2}).keys() => ['Auckland']
                 With ignore_case==False it's all right
        N(   t   dictR   t   ignore_case(   R   t   mappingR   t   kwargs(    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyR      s    c         C@ s   t  j |   } |  j ro t   } x | D] } | | | j   <q( Wt | j    } g  | D] } | | ^ q[ St |  } | Sd  S(   N(   R   R   R   R   t   lowert   sorted(   R   R   t   xlat_mapt   keyt   lc_keyst   k(    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyR   %   s    		c         C@ s   t  |  |  j    S(   N(   R   R   (   R   (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyt   __iter__6   s    c         C@ si   t  | t  rM t d |  j  } xA |  j   | D] } |  | | | <q2 Wn t t |   j |  } | S(   s0   Override to support the "get_slice" for python3 R   (   t
   isinstancet   sliceR   R   R   t   supert   __getitem__(   R   t   indext   rR   (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyR   9   s    (   R   R   t   TrueR   R   R   R   (    (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyR      s   
		t   __main__t   AWSi   t   Actioni   t   americai   t   Aucklandi   t   Americas8   Wanted: Action, america, Auckland, AWS,    [ignore case]s   Got:   t   endt    s   %s,s      [used: __iter__()]R   sD   Wanted: AWS, Action, America, Auckland, america,    [case sensitive]s      [used: keys()]N(   t
   __future__R    R   R   t   objectR   R   R   R   t   dt   sdt   printR   t   FalseR   (    (    (    sM   /oak/stanford/groups/akundaje/marinovg/programs/s3cmd-master/S3/SortedDict.pyt   <module>	   s"   *)


