ó
§ŤŐ\c           @   sN   d  Z  d Z d d l m Z d d l m Z d e d
 d d  Z d	   Z	 d
 S(   s   C implementation of LRU caching.

Provides 2 LRU caching function decorators:

clru_cache - built-in (faster)
           >>> from fastcache import clru_cache
           >>> @clru_cache(maxsize=128,typed=False)
           ... def f(a, b):
           ...     return (a, ) + (b, )
           ...
           >>> type(f)
           >>> <class 'fastcache.clru_cache'>

lru_cache  - python wrapper around clru_cache (slower)
           >>> from fastcache import lru_cache
           >>> @lru_cache(maxsize=128,typed=False)
           ... def f(a, b):
           ...     return (a, ) + (b, )
           ...
           >>> type(f)
           >>> <class 'function'>
s   1.1.0i   (   t
   clru_cachei˙˙˙˙(   t   update_wrapperi   t   errorc            s        f d   } | S(   só  Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and
    the cache can grow without bound.

    If *typed* is True, arguments of different types will be cached
    separately. For example, f(3.0) and f(3) will be treated as distinct
    calls with distinct results.

    If *state* is a list or dict, the items will be incorporated into
    argument hash.

    The result of calling the cached function with unhashable (mutable)
    arguments depends on the value of *unhashable*:

        If *unhashable* is 'error', a TypeError will be raised.

        If *unhashable* is 'warning', a UserWarning will be raised, and
        the wrapped function will be called with the supplied arguments.
        A miss will be recorded in the cache statistics.

        If *unhashable* is 'ignore', the wrapped function will be called
        with the supplied arguments. A miss will will be recorded in
        the cache statistics.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with
    f.cache_clear(). Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used

    c            sX   t       |       f d   } |  | _   j | _   j | _ t | |   S(   Nc             s     |  |   S(   N(    (   t   argst   kwargs(   t   _cached_func(    s1   lib/python2.7/site-packages/fastcache/__init__.pyt   wrapperB   s    (   R    t   __wrapped__t
   cache_infot   cache_clearR   (   t   funcR   (   t   maxsizet   statet   typedt
   unhashable(   R   s1   lib/python2.7/site-packages/fastcache/__init__.pyt   func_wrapper?   s    	(    (   R   R   R   R   R   (    (   R   R   R   R   s1   lib/python2.7/site-packages/fastcache/__init__.pyt	   lru_cache   s    !c          G   sK   d d  l  } d d  l } | j | j j | j j t   g t |    S(   Ni˙˙˙˙(   t   pytestt   ost   maint   patht   dirnamet   abspatht   __file__t   list(   R   R   R   (    (    s1   lib/python2.7/site-packages/fastcache/__init__.pyt   testM   s    $N(
   t   __doc__t   __version__t	   _lrucacheR    t	   functoolsR   t   Falset   NoneR   R   (    (    (    s1   lib/python2.7/site-packages/fastcache/__init__.pyt   <module>   s
   /