
    ܙd[                        d 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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mZ ddl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 Z  G d de          Z! G d de!          Z" G d de          Z# G d de$          Z% G d de%e#          Z& G d de%e#          Z' G d de%e#          Z( G d de#          Z) G d de          Z* G d d e*          Z+ G d! d"e*          Z, G d# d$e$          Z- G d% d&e!          Z. G d' d(e.          Z/ e0d)g          Z1d* Z2dS )+z+
Caching mechanism for compiled functions.
    )ABCMetaabstractmethodabstractpropertyN)AppDirs)NumbaWarning)BaseContext)CodeLibrary)CompileResult)configcompilerdumpsc                 J    t           j        r| |z  } t          |            d S d S N)r   DEBUG_CACHEprint)msgargss     2lib/python3.11/site-packages/numba/core/caching.py
_cache_logr      s/     Djc




     c                       e Zd Zed             Zed             Zed             Zed             Zed             Z	ed             Z
dS )_Cachec                     dS )zW
        The base filesystem path of this cache (for example its root folder).
        N selfs    r   
cache_pathz_Cache.cache_path&         r   c                     dS )z
        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.
        Nr   r   sigtarget_contexts      r   load_overloadz_Cache.load_overload,   r   r   c                     dS )z<
        Save the overload for the given signature.
        Nr   r   r"   datas      r   save_overloadz_Cache.save_overload4   r   r   c                     dS )z#
        Enable the cache.
        Nr   r   s    r   enablez_Cache.enable:   r   r   c                     dS )z$
        Disable the cache.
        Nr   r   s    r   disablez_Cache.disable@   r   r   c                     dS )z"
        Flush the cache.
        Nr   r   s    r   flushz_Cache.flushF   r   r   N)__name__
__module____qualname__r   r   r   r$   r(   r*   r,   r.   r   r   r   r   r   $   s          
   ^   ^
   ^
   ^
   ^  r   r   )	metaclassc                   B    e Zd Zed             Zd Zd Zd Zd Zd Z	dS )	NullCachec                     d S r   r   r   s    r   r   zNullCache.cache_pathN   s    tr   c                     d S r   r   r!   s      r   r$   zNullCache.load_overloadR       r   c                     d S r   r   )r   r"   cress      r   r(   zNullCache.save_overloadU   r7   r   c                     d S r   r   r   s    r   r*   zNullCache.enableX   r7   r   c                     d S r   r   r   s    r   r,   zNullCache.disable[   r7   r   c                     d S r   r   r   s    r   r.   zNullCache.flush^   r7   r   N)
r/   r0   r1   propertyr   r$   r(   r*   r,   r.   r   r   r   r4   r4   M   sx          X            r   r4   c                       e Zd ZdZd Zed             Zed             Zed             Ze	d             Z
e	d             ZdS )	_CacheLocatorz<
    A filesystem locator for caching a given function.
    c                     |                                  }t          j        |d           t          j        |                                           d S )NT)exist_ok)dir)get_cache_pathosmakedirstempfileTemporaryFileclose)r   paths     r   ensure_cache_pathz_CacheLocator.ensure_cache_pathg   sN    ""$$
