
P'^c           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z m Z m Z m	 Z	 m
 Z
 m Z m Z m Z d  d l m Z m Z m Z m Z d d l m Z m Z d  d l Z d  d l m Z m Z d  d l m Z d  d	 l m Z d  d
 l m Z m  Z  d  d l! m" Z" d  d l# m$ Z$ d  d l% m& Z& m' Z' m( Z( m) Z) d d l* m+ Z+ m, Z, m- Z- d d l. m/ Z/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 d d l4 m5 Z5 d d l6 m7 Z7 m8 Z8 m9 Z9 d d l: m; Z; d d l< m= Z= m> Z> m? Z? d d l@ mA ZA d d lB mC ZC d d d f ZD i  ZE e8 f  d d   ZF d   ZG d   ZH d eI f d     YZJ d   ZK e jL   ZM d  eI f d!     YZN eO eO eO eO eO eO e d"  ZP e d#    ZQ d S($   iN(   t   random(   t   select_keyst   cached_propertyt   oncet   once_pert   monkeyt   wrapst   walkt   chain(   t   lmapt   mapt   lcatt	   join_withi   (   t   picklet   md5(   t	   smart_strt
   force_text(   t   ImproperlyConfigured(   t   DEFAULT_DB_ALIAS(   t   Managert   Model(   t   QuerySet(   t   EmptyResultSet(   t   pre_savet	   post_savet   post_deletet   m2m_changed(   t   model_profilet   settingst   ALL_OPS(   t
   monkey_mixt   stamp_fieldst   func_cache_keyt   cached_view_fabt   family_has_profile(   t
   get_prefix(   t   redis_clientt   handle_connection_failuret   load_script(   t   dnfs(   t   invalidate_objt   invalidate_dictt   no_invalidation(   t   transaction_states(   t
   cache_readt	   cached_ast   cached_view_ast   install_cacheopst    c      	   C   sc   t  j |  r d St d t j  d |  | | g d t j | d  t j | d t | g  d S(   s   
    Writes data to cache and creates appropriate invalidators.

    If precall_key is not the empty string, the data will only be cached if the
    precall_key is set to avoid caching stale data.
    Nt   cache_thingt   keyst   argsit   default(	   R+   t   is_dirtyR&   R   t   CACHEOPS_LRUR   t   dumpst   jsont   str(   t   prefixt	   cache_keyt   datat	   cond_dnfst   timeoutt   dbst   precall_key(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR1   #   s    	c             s  | j  d d   | j  d d  } | j  d t   | j  d d   | j  d t   |  so t d   n  | r t d d j |    n  t |   d	 k r t |  d
 t  r d   Sd   } t	 | |   } t d   | D   t
 t t t |     g  | D] } | j d t  ^ q
  j |   d k rZt d   | D   n   d k rt d   | D   n          f d   } | S(   sG  
    Caches results of a function and invalidates them same way as given queryset(s).
    NOTE: Ignores queryset cached ops settings, always caches.

    If keep_fresh is True, this will prevent caching if the given querysets are
    invalidated during the function call. This prevents prolonged caching of
    stale data.
    R>   t   extrat   key_funct   lockt
   keep_freshs3   Pass a queryset, a model or an object to cache likes   Unexpected keyword arguments %ss   , i   i    c         S   s   |  S(   N(    (   t   func(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   <lambda>N   R0   c         S   sq   t  |  t  r- |  j j j d |  j  } n6 t  |  t  r] t |  t  r] |  j j   } n |  } | j	   | S(   Nt   pk(
   t
   isinstanceR   t	   __class__t   objectst   filterRG   t   typet
   issubclasst   allt   _require_cacheprofile(   t   samplet   queryset(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _get_querysetP   s    
c         S   s   h  |  ] } | j   q S(    (   t   db(   t   .0t   qs(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <setcomp>]   s   	 R:   c         s   s   |  ] } | j  d  Vq d S(   R>   N(   t   _cacheprofile(   RT   RU   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <genexpr>b   s    c         s   s   |  ] } | j  d  Vq d S(   RC   N(   RV   (   RT   RU   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <genexpr>d   s    c      	      s4   t              f d    } | S(   Nc             sH  t  j s t j   r&  |  |   St d  d   d   } | d   |  |   } t j | d   } t j d d  d  d | d  k	  | d  k	 r t
 j |  S r  |  |  t   g  } | d | } t | | d	    d  n d
 }  |  |   } t | | |    d  d | | SWd  QXd  S(   NRE   t
   _cond_dnfsR?   s   as:RC   t   sendert   hits   asp:t   PRECALLR0   R@   (   R   t   CACHEOPS_ENABLEDR+   R5   R#   R$   t   gettingR,   t   sendt   NoneR   t   loadsR    R1   (   R3   t   kwargsR:   R;   t
   cache_datat   suffixR@   t   result(   R=   R?   RE   RD   t	   key_extraRB   RC   R>   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   wrapperg   s"    "(   R   (   RE   Re   (   R=   R?   RD   Rd   RB   RC   R>   (   RE   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt	   decoratorf   s    0"N(   t   popR^   R    t   Falset	   TypeErrort   joint   lenRH   t   listR	   R   R   R
   R'   t
   _cache_keyt   appendt   mint   any(   t   samplesR`   RA   RR   t	   querysetsRU   Rf   (    (   R=   R?   RD   Rd   RB   RC   R>   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR-   8   s.    	%	%!$c          O   s   t  t  |  |   S(   N(   R!   R-   (   Rq   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR.      s    t   QuerySetMixinc           B   s.  e  Z e d     Z e d    Z d   Z e d  Z e d    Z e d    Z	 d   Z
 d   Z d d d d  Z d	   Z d
 d  Z d   Z e j d k r d   Z d   Z n d e d  Z d e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s#   t  |  j  } | r | j   Sd  S(   N(   R   t   modelt   copyR^   (   t   selft   profile(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRV      s    c         C   s   d S(   Ni  (    (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _cloning   s    c         C   s>   |  j  d  k r: t d |  j j j |  j j j f   n  d  S(   Ns|   Cacheops is not enabled for %s.%s model.
If you don't want to cache anything by default you can configure it with empty ops.(   RV   R^   R   Rt   t   _metat	   app_labelt
   model_name(   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRO      s    c         C   s  t    } | j d |  j j |  j j f  | j d |  j j |  j j f  | j t |  j   ym |  j j |  j	  j
   \ } } y | | } Wn$ t k
 r | t t |  } n X| j t |   Wn t k
 r n X|  j r|  j d r| j |  j	  n  t |  d d  } | rH| j d | j | j f  n  t |  d  rp| j t |  j   n  d | j   } | r|  j | S| S(   s7   
        Compute a cache key for this queryset
        s   %s.%st   db_agnostict   _iterable_classt   flats   q:%sN(   R   t   updateRI   t
   __module__t   __name__Rt   R   t   queryt   get_compilerRS   t   as_sqlt   UnicodeDecodeErrorR   R   R   R   RV   t   getattrR^   t   hasattrR9   R~   t	   hexdigestt   _prefix(   Rv   R:   t   mdt   sqlt   paramst   sql_strt   it_classR;   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRm      s,    	##! c         C   s   t  d |   S(   Nt	   _queryset(   R#   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR      s    c         C   s
   t  |   S(   N(   R'   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRW      s    c         C   s3   t  |  j | | |  j |  j d d |  j g d  S(   NR>   R?   (   R1   R   RW   RV   RS   (   Rv   R;   t   results(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _cache_results   s    c         C   sA   t  j o@ |  j o@ | |  j d k o@ |  j o@ t |  j j   S(   Nt   ops(   R   R[   RV   t
   _for_writeR+   RS   R5   (   Rv   t   op(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _should_cache   s    	
c         C   s   |  j    | d k s" | d k r+ t } n  t | t  rF | h } n  t |  |  j d <| d k	 ru | |  j d <n  | d k	 r | |  j d <n  |  S(   s  
        Enables caching for given ops
            ops        - a subset of {'get', 'fetch', 'count', 'exists', 'aggregate'},
                         ops caching to be turned on, all enabled by default
            timeout    - override default cache timeout
            lock       - use lock to prevent dog-pile effect

        NOTE: you actually can disable caching by omiting corresponding ops,
              .cache(ops=[]) disables caching for this queryset.
        RN   R   R>   RC   N(   RO   R^   R   RH   R9   t   setRV   (   Rv   R   R>   RC   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   cache   s    
	c         C   s'   |  j  d k r |  S|  j d g   Sd S(   sI   
        Convinience method, turns off caching for this queryset
        R   N(   RV   R^   R   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   nocache   s    i  c         C   s   | |  _  |  S(   N(   Rx   (   Rv   t   cloning(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR      s    	c         C   s   |  j  d  S(   Ni    (   R   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   inplace   s    i   i	   c         K   s.   |  j  r |  j |   S|  j j |  |  Sd  S(   N(   Rx   t   clonet   __dict__R   (   Rv   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _clone  s    	c         K   s_   |  j  j |  |  } |  j r+ |  j d n d | _ |  j j d  r[ |  j j   | _ n  | S(   Ni   i    RV   (   t
   _no_monkeyR   Rx   R   t   getRV   Ru   (   Rv   R`   R   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s
    c            s}    j  r  j | | |  S| d  k	 re  j j      f d   } |  j _  j | | |  S j j |   Sd  S(   Nc              s      j  _  j  S(   N(   R   R   (    (   t   original_query_cloneRv   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   query_clone  s    (   Rx   R   R^   R   R   R   (   Rv   t   klasst   setupR`   R   (    (   R   Rv   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    	c         K   se   |  j  j |  | | |  } |  j r1 |  j d n d | _ |  j j d  ra |  j j   | _ n  | S(   Ni   i    RV   (   R   R   Rx   R   R   RV   Ru   (   Rv   R   R   R`   R   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   $  s
    c         C   s  |  j  d  k	 s |  j d  r/ |  j j |   S|  j   } |  j d } t j | d |  } t	 j
 d |  j d d  d | d  k	  | d  k	 r t j |  |  _  nR t |  d  r t |  j |    |  _  n t |  j    |  _  |  j | |  j   Wd  QX|  j j |   S(   Nt   fetchRC   RX   RE   RY   R}   (   t   _result_cacheR^   R   R   t
   _fetch_allRm   RV   R$   R\   R,   R]   Rt   R   R_   R   Rl   R}   t   iteratorR   (   Rv   R;   RC   Ra   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   ,  s    %c            s[     j  d  rG   j d  k	 r+ t   j  St      f d      S  j j    Sd  S(   Nt   countc              s     j  j    S(   N(   R   R   (    (   Rv   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   K  R0   (   R   R   R^   Rk   R-   R   R   (   Rv   (    (   Rv   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   E  s
    c            s    j  d  r  j    x   D] } |  | j <q" W j   } x3  j   D]% \ } } | j j | | d t qR Wt |      f d      S j	 j
      Sd  S(   Nt	   aggregatet
   is_summaryc              s    j  j      S(   N(   R   R   (    (   R3   R`   Rv   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   [  R0   (   R   Ru   t   default_aliasR   t   itemsR   t   add_annotationt   TrueR-   R   R   (   Rv   R3   R`   t   argRU   t   aliast   aggregate_expr(    (   R3   R`   Rv   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   O  s    "c         O   s	  |  j  d  r |  j d r | r |  j j r |  j j j r |  j |  j f t t	 | j
     } y t | SWq t k
 r |  j j |  | |  t | <t | St k
 r q Xn  d |  j d k r |  } q |  j   j   } n |  } | j j | | |  S(   NR   t	   local_getR   R   (   R   RV   R   t   select_relatedt   wheret   childrenRI   Rt   t   tuplet   sortedR   t   _local_get_cachet   KeyErrorR   R   Ri   R   R   (   Rv   R3   R`   t   keyRU   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   _  s$    (	c         C   s;   |  j  d  r+ |  j j |  j   j    S|  j j |   S(   NR   (   R   R   t   firstR   R   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         C   s;   |  j  d  r+ |  j j |  j   j    S|  j j |   S(   NR   (   R   R   t   lastR   R   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c            s[     j  d  rG   j d  k	 r+ t   j  St      f d      S  j j    Sd  S(   Nt   existsc              s     j  j    S(   N(   R   R   (    (   Rv   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF     R0   (   R   R   R^   t   boolR-   R   R   (   Rv   (    (   Rv   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s
    c         O   sU   |  j  j |  | | |  } t |  j  rQ x$ | D] } t | d |  j q1 Wn  | S(   Nt   using(   R   t   bulk_createR"   Rt   R(   RS   (   Rv   t   objsR3   R`   t   obj(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s
    c         K   s   |  j    j   } t | _ t |  } | j |   } d   | D } |  j j j d |  j	 | j
  } x* t | |  D] } t | d | j
 qz W| S(   Nc         S   s   h  |  ] } | j   q S(    (   RG   (   RT   R   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <setcomp>  s   	 t   pk__inR   (   R   R   R   R   Rl   R   Rt   RJ   RK   R   RS   R   R(   (   Rv   R`   R   RJ   t   rowst   pkst   new_objectsR   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   invalidated_update  s    	$N(   i   i	   (   R   R   R   RV   Rx   RO   R   Rm   R   RW   R   R   R^   R   R   R   R   t   djangot   VERSIONR   R   Rh   R   R   R   R   R   R   R   R   R   (    (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRs      s4   	"			
				
		)				c         C   s>   |  j  } g  |  _  |  j | d | d t |  j  | 7_  d  S(   NRX   t   weak(   t	   receiverst   connectRh   (   t   signalt   receiverRX   t   old_receivers(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   connect_first  s    		t   ManagerMixinc           B   se   e  Z e d   d    Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   t   clsc         C   s~   t  t |  j d | t  t |  j d | t  t |  j d | t j | j	 } t
 | | j  sz t | | j |  n  d  S(   NRX   (   R   R   t	   _pre_saveR   t
   _post_saveR   t   _post_deletet   syst   modulesR   R   R   t   setattr(   Rv   R   t   module(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   _install_cacheops  s    c         C   sE   |  j  j |  | |  | j d k rA t |  rA |  j |  n  d  S(   Nt   __fake__(   R   t   contribute_to_classR   R"   R   (   Rv   R   t   name(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         K   sw   | j  d  k p! | j j p! t j ss y5 | j j |  j d | j   t	 j
 | | j  f <Wqs | j k
 ro qs Xn  d  S(   NRG   (   RG   R^   t   _statet   addingR*   t   activeRJ   R   R   t	   _old_objsR   t   DoesNotExist(   Rv   RX   t   instanceR   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s
    $5c         K   sH  t  j s d  St j j | | j f d   } | rD t | d | n  t | d | t | j	   rh d  St
 | j  } | s d  S| j d  } | rDt d | j  } x | D] }	 | j |	 =q W| t k r d n | }
 i t | |
  |
 6} | j j   j |  j |   j   } | j | j   | g  | j j |  n  d  S(   NR   t   cache_on_saves   ^_.*_cache$RG   (   R   R[   R   R   Rg   RG   R^   R(   R+   R5   R   RI   R   R   R   R   RJ   R   R   RK   t   order_byR   Rm   R   (   Rv   RX   R   R   R`   t   oldt   cacheprofileR   t   unwanted_dictt   kR   t   condRU   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s*    	'c         K   s   t  | d | d S(   s4   
        Invalidation upon object deletion.
        R   N(   R(   (   Rv   RX   R   R   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         C   s   |  j    j   S(   N(   t   get_querysetR   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         O   s   |  j    j | |   S(   N(   R   R   (   Rv   R3   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         C   s   |  j    j   S(   N(   R   R   (   Rv   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    c         K   s   |  j    j   j |   S(   N(   R   R   R   (   Rv   R`   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s    (   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR     s   			-				c            s?   j  j s d S| d k r  d St j d k r; d     n	 d     t    f d	   | j  j | j  j D  } | j   | j   }	 }
 | r |
 |	 }	 }
 n  | d k r  j j	 |  j
 i | j |	 6  } xe | D] } t | d
 | q WnD | d k r;x5 | D]* } t  i | j |	 6| |
 6d
 | q
Wn  d S(   s-   
    Invoke invalidation on m2m changes.
    Nt	   pre_cleart   post_addt
   pre_removei   i	   c         S   s   |  j  S(   N(   t   remote_field(   t   f(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   )  R0   c         S   s   |  j  S(   N(   t   rel(   R   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   +  R0   c         3   s*   |  ]  }   |  j   k r | Vq d  S(   N(   t   through(   RT   t   m2m(   t
   get_remoteRX   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <genexpr>,  s    R   (   R   R   R   (   i   i	   (   R   R   (   Ry   t   auto_createdR   R   t   nextt   many_to_manyt   m2m_column_namet   m2m_reverse_nameRJ   R   RK   RG   R(   R)   (   RX   R   Rt   t   actiont   pk_sett   reverseR   R`   R   t   instance_columnt   model_columnRJ   R   RG   (    (   R   RX   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   invalidate_m2m  s*    	/%	

c       	      s$  t  t t  t  t t  d d l m }  x|  j d t  D]} t	 |  r= t
 | j t  s t d | j j | j j f   n  | j j |  t j d k r d n d } d	   | j j d
 t  D } xl | D]a } t | d  r | n t | | |  } | j j } t j t d | j d | j | j f q Wq= q= W|  j d  rd d l m } t |   f d     n  t j rd d l  } | j! t" d    n  t j# rd d l$ }	 |	 j! t% d    n  d t& j' k od k  n r d d l( m)     f d   }
 |
   _* n  d S(   s6   
    Installs cacheops by numerous monkey patches
    i(   t   appst   include_auto_createdsR   Can't install cacheops for %s.%s model: non-django model class or manager is used.i   i	   R   R   c         s   s   |  ] } | j  r | Vq d  S(   N(   R   (   RT   R   (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pys	   <genexpr>W  s    t   include_hiddenR   RX   t   dispatch_uids   django.contrib.admin(   t
   ModelAdminc            s     j  |  |  j   S(   N(   t   originalR   (   Rv   t   request(   R   (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR   b  s    Nc         S   s   t  t |   f f S(   N(   t   buffert   bytes(   t   b(    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   i  R0   c         S   s   t  t |   f f S(   N(   t
   memoryviewR  (   R	  (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyRF   l  R0   i   i   (   t   Qc            s9   t    |   j d t |  t t | j      d  S(   NR   (   t   supert   __init__Rl   R   R   (   Rv   R3   R`   (   R  (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt	   Q__init__r  s    (   i   i	   (   i   i   (   i   i   (+   R   R   R   R   Rs   t   django.appsR   t
   get_modelsR   R"   RH   t   _default_managerR   Ry   Rz   R{   R   R   R   t
   get_fieldsR   R   R   R   R   R   t   is_installedt   django.contrib.admin.optionsR  R   t   sixt   PY2t   copy_regR   R  t   PY3t   copyregR
  R   t   version_infot   django.db.models.query_utilsR  R  (   R   Rt   t   rel_attrt   m2msR   R   t   optsR  R  R  R  (    (   R  R   s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyR/   A  s:    '		(R   R   R8   t	   threadingR  R    t   funcyR   R   R   R   R   R   R   R   t	   funcy.py3R	   R
   R   R   t   crossR   R   R   t   django.utils.encodingR   R   t   django.core.exceptionsR   t	   django.dbR   t   django.db.modelsR   R   t   django.db.models.queryR   t#   django.db.models.sql.datastructuresR   t   django.db.models.signalsR   R   R   R   t   confR   R   R   t   utilsR   R   R    R!   R"   t   shardingR#   t   redisR$   R%   R&   t   treeR'   t   invalidationR(   R)   R*   t   transactionR+   t   signalsR,   t   __all__R   R1   R-   R.   t   objectRs   R   t   localR   R   R^   R   R/   (    (    (    s0   /tmp/pip-unpacked-wheel-CLcuMp/cacheops/query.pyt   <module>   sJ   :""(	U	 "	`%