ó
^\kdc           @   s¯   d  d l  m Z y d  d l m Z Wn$ e k
 rJ d d
 d „  ƒ  YZ n Xy d  d l  m Z Wn! e k
 r‚ d d l m Z n Xd g Z e ƒ  Z	 d e f d „  ƒ  YZ
 d	 S(   iÿÿÿÿ(   t   MutableMapping(   t   RLockR   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   d  S(   N(    (   t   self(    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt	   __enter__   s    c         C   s   d  S(   N(    (   R   t   exc_typet	   exc_valuet	   traceback(    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __exit__   s    (   t   __name__t
   __module__R   R   (    (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyR      s   	(   t   OrderedDicti   t   RecentlyUsedContainerc           B   sb   e  Z d  Z e Z d d
 d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z RS(   s‘  
    Provides a thread-safe dict-like container which maintains up to
    ``maxsize`` keys while throwing away the least-recently-used keys beyond
    ``maxsize``.

    :param maxsize:
        Maximum number of recent elements to retain.

    :param dispose_func:
        Every time an item is evicted from the container,
        ``dispose_func(value)`` is called.  Callback which will get called
    i
   c         C   s1   | |  _  | |  _ |  j ƒ  |  _ t ƒ  |  _ d  S(   N(   t   _maxsizet   dispose_funct   ContainerClst
   _containerR   t   lock(   R   t   maxsizeR   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __init__/   s    		c         C   s7   |  j  �( |  j j | ƒ } | |  j | <| SWd  QXd  S(   N(   R   R   t   pop(   R   t   keyt   item(    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __getitem__6   s    
c         C   s—   t  } |  j �] |  j j | t  ƒ } | |  j | <t |  j ƒ |  j k rh |  j j d t ƒ \ } } n  Wd  QX|  j r“ | t  k	 r“ |  j | ƒ n  d  S(   Nt   last(	   t   _NullR   R   t   gett   lenR   t   popitemt   FalseR   (   R   R   t   valuet   evicted_valuet   _key(    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __setitem__=   s    
$c         C   s?   |  j  � |  j j | ƒ } Wd  QX|  j r; |  j | ƒ n  d  S(   N(   R   R   R   R   (   R   R   R   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __delitem__L   s    
	c         C   s!   |  j  � t |  j ƒ SWd  QXd  S(   N(   R   R   R   (   R   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __len__S   s    
c         C   s   t  d ƒ ‚ d  S(   Ns7   Iteration over this class is unlikely to be threadsafe.(   t   NotImplementedError(   R   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   __iter__W   s    c         C   s`   |  j  �' t |  j j ƒ  ƒ } |  j j ƒ  Wd  QX|  j r\ x | D] } |  j | ƒ qB Wn  d  S(   N(   R   t   listR   t   valuest   clearR   (   R   R&   R   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyR'   Z   s    
	c         C   s!   |  j  � |  j j ƒ  SWd  QXd  S(   N(   R   R   t   keys(   R   (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyR(   e   s    
N(   R   R	   t   __doc__R
   R   t   NoneR   R   R    R!   R"   R$   R'   R(   (    (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyR      s   						N(    (   t   collectionsR    t	   threadingR   t   ImportErrorR
   t   packages.ordered_dictt   __all__t   objectR   R   (    (    (    sY   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/_collections.pyt   <module>   s   		