D4((((4(((..00000r   c                     dS )zA
        Return the directory the function is cached in.
        Nr   r   s    r   rC   z_CacheLocator.get_cache_pathm   r   r   c                     dS )z{
        Get a timestamp representing the source code's freshness.
        Can return any picklable Python object.
        Nr   r   s    r   get_source_stampz_CacheLocator.get_source_stamps   r   r   c                     dS )z
        Get a string disambiguator for this locator's function.
        It should allow disambiguating different but similarly-named functions.
        Nr   r   s    r   get_disambiguatorz_CacheLocator.get_disambiguatorz   r   r   c                     t           )ze
        Create a locator instance for the given function located in the
        given file.
        )NotImplementedError)clspy_funcpy_files      r   from_functionz_CacheLocator.from_function   s
     "!r   c                 f   t           j                            |          }t           j                            |          }t           j                            |          d         }t          j        |                                                                          }d	                    ||g          S )zGiven the Python file path, compute a suitable path inside the
        cache directory.

        This will reduce a file path that is too long, which can be a problem
        on some operating system (i.e. Windows 7).
        _)
rD   rI   abspathdirnamesplithashlibsha1encode	hexdigestjoin)rR   rT   rI   subpath	parentdirhasheds         r   get_suitable_cache_subpathz(_CacheLocator.get_suitable_cache_subpath   s     ww'''//$''GMM'**2.	 gnn..//99;;xxF+,,,r   N)r/   r0   r1   __doc__rJ   r   rC   rM   rO   classmethodrU   rd   r   r   r   r?   r?   b   s         1 1 1   ^
   ^   ^ " " [" - - [- - -r   r?   c                   4    e Zd ZdZd Zd Zed             ZdS )_SourceFileBackedLocatorMixinzf
    A cache locator mixin for functions which are backed by a well-known
    Python source file.
    c                     t          t          dd          rt          j        t          j                  }nt          j        | j                  }|j        |j        fS NfrozenF)getattrsysrD   stat
executable_py_filest_mtimest_size)r   sts     r   rM   z._SourceFileBackedLocatorMixin.get_source_stamp   sK    3%(( 	(((BB''B {BJ&&r   c                 *    t          | j                  S r   )str_linenor   s    r   rO   z/_SourceFileBackedLocatorMixin.get_disambiguator   s    4<   r   c                     t           j                            |          sd S  | ||          }	 |                                 n# t          $ r Y d S w xY w|S r   )rD   rI   existsrJ   OSErrorrR   rS   rT   r   s       r   rU   z+_SourceFileBackedLocatorMixin.from_function   sq    w~~g&& 	Fs7G$$	""$$$$ 	 	 	FF	    A 
AAN)r/   r0   r1   re   rM   rO   rf   rU   r   r   r   rh   rh      sW         
' ' '! ! ! 
 
 [
 
 
r   rh   c                   >     e Zd ZdZd Zd Ze fd            Z xZS )_UserProvidedCacheLocatorzd
    A locator that always point to the user provided directory in
    `numba.config.CACHE_DIR`
    c                     || _         |j        j        | _        |                     |          }t
          j                            t          j	        |          | _
        d S r   )rp   __code__co_firstlinenorv   rd   rD   rI   r`   r   	CACHE_DIR_cache_path)r   rS   rT   cache_subpaths       r   __init__z"_UserProvidedCacheLocator.__init__   sJ    '677@@7<<(8-HHr   c                     | j         S r   r   r   s    r   rC   z(_UserProvidedCacheLocator.get_cache_path       r   c                 v    t           j        sd S t          t          |           }|                    ||          S r   )r   r   superr}   rU   )rR   rS   rT   parent	__class__s       r   rU   z'_UserProvidedCacheLocator.from_function   s9     	F0#66##GW555r   )	r/   r0   r1   re   r   rC   rf   rU   __classcell__r   s   @r   r}   r}      so         I I I      6 6 6 6 [6 6 6 6 6r   r}   c                       e Zd ZdZd Zd ZdS )_InTreeCacheLocatorzn
    A locator for functions backed by a regular Python module with a
    writable __pycache__ directory.
    c                     || _         |j        j        | _        t          j                            t          j                            | j                   d          | _        d S )N__pycache__)	rp   r   r   rv   rD   rI   r`   rZ   r   )r   rS   rT   s      r   r   z_InTreeCacheLocator.__init__   sD    '67<<(F(FVVr   c                     | j         S r   r   r   s    r   rC   z"_InTreeCacheLocator.get_cache_path   r   r   N)r/   r0   r1   re   r   rC   r   r   r   r   r      s?         
W W W
         r   r   c                   4    e Zd ZdZd Zd Zed             ZdS )_UserWideCacheLocatorz
    A locator for functions backed by a regular Python module or a
    frozen executable, cached into a user-wide cache directory.
    c                     || _         |j        j        | _        t	          dd          }|j        }|                     |          }t          j        	                    ||          | _
        d S )NnumbaF)appname	appauthor)rp   r   r   rv   r   user_cache_dirrd   rD   rI   r`   r   )r   rS   rT   appdirs	cache_dirr   s         r   r   z_UserWideCacheLocator.__init__   sa    '6'U;;;*	77@@7<<	=AAr   c                     | j         S r   r   r   s    r   rC   z$_UserWideCacheLocator.get_cache_path   r   r   c                     t           j                            |          st          t          dd          sd S  | ||          }	 |                                 n# t          $ r Y d S w xY w|S rj   )rD   rI   rx   rl   rm   rJ   ry   rz   s       r   rU   z#_UserWideCacheLocator.from_function   s    w'' 	73%+H+H 	 Fs7G$$	""$$$$ 	 	 	FF	 s   A 
A('A(N)r/   r0   r1   re   r   rC   rf   rU   r   r   r   r   r      sZ         
B B B        [  r   r   c                   @    e Zd ZdZd Zd Zd Zd Zed             Z	dS )_IPythonCacheLocatorzT
    A locator for functions entered at the IPython prompt (notebook or other).
    c                     || _         t          j        |          }t          |t                    r	|| _        d S |                    d          | _        d S )Nzutf-8)rp   inspect	getsource
isinstancebytes_bytes_sourcer^   )r   rS   rT   sources       r   r   z_IPythonCacheLocator.__init__  sU     "7++fe$$ 	8!'D!'w!7!7Dr   c                     	 ddl m} n# t          $ r	 ddlm} Y nw xY wt          j                             |            d          S )Nr   )get_ipython_cache_dirnumba_cache)IPython.pathsr   ImportErrorIPython.utils.pathrD   rI   r`   )r   r   s     r   rC   z#_IPythonCacheLocator.get_cache_path  sv    
	A;;;;;;; 	A 	A 	A@@@@@@@@	A w||1133]CCCs   	 c                 X    t          j        | j                                                  S r   )r\   sha256r   r_   r   s    r   rM   z%_IPythonCacheLocator.get_source_stamp  s!    ~d011;;===r   c                     d                     | j                            d          d d                   }t          j        |                                          d d         S )Nr   T   
   )r`   r   
splitlinesr\   r   r_   )r   
firstliness     r   rO   z&_IPythonCacheLocator.get_disambiguator  sT     XXd0;;DAA"1"EFF
~j))3355crc::r   c                 8   |                     d          sQt          j                            t          j                            |                                         d          sd S  | ||          }	 |                                 n# t          $ r Y d S w xY w|S )Nz	<ipython-
ipykernel_)
startswithrD   rI   basenamerZ   rJ   ry   rz   s       r   rU   z"_IPythonCacheLocator.from_function'  s     {++	w 8 899DD\RR	 Fs7G$$	""$$$$ 	 	 	FF	 s   4B	 	
BBN)
r/   r0   r1   re   r   rC   rM   rO   rf   rU   r   r   r   r   r      sx         8 8 8
D 
D 
D> > >; ; ;   [  r   r   c                       e Zd 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d	S )
	CacheImplz
    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                 ,   |j         j        | _        	 |j        }n# t          $ r
 |j        }Y nw xY wt          j        |          }| j        D ]}|	                    ||          }| nt          d|d|          || _        t          j        |          }t          j                            t          j                            |                    d         }|d|}t!          t"          dd          }	|                     ||	          | _        d S )Nzcannot cache function z : no locator available for file r   .abiflags )r   r   rv   r1   AttributeErrorr/   r   getfile_locator_classesrU   RuntimeError_locatorrD   rI   splitextr   rl   rm   get_filename_base_filename_base)
r   rS   qualnamesource_pathrR   locatorfilenamemodnamefullnamer   s
             r   r   zCacheImpl.__init__C  s:   '6	(+HH 	( 	( 	('HHH	( og..( 	H 	HC''==G" # ,08++ G H H H ?7++'""27#3#3H#=#=>>qA%ggxx03
B//"44XxHHs    //c                     |                     dd                               dd          }d}||| j                                        t          j        d         t          j        d         |fz  S )N<r   >z%s-%s.py%d%d%sr      )replacer   rO   rm   version_info)r   r   r   fixed_fullnamefmts        r   r   zCacheImpl.get_filename_base\  sl     "))#r22::3CCndl&D&D&F&F&q)3+;A+>J J 	Jr   c                     | j         S r   )r   r   s    r   filename_basezCacheImpl.filename_based  s    ""r   c                     | j         S r   )r   r   s    r   r   zCacheImpl.locatorh  s
    }r   c                     dS )z$Returns the serialized form the dataNr   r   r'   s     r   reducezCacheImpl.reducel  	     	r   c                     dS )z4Returns the de-serialized form of the *reduced_data*Nr   )r   r#   reduced_datas      r   rebuildzCacheImpl.rebuildq  r   r   c                     dS )zEReturns True if the given data is cachable; otherwise, returns False.Nr   r   s     r   check_cachablezCacheImpl.check_cachablev  r   r   N)r/   r0   r1   re   r}   r   r   r   r   r   r   r=   r   r   r   r   r   r   r   r   r   r   r   7  s          2+-,.
I I I2J J J # # X#   X   ^   ^   ^  r   r   c                   $    e Zd ZdZd Zd Zd ZdS )CompileResultCacheImplz>
    Implements the logic to cache CompileResult objects.
    c                 *    |                                 S )z4
        Returns a serialized CompileResult
        )_reduce)r   r9   s     r   r   zCompileResultCacheImpl.reduce  s     ||~~r   c                 0    t          j        j        |g|R  S )z8
        Returns the unserialized CompileResult
        )r   r
   _rebuildr   r#   payloads      r   r   zCompileResultCacheImpl.rebuild  s      %.~HHHHHr   c                    d}t          d |j        D                       rd}n|j        j        rd}|rXd|j        j                            d          d         d|}t          j        |t          | j
        j        | j                   d	S d
S )z@
        Check cachability of the given compile result.
        Nc              3   &   K   | ]}|j          V  d S r   )	can_cache.0xs     r   	<genexpr>z8CompileResultCacheImpl.check_cachable.<locals>.<genexpr>  s&      4411;444444r   zas it uses lifted codezLas it uses dynamic globals (such as ctypes pointers and large global arrays)z Cannot cache compiled function "r   rW   z" FT)anyliftedlibraryhas_dynamic_globalsfndescr   r[   warningswarn_explicitr   r   rp   rv   )r   r9   cannot_cacher   s       r   r   z%CompileResultCacheImpl.check_cachable  s     4444444 	Q3LL\- 	QPL 	 	k*0055b999<<IC"3#'=#94<I I I5tr   N)r/   r0   r1   re   r   r   r   r   r   r   r   r   |  sN           I I I    r   r   c                   8     e Zd ZdZdZd Zd Zd Z fdZ xZ	S )CodeLibraryCacheImplz<
    Implements the logic to cache CodeLibrary objects.
    Nc                 *    |                                 S )z2
        Returns a serialized CodeLibrary
        )serialize_using_object_coder   codelibs     r   r   zCodeLibraryCacheImpl.reduce  s     22444r   c                 P    |                                                     |          S )z6
        Returns the unserialized CodeLibrary
        )codegenunserialize_libraryr   s      r   r   zCodeLibraryCacheImpl.rebuild  s$     %%'';;GDDDr   c                     |j          S )z=
        Check cachability of the given CodeLibrary.
        )r   r   s     r   r   z#CodeLibraryCacheImpl.check_cachable  s     ...r   c                     t          t          |           }|                    ||          }d                    | j        |g          S )N-)r   r   r   r`   _filename_prefix)r   r   r   r   resr   s        r   r   z&CodeLibraryCacheImpl.get_filename_base  sB    +T22&&x::xx.4555r   )
r/   r0   r1   re   r  r   r   r   r   r   r   s   @r   r   r     sz          5 5 5E E E/ / /6 6 6 6 6 6 6 6 6r   r   c                   t    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d Zej        d             ZdS )IndexDataCacheFilezP
    Implements the logic for the index file and data file used by a cache.
    c                     || _         |d| _        t          j                            | j         | j                  | _        |d| _        || _        t          j	        | _
        d S )Nz.nbiz.{number:d}.nbc)r   _index_namerD   rI   r`   _index_path_data_name_pattern_source_stampr   __version___version)r   r   r   source_stamps       r   r   zIndexDataCacheFile.__init__  s\    %'4}}67<<(8$:JKK9F"H))r   c                 0    |                      i            d S r   )_save_indexr   s    r   r.   zIndexDataCacheFile.flush  s    r   c                 h   |                                  }	 ||         }n}# t          $ rp t          |                                          }t	          j        d          D ]}|                     |          }||vr n|||<   |                     |           Y nw xY w|                     ||           dS )z?
        Save a new cache entry with *key* and *data*.
        r   N)	_load_indexKeyErrorsetvalues	itertoolscount
_data_namer  
_save_data)r   keyr'   	overloads	data_nameexistingis          r   savezIndexDataCacheFile.save  s     $$&&		(!#II 	( 	( 	(9++--..H_Q''   OOA..	H,,E -&IcNY'''''	( 		4(((((s    A7BBc                     |                                  }|                    |          }|dS 	 |                     |          S # t          $ r Y dS w xY w)z0
        Load a cache entry with *key*.
        N)r  get
_load_datary   )r   r  r  r  s       r   loadzIndexDataCacheFile.load  sj     $$&&	MM#&&	F	??9--- 	 	 	FF	r{   c                 d   	 t          | j        d          5 }t          j        |          }|                                }ddd           n# 1 swxY w Y   n# t
          $ r i cY S w xY w|| j        k    ri S t          j        |          \  }}t          d| j                   || j	        k    ri S |S )z|
        Load the cache index and return it as a dictionary (possibly
        empty if cache is empty or obsolete).
        rbNz[cache] index loaded from %r)
