ó
P'—^c           @   sô   d  d l  Z  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  d l m Z d  d l m Z d d	 d
 d d h Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ e ƒ  Z e j d „  d e ƒe d „  ƒ Z d „  Z d S(   iÿÿÿÿN(   t   memoizet   merget	   namespace(   t   settings(   t   ImproperlyConfigured(   t   setting_changed(   t   models(   t   import_stringt   gett   fetcht   countt	   aggregatet   existst   Defaultsc           B   sk   e  Z e Z i  Z i  Z i  Z d  „  Z e Z	 d Z e Z i  Z e j e j e j f Z d Z d Z d	 Z RS(
   c         C   s   d S(   Nt    (    (   t   query(    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyt   <lambda>   R   i   s   /tmp/cacheops_file_cachei<   i   i   Ni  i€Q i ' (   t   __name__t
   __module__t   Truet   CACHEOPS_ENABLEDt   CACHEOPS_REDISt   CACHEOPS_DEFAULTSt   CACHEOPSt   CACHEOPS_PREFIXt   Falset   CACHEOPS_LRUt   Nonet   CACHEOPS_CLIENT_CLASSt   CACHEOPS_DEGRADE_ON_FAILUREt   CACHEOPS_SENTINELR   t	   FileFieldt	   TextFieldt   BinaryFieldt   CACHEOPS_SKIP_FIELDSt   CACHEOPS_LONG_DISJUNCTIONt   FILE_CACHE_DIRt   FILE_CACHE_TIMEOUT(    (    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyR      s   	t   Settingsc           B   s   e  Z d  „  Z RS(   c         C   sY   t  t | t  t | ƒ ƒ } | d k rH t | ƒ r9 | n	 t | ƒ } n  | |  j | <| S(   NR   (   t   getattrt   base_settingsR   t   callableR   t   __dict__(   t   selft   namet   res(    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyt   __getattr__#   s
    !(   R   R   R.   (    (    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyR&   "   s   c         K   s   t  j j |  d  ƒ S(   N(   R   R*   t   popR   (   t   settingt   kw(    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyR   ,   R   t   weakc          C   s  i d d 6t  d 6t d 6t  d 6}  |  j t j ƒ i  } xÖ t j j ƒ  D]Å \ } } | d	 k rv d	 | | j ƒ  <qH n  t	 |  | ƒ | | j ƒ  <} | d d k r° t
 | d <n  t | d t j ƒ rÚ | d h | d <n  t | d ƒ | d <d | k rH t d | ƒ ‚ qH qH W| S(
   sL   
    Prepares a dict 'app.model' -> profile, for use in model_profile()
    t   opst	   local_gett   db_agnostict   lockt   allt   timeouts:   You must specify "timeout" option in "%s" CACHEOPS profile(    N(   R   R   t   updateR   R   R   t   itemsR   t   lowerR   t   ALL_OPSt
   isinstancet   sixt   string_typest   setR   (   t   profile_defaultst   model_profilest	   app_modelt   profilet   mp(    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyt   prepare_profiles/   s*    
c         C   s~   |  j  d k r d St ƒ  } |  j j j ƒ  } |  j j } x= d | | f d | d f D] } | | k rX | | SqX Wd Sd S(   s.   
    Returns cacheops profile for a model
    t   __fake__s   %s.%ss   %s.*s   *.*N(   R   R   RF   t   _metat	   app_labelR;   t
   model_name(   t   modelRB   t   appRJ   t   guess(    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyt   model_profileQ   s    	$(   R>   t   funcyR    R   R   t   django.confR   R(   t   django.core.exceptionsR   t   django.core.signalsR   t	   django.dbR   t   django.utils.module_loadingR   R<   R   t   objectR&   t   connectR   RF   RN   (    (    (    s/   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/conf.pyt   <module>   s   		"