
\K]c           @` s  d  Z  d d l m Z m Z m Z d d l m Z m Z m Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z 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   Z& d   Z' e e  d e( f d     Y Z) d e) f d     YZ* e e  d e( f d     Y Z+ d e( f d     YZ, d e, e+ f d     YZ- d e, e+ f d     YZ. d e, e+ f d     YZ/ d e+ f d     YZ0 e e  d  e( f d!     Y Z1 d" e1 f d#     YZ2 d$ e1 f d%     YZ3 d& e( f d'     YZ4 d( e) f d)     YZ5 d* e5 f d+     YZ6 e7 d, g  Z8 d-   Z9 d S(.   s+   
Caching mechanism for compiled functions.
i    (   t   print_functiont   divisiont   absolute_import(   t   ABCMetat   abstractmethodt   abstractpropertyNi   (   t   cPickle(   t   AppDirs(   t   add_metaclass(   t   compilert   configt   utils(   t   NumbaWarning(   t   BaseContext(   t   CodeLibrary(   t   CompileResultc         C` sa   t  |  t  r |  j   St  |  t  r/ |  j St  |  t  rK |  j j   St t |     d S(   s?   
    Returns the Codegen associated with the given object.
    N(   t
   isinstanceR   t   codegenR   R   t   target_contextt	   TypeErrort   type(   t   obj(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   _get_codegen   s    
c         G` s$   t  j r  |  | }  t |   n  d  S(   N(   R
   t   DEBUG_CACHEt   print(   t   msgt   args(    (    s,   lib/python2.7/site-packages/numba/caching.pyt
   _cache_log,   s    	
t   _Cachec           B` sb   e  Z e d     Z e d    Z e d    Z e d    Z e d    Z e d    Z	 RS(   c         C` s   d S(   sW   
        The base filesystem path of this cache (for example its root folder).
        N(    (   t   self(    (    s,   lib/python2.7/site-packages/numba/caching.pyt
   cache_path5   t    c         C` s   d S(   s   
        Load an overload for the given signature using the target context.
        The saved object must be returned if successful, None if not found
        in the cache.
        N(    (   R   t   sigR   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   load_overload;   R   c         C` s   d S(   s<   
        Save the overload for the given signature.
        N(    (   R   R    t   data(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   save_overloadC   R   c         C` s   d S(   s#   
        Enable the cache.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   enableI   R   c         C` s   d S(   s$   
        Disable the cache.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   disableO   R   c         C` s   d S(   s"   
        Flush the cache.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   flushU   R   (
   t   __name__t
   __module__R   R   R   R!   R#   R$   R%   R&   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   2   s   t	   NullCachec           B` sD   e  Z e d     Z d   Z d   Z d   Z d   Z d   Z RS(   c         C` s   d  S(   N(   t   None(   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   ]   s    c         C` s   d  S(   N(    (   R   R    R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR!   a   s    c         C` s   d  S(   N(    (   R   R    t   cres(    (    s,   lib/python2.7/site-packages/numba/caching.pyR#   d   s    c         C` s   d  S(   N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR$   g   s    c         C` s   d  S(   N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR%   j   s    c         C` s   d  S(   N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR&   m   s    (	   R'   R(   t   propertyR   R!   R#   R$   R%   R&   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR)   \   s   				t   _CacheLocatorc           B` sS   e  Z d  Z d   Z e d    Z e d    Z e d    Z e d    Z	 RS(   s<   
    A filesystem locator for caching a given function.
    c         C` se   |  j    } y t j |  Wn+ t k
 rJ } | j t j k rK   qK n Xt j d |  j   d  S(   Nt   dir(	   t   get_cache_patht   ost   makedirst   OSErrort   errnot   EEXISTt   tempfilet   TemporaryFilet   close(   R   t   patht   e(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   ensure_cache_pathw   s    
c         C` s   d S(   sA   
        Return the directory the function is cached in.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR/      R   c         C` s   d S(   s{   
        Get a timestamp representing the source code's freshness.
        Can return any picklable Python object.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   get_source_stamp   R   c         C` s   d S(   s   
        Get a string disambiguator for this locator's function.
        It should allow disambiguating different but similarly-named functions.
        N(    (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   get_disambiguator   R   c         C` s
   t   d S(   se   
        Create a locator instance for the given function located in the
        given file.
        N(   t   NotImplementedError(   t   clst   py_funct   py_file(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   from_function   s    (
   R'   R(   t   __doc__R:   R   R/   R;   R<   t   classmethodRA   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR-   q   s   	
t   _SourceFileBackedLocatorMixinc           B` s/   e  Z d  Z d   Z d   Z e d    Z RS(   sf   
    A cache locator mixin for functions which are backed by a well-known
    Python source file.
    c         C` sI   t  t d t  r' t j t j  } n t j |  j  } | j | j f S(   Nt   frozen(	   t   getattrt   syst   FalseR0   t   statt
   executablet   _py_filet   st_mtimet   st_size(   R   t   st(    (    s,   lib/python2.7/site-packages/numba/caching.pyR;      s    c         C` s   t  |  j  S(   N(   t   strt   _lineno(   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR<      s    c         C` sL   t  j j |  s d  S|  | |  } y | j   Wn t k
 rG d  SX| S(   N(   R0   R8   t   existsR:   R2   (   R>   R?   R@   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyRA      s    (   R'   R(   RB   R;   R<   RC   RA   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyRD      s   			t   _UserProvidedCacheLocatorc           B` s/   e  Z d  Z d   Z d   Z e d    Z RS(   sd   
    A locator that always point to the user provided directory in
    `numba.config.CACHE_DIR`
    c         C` s   | |  _  | j j |  _ t j j t j j |  j    \ } } t j j |  j	 t j j
  } t j j t j |  |  _ d  S(   N(   RK   t   __code__t   co_firstlinenoRP   R0   R8   t
   splitdrivet   abspatht   dirnamet   lstript   sept   joinR
   t	   CACHE_DIRt   _cache_path(   R   R?   R@   t   driveR8   t   subpath(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   __init__   s
    	'!c         C` s   |  j  S(   N(   R\   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR/      s    c         C` s,   t  j s d  St t |   } | j | |  S(   N(   R
   R[   t   superRR   RA   (   R>   R?   R@   t   parent(    (    s,   lib/python2.7/site-packages/numba/caching.pyRA      s    	(   R'   R(   RB   R_   R/   RC   RA   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyRR      s   		t   _InTreeCacheLocatorc           B` s    e  Z d  Z d   Z d   Z RS(   sn   
    A locator for functions backed by a regular Python module with a
    writable __pycache__ directory.
    c         C` sC   | |  _  | j j |  _ t j j t j j |  j   d  |  _ d  S(   Nt   __pycache__(	   RK   RS   RT   RP   R0   R8   RZ   RW   R\   (   R   R?   R@   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR_      s    	c         C` s   |  j  S(   N(   R\   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR/      s    (   R'   R(   RB   R_   R/   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyRb      s   	t   _UserWideCacheLocatorc           B` s/   e  Z d  Z d   Z d   Z e d    Z RS(   s   
    A locator for functions backed by a regular Python module or a
    frozen executable, cached into a user-wide cache directory.
    c         C` s   | |  _  | j j |  _ t d d d t  } | j } t j j	 |  } t j
 d k pf t t d t  s t j j |  j t j j  } n  t j j | |  |  _ d  S(   Nt   appnamet   numbat	   appauthort   ntRE   (   RK   RS   RT   RP   R   RH   t   user_cache_dirR0   R8   RW   t   nameRF   RG   RV   RX   RY   RZ   R\   (   R   R?   R@   t   appdirst	   cache_dirt   cache_subpath(    (    s,   lib/python2.7/site-packages/numba/caching.pyR_      s    		!$c         C` s   |  j  S(   N(   R\   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR/      s    c         C` s^   t  j j |  p! t t d t  s( d  S|  | |  } y | j   Wn t k
 rY d  SX| S(   NRE   (   R0   R8   RQ   RF   RG   RH   R:   R2   (   R>   R?   R@   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyRA      s    $(   R'   R(   RB   R_   R/   RC   RA   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyRd      s   		t   _IPythonCacheLocatorc           B` sA   e  Z d  Z d   Z d   Z d   Z d   Z e d    Z RS(   sT   
    A locator for functions entered at the IPython prompt (notebook or other).
    c         C` sI   | |  _  t j |  } t | t  r3 | |  _ n | j d  |  _ d  S(   Ns   utf-8(   RK   t   inspectt	   getsourceR   t   bytest   _bytes_sourcet   encode(   R   R?   R@   t   source(    (    s,   lib/python2.7/site-packages/numba/caching.pyR_     s
    	c         C` sN   y d d l  m } Wn! t k
 r7 d d l m } n Xt j j |   d  S(   Ni    (   t   get_ipython_cache_dirt   numba_cache(   t   IPython.pathsRu   t   ImportErrort   IPython.utils.pathR0   R8   RZ   (   R   Ru   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR/     s
    c         C` s   t  j |  j  j   S(   N(   t   hashlibt   sha256Rr   t	   hexdigest(   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR;   '  s    c         C` s6   d j  |  j j t  d   } t j |  j   d  S(   NR   i   i
   (   RZ   Rr   t
   splitlinest   TrueRz   R{   R|   (   R   t
   firstlines(    (    s,   lib/python2.7/site-packages/numba/caching.pyR<   *  s    c         C` sI   | j  d  s d  S|  | |  } y | j   Wn t k
 rD d  SX| S(   Ns	   <ipython-(   t
   startswithR:   R2   (   R>   R?   R@   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyRA   3  s    (	   R'   R(   RB   R_   R/   R;   R<   RC   RA   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyRn     s   	
				t
   _CacheImplc           B` s}   e  Z d  Z e e e e g Z d   Z d   Z	 e
 d    Z e
 d    Z e d    Z e d    Z e d    Z RS(   s   
    Provides the core machinery for caching.
    - implement how to serialize and deserialize the data in the cache.
    - control the filename of the cache.
    - provide the cache locator
    c   
      C` s  t  | j  |  _ | j j |  _ y | j } Wn t k
 rJ | j } n Xt	 j
 |  } xI |  j D]( } | j | |  } | d  k	 rd Pqd qd Wt d | | f   | |  _ t	 j
 |  } t j j t j j |   d } d | | f } t t d d  }	 |  j | |	  |  _ d  S(   Ns:   cannot cache function %r: no locator available for file %ri    s   %s.%st   abiflagsR   (   t   boolt   __closure__t   _is_closureRS   RT   RP   t   __qualname__t   AttributeErrorR'   Ro   t   getfilet   _locator_classesRA   R*   t   RuntimeErrort   _locatorR0   R8   t   splitextt   basenameRF   RG   t   get_filename_baset   _filename_base(
   R   R?   t   qualnamet   source_pathR>   t   locatort   filenamet   modnamet   fullnameR   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR_   M  s&    	"c         C` sR   | j  d d  j  d d  } d } | | |  j j   t j d t j d | f S(   Nt   <R   t   >s   %s-%s.py%d%d%si    i   (   t   replaceR   R<   RG   t   version_info(   R   R   R   t   fixed_fullnamet   fmt(    (    s,   lib/python2.7/site-packages/numba/caching.pyR   g  s    c         C` s   |  j  S(   N(   R   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   filename_baseo  s    c         C` s   |  j  S(   N(   R   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   s  s    c         C` s   d S(   s$   Returns the serialized form the dataN(    (   R   R"   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   reducew  s    c         C` s   d S(   s4   Returns the de-serialized form of the *reduced_data*N(    (   R   R   t   reduced_data(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   rebuild|  s    c         C` s   d S(   sE   Returns True if the given data is cachable; otherwise, returns False.N(    (   R   R"   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   check_cachable  s    (   R'   R(   RB   RR   Rb   Rd   Rn   R   R_   R   R,   R   R   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   @  s   			t   CompileResultCacheImplc           B` s)   e  Z d  Z d   Z d   Z d   Z RS(   s>   
    Implements the logic to cache CompileResult objects.
    c         C` s
   | j    S(   s4   
        Returns a serialized CompileResult
        (   t   _reduce(   R   R+   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` s   t  j j | |  S(   s8   
        Returns the unserialized CompileResult
        (   R	   R   t   _rebuild(   R   R   t   payload(    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` s   d } |  j r d } n' | j r* d } n | j j r? d } n  | r d | j j j d  d | f } t j	 | t
 |  j j |  j  t St S(   s@   
        Check cachability of the given compile result.
        s'   as it uses outer variables in a closures   as it uses lifted loopssL   as it uses dynamic globals (such as ctypes pointers and large global arrays)s&   Cannot cache compiled function "%s" %st   .iN(   R*   R   t   liftedt   libraryt   has_dynamic_globalst   fndescR   t   splitt   warningst   warn_explicitR   R   RK   RP   RH   R~   (   R   R+   t   cannot_cacheR   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    					 (   R'   R(   RB   R   R   R   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s   		t   CodeLibraryCacheImplc           B` s8   e  Z d  Z d Z d   Z d   Z d   Z d   Z RS(   s<   
    Implements the logic to cache CodeLibrary objects.
    c         C` s
   | j    S(   s2   
        Returns a serialized CodeLibrary
        (   t   serialize_using_object_code(   R   t   codelib(    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` s   | j    j |  S(   s6   
        Returns the unserialized CodeLibrary
        (   R   t   unserialize_library(   R   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` s   |  j  S(   s=   
        Check cachability of the given CodeLibrary.
        (   R   (   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` s7   t  t |   } | j | |  } d j |  j | g  S(   Nt   -(   R`   R   R   RZ   t   _filename_prefix(   R   R   R   Ra   t   res(    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    N(	   R'   R(   RB   R*   R   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s   			t   IndexDataCacheFilec           B` s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z e j d    Z RS(   sP   
    Implements the logic for the index file and data file used by a cache.
    c         C` s`   | |  _  d | f |  _ t j j |  j  |  j  |  _ d | f |  _ | |  _ t j	 |  _
 d  S(   Ns   %s.nbis   %s.{number:d}.nbc(   R\   t   _index_nameR0   R8   RZ   t   _index_patht   _data_name_patternt   _source_stampRf   t   __version__t   _version(   R   R   R   t   source_stamp(    (    s,   lib/python2.7/site-packages/numba/caching.pyR_     s    		c         C` s   |  j  i   d  S(   N(   t   _save_index(   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR&     s    c         C` s   |  j    } y | | } Wns t k
 r t | j    } x6 t j d  D]% } |  j |  } | | k rL PqL qL W| | | <|  j |  n X|  j | |  d S(   s?   
        Save a new cache entry with *key* and *data*.
        i   N(	   t   _load_indext   KeyErrort   sett   valuest	   itertoolst   countt
   _data_nameR   t
   _save_data(   R   t   keyR"   t	   overloadst	   data_namet   existingt   i(    (    s,   lib/python2.7/site-packages/numba/caching.pyt   save  s    
c         C` sU   |  j    } | j |  } | d k r+ d Sy |  j |  SWn t k
 rP d SXd S(   s0   
        Load a cache entry with *key*.
        N(   R   t   getR*   t
   _load_datat   EnvironmentError(   R   R   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   load  s    c         C` s   y: t  |  j d  " } t j |  } | j   } Wd QXWn/ t k
 rk } | j t j f k re i  S  n X| |  j k r i  St j	 |  \ } } t
 d |  j  | |  j k r i  S| Sd S(   s|   
        Load the cache index and return it as a dictionary (possibly
        empty if cache is empty or obsolete).
        t   rbNs   [cache] index loaded from %r(   t   openR   t   pickleR   t   readR   R3   t   ENOENTR   t   loadsR   R   (   R   t   ft   versionR"   R9   t   stampR   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c      	   C` ss   |  j  | f } |  j |  } |  j |  j  - } t j |  j | d d | j |  Wd  QXt d |  j  d  S(   Nt   protocolis   [cache] index saved to %r(	   R   t   _dumpt   _open_for_writeR   R   t   dumpR   t   writeR   (   R   R   R"   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` sS   |  j  |  } t | d   } | j   } Wd  QXt j |  } t d |  | S(   NR   s   [cache] data loaded from %r(   t
   _data_pathR   R   R   R   R   (   R   Rj   R8   R   R"   t   tup(    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    c         C` sT   |  j  |  } |  j |  } |  j |   } | j |  Wd  QXt d |  d  S(   Ns   [cache] data saved to %r(   R   R   R   R   R   (   R   Rj   R"   R8   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   '  s
    c         C` s   |  j  j d |  S(   Nt   number(   R   t   format(   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   .  s    c         C` s   t  j j |  j |  S(   N(   R0   R8   RZ   R\   (   R   Rj   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   1  s    c         C` s   t  j | d d S(   NR   i(   R   t   dumps(   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   4  s    c         c` s   d | t  j   f } y1 t | d   } | VWd QXt j | |  Wn9 t k
 r y t  j |  Wn t k
 r{ n X  n Xd S(   s_   
        Open *filepath* for writing in a race condition-free way
        (hopefully).
        s	   %s.tmp.%dt   wbN(   R0   t   getpidR   R   t   file_replacet	   Exceptiont   unlinkR2   (   R   t   filepatht   tmpnameR   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   7  s    (   R'   R(   RB   R_   R&   R   R   R   R   R   R   R   R   R   t
   contextlibt   contextmanagerR   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s   											t   Cachec           B` s   e  Z d  Z d Z d   Z d   Z e d    Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z e j d    Z d   Z RS(   s=  
    A per-function compilation cache.  The cache saves data in separate
    data files and maintains information in an index file.

    There is one index file per function and Python version
    ("function_name-<lineno>.pyXY.nbi") which contains a mapping of
    signatures and architectures to data files.
    It is prefixed by a versioning key and a timestamp of the Python source
    file containing the function.

    There is one data file ("function_name-<lineno>.pyXY.<number>.nbc")
    per function, function signature, target architecture and Python version.

    Separate index and data files per Python version avoid pickle
    compatibility problems.

    Note:
    This contains the driver logic only.  The core logic is provided
    by a subclass of ``_CacheImpl`` specified as *_impl_class* in the subclass.
    c         C` s   t  |  |  _ |  j |  |  _ |  j j j   |  _ |  j j j   } |  j j } t	 d |  j d | d |  |  _
 |  j   d  S(   NR   R   R   (   t   reprt   _namet   _impl_classt   _implR   R/   R\   R;   R   R   t   _cache_fileR$   (   R   R?   R   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR_   d  s    c         C` s   d |  j  j |  j f S(   Ns   <%s py_func=%r>(   t	   __class__R'   R   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   __repr__p  s    c         C` s   |  j  S(   N(   R\   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   s  s    c         C` s   t  |  _ d  S(   N(   R~   t   _enabled(   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR$   w  s    c         C` s   t  |  _ d  S(   N(   RH   R   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR%   z  s    c         C` s   |  j  j   d  S(   N(   R   R&   (   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR&   }  s    c         C` s1   | j    |  j    |  j | |  SWd QXd S(   sr   
        Load and recreate the cached object for the given signature,
        using the *target_context*.
        N(   t   refresht!   _guard_against_spurious_io_errorst   _load_overload(   R   R    R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR!     s    
c         C` s_   |  j  s d  S|  j | t |   } |  j j |  } | d  k	 r[ |  j j | |  } n  | S(   N(   R   t
   _index_keyR   R   R   R*   R   R   (   R   R    R   R   R"   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    	c         C` s'   |  j     |  j | |  Wd QXd S(   sE   
        Save the data for the given signature in the cache.
        N(   R   t   _save_overload(   R   R    R"   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR#     s    c         C` st   |  j  s d  S|  j j |  s# d  S|  j j j   |  j | t |   } |  j j |  } |  j j	 | |  d  S(   N(
   R   R   R   R   R:   R   R   R   R   R   (   R   R    R"   R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    	c         c` sR   t  j d k rI y	 d  VWqN t k
 rE } | j t j k rF   qF qN Xn d  Vd  S(   NRh   (   R0   Rj   R   R3   t   EACCES(   R   R9   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    	c         C` s   | | j    f S(   s   
        Compute index key for the given signature and codegen.
        It includes a description of the OS and target architecture.
        (   t   magic_tuple(   R   R    R   (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s    N(   R'   R(   RB   R*   R   R_   R   R,   R   R$   R%   R&   R!   R   R#   R   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR   K  s   										
t   FunctionCachec           B` s   e  Z d  Z e Z RS(   sF   
    Implements Cache that saves and loads CompileResult objects.
    (   R'   R(   RB   R   R   (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyR     s   R   c         ` s[    t  k s t  t  j   d t f  f d     Y  d t f   f d     Y} | S(   s   
    Create a Cache class for additional compilation features to cache their
    result for reuse.  The cache is saved in filename pattern like
    in ``FunctionCache`` but with additional *prefix* as specified.
    t   CustomCodeLibraryCacheImplc           ` s   e  Z   Z RS(    (   R'   R(   R   (    (   t   prefix(    s,   lib/python2.7/site-packages/numba/caching.pyR     s   t   LibraryCachec           ` s   e  Z d  Z   Z RS(   s   
        Implements Cache that saves and loads CodeLibrary objects for additional
        feature for the specified python function.
        (   R'   R(   RB   R   (    (   R   (    s,   lib/python2.7/site-packages/numba/caching.pyR     s   (   t   _lib_cache_prefixest   AssertionErrort   addR   R   (   R   R   (    (   R   R   s,   lib/python2.7/site-packages/numba/caching.pyt   make_library_cache  s
    (:   RB   t
   __future__R    R   R   t   abcR   R   R   R   R3   Rz   Ro   R   R0   t	   six.movesR   R   RG   R5   R   Rk   R   t   sixR   Rf   R   R	   R
   R   t   errorsR   t   numba.targets.baseR   t   numba.targets.codegenR   t   numba.compilerR   R   R   t   objectR   R)   R-   RD   RR   Rb   Rd   Rn   R   R   R   R   R   R   R   R   R  (    (    (    s,   lib/python2.7/site-packages/numba/caching.pyt   <module>   sR   		), (4F&p