openr	  pickler#  readFileNotFoundErrorr  loadsr   r  )r   fversionr'   stampr  s         r   r  zIndexDataCacheFile._load_index  s   
	d&--   +a..vvxx                              ! 	 	 	III	 dm## I!<--y143CDDDD&&& Is4   A )A A AA AA A'&A'c                 2   | j         |f}|                     |          }|                     | j                  5 }t	          j        | j        |d           |                    |           d d d            n# 1 swxY w Y   t          d| j                   d S )NrW   )protocolz[cache] index saved to %r)	r  _dump_open_for_writer	  r'  dumpr  writer   )r   r  r'   r+  s       r   r  zIndexDataCacheFile._save_index  s    !9,zz$!!$"233 	qKq26666GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	.0@AAAAAs   2A77A;>A;c                     |                      |          }t          |d          5 }|                                }d d d            n# 1 swxY w Y   t          j        |          }t          d|           |S )Nr%  z[cache] data loaded from %r)
_data_pathr&  r(  r'  r*  r   )r   namerI   r+  r'   tups         r   r"  zIndexDataCacheFile._load_data  s    t$$$ 	6688D	 	 	 	 	 	 	 	 	 	 	 	 	 	 	l4  0$777
s   AAAc                     |                      |          }|                     |          }|                     |          5 }|                    |           d d d            n# 1 swxY w Y   t	          d|           d S )Nz[cache] data saved to %r)r0  r5  r1  r3  r   )r   r6  r'   rI   r+  s        r   r  zIndexDataCacheFile._save_data  s    zz$t$$!!$'' 	1GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	-t44444s    A""A&)A&c                 8    | j                             |          S )N)number)r
  format)r   r:  s     r   r  zIndexDataCacheFile._data_name  s    &--V-<<<r   c                 L    t           j                            | j        |          S r   )rD   rI   r`   r   )r   r6  s     r   r5  zIndexDataCacheFile._data_path"  s    w||D,d333r   c                      t          |          S r   r   )r   objs     r   r0  zIndexDataCacheFile._dump%  s    Szzr   c              #   F  K   t          j                    j        dd         }|d|}	 t          |d          5 }|V  ddd           n# 1 swxY w Y   t	          j        ||           dS # t          $ r( 	 t	          j        |           n# t          $ r Y nw xY w w xY w)z
        Open *filepath* for writing in a race condition-free way (hopefully).
        uuid4 is used to try and avoid name collisions on a shared filesystem.
        N   z.tmp.wb)	uuiduuid4hexr&  rD   r   	Exceptionunlinkry   )r   filepathuidtmpnamer+  s        r   r1  z"IndexDataCacheFile._open_for_write(  s      jllss#!)33/
	gt$$               Jw))))) 	 	 		'""""   	sR   A. A A. AA. AA. .
B 9BB 
BB BB N)r/   r0   r1   re   r   r.   r  r#  r  r  r"  r  r  r5  r0  
contextlibcontextmanagerr1  r   r   r   r  r    s         * * *  ) ) )&    2B B B  5 5 5= = =4 4 4       r   r  c                       e Zd 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dS )Cachea<  
    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.
    Nc                 j   t          |          | _        || _        |                     |          | _        | j        j                                        | _        | j        j                                        }| j        j	        }t          | j        ||          | _        |                                  d S )N)r   r   r  )repr_name_py_func_impl_class_implr   rC   r   rM   r   r  _cache_filer*   )r   rS   r  r   s       r   r   zCache.__init__V  s    ']]
%%g..
:-<<>>z)::<<
0-9I<I;GI I I 	r   c                 2    d| j         j        d| j        dS )Nr   z	 py_func=r   )r   r/   rP  r   s    r   __repr__zCache.__repr__c  s      $(N$;$;$;TZZZHHr   c                     | j         S r   r   r   s    r   r   zCache.cache_pathf  s    r   c                     d| _         d S )NT_enabledr   s    r   r*   zCache.enablej  s    r   c                     d| _         d S )NFrY  r   s    r   r,   zCache.disablem  s    r   c                 8    | j                                          d S r   )rT  r.   r   s    r   r.   zCache.flushp  s         r   c                     |                                  |                                 5  |                     ||          cddd           S # 1 swxY w Y   dS )zr
        Load and recreate the cached object for the given signature,
        using the *target_context*.
        N)refresh!_guard_against_spurious_io_errors_load_overloadr!   s      r   r$   zCache.load_overloads  s     	   3355 	< 	<&&sN;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<s   AAAc                     | j         sd S |                     ||                                          }| j                            |          }|| j                            ||          }|S r   )rZ  
_index_keyr   rT  r#  rS  r   )r   r"   r#   r  r'   s        r   r`  zCache._load_overload~  sh    } 	Fooc>#9#9#;#;<<$$S)):%%nd;;Dr   c                     |                                  5  |                     ||           ddd           dS # 1 swxY w Y   dS )zE
        Save the data for the given signature in the cache.
        N)r_  _save_overloadr&   s      r   r(   zCache.save_overload  s     3355 	+ 	+T***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   9= =c                 ,   | j         sd S | j                            |          sd S | j        j                                         |                     ||j                  }| j                            |          }| j        	                    ||           d S r   )
rZ  rS  r   r   rJ   rb  r   r   rT  r  )r   r"   r'   r  s       r   rd  zCache._save_overload  s    } 	Fz((.. 	F
,,...ooc4<00z  &&c4(((((r   c              #      K   t           j        dk    r5	 d V  d S # t          $ r!}|j        t          j        k    r Y d }~d S d }~ww xY wd V  d S )Nnt)rD   r6  ry   errnoEACCES)r   es     r   r_  z'Cache._guard_against_spurious_io_errors  sw      7d??   7el** +*****
 EEEEEs    
AA  Ac                    | j         j        j        }| j         j        3t	          d | j         j        D                       }t          |          }nd}d }||                                 ||           ||          ffS )a
  
        Compute index key for the given signature and codegen.
        It includes a description of the OS, target architecture and hashes of
        the bytecode for the function and, if the function has a __closure__,
        a hash of the cell_contents.
        Nc                     g | ]	}|j         
S r   )cell_contentsr   s     r   
<listcomp>z$Cache._index_key.<locals>.<listcomp>  s    NNNq1?NNNr   r   c                 N    t          j        |                                           S r   )r\   r   r_   )r   s    r   <lambda>z"Cache._index_key.<locals>.<lambda>  s    7>!,,6688 r   )rQ  r   co_code__closure__tupler   magic_tuple)r   r"   r   	codebytescvars	cvarbyteshashers          r   rb  zCache._index_key  s     M*2	=$0NNDM4MNNNOOE eIII88W((**VVI->->-3VI->->-A B 	Br   )r/   r0   r1   re   rR  r   rV  r=   r   r*   r,   r.   r$   r`  r(   rd  rJ  rK  r_  rb  r   r   r   rM  rM  =  s         , K  I I I     X     ! ! !< < <  + + +) ) )   B B B B Br   rM  c                       e Zd ZdZeZdS )FunctionCachezF
    Implements Cache that saves and loads CompileResult objects.
    N)r/   r0   r1   re   r   rR  r   r   r   rz  rz    s          )KKKr   rz  r   c                       t           vsJ t                                            G  fddt                     G fddt                    }|S )z
    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.
    c                       e Zd Z ZdS )6make_library_cache.<locals>.CustomCodeLibraryCacheImplN)r/   r0   r1   r  )prefixs   r   CustomCodeLibraryCacheImplr}    s        !r   r  c                       e Zd ZdZ ZdS )(make_library_cache.<locals>.LibraryCachez
        Implements Cache that saves and loads CodeLibrary objects for additional
        feature for the specified python function.
        N)r/   r0   r1   re   rR  )r  s   r   LibraryCacher    s         	 	 1r   r  )_lib_cache_prefixesaddr   rM  )r~  r  r  s   ` @r   make_library_cacher    s     ,,,,,F###" " " " " " "%9 " " "1 1 1 1 1 1 1u 1 1 1 r   )3re   abcr   r   r   rJ  rh  r\   r   r  rD   r'  rm   rF   rB  r   numba.misc.appdirsr   r   numba.core.errorsr   numba.core.baser   numba.core.codegenr	   numba.core.compilerr
   
numba.corer   r   numba.core.serializer   r   r   r4   r?   objectrh   r}   r   r   r   r   r   r   r  rM  rz  r  r  r  r   r   r   <module>r     s   
 : 9 9 9 9 9 9 9 9 9            				  



    & & & & & &  * * * * * * ' ' ' ' ' ' * * * * * * - - - - - - ' ' ' ' ' ' ' ' & & & & & &  & & & & &w & & & &R       *6- 6- 6- 6- 6-g 6- 6- 6- 6-r    F   @6 6 6 6 6 =} 6 6 6,         7          9=   @4 4 4 4 4= 4 4 4nB B B B B' B B B BJ! ! ! ! !Y ! ! !H6 6 6 6 69 6 6 6>{ { { { { { { {|{B {B {B {B {BF {B {B {B|) ) ) ) )E ) ) ) c2$ii     r   