§
    1@ÄjYq  ã                   óT  — d Z ddl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ZddlZddlmZ ddlZddl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 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( ej)        d¬¦  «        d„ ¦   «         Z* ej)        d¬¦  «        d„ ¦   «         Z+ G d„ de,¦  «        Z- G d„ de-e(¦  «        Z. G d„ de-e(¦  «        Z/ G d„ de/¦  «        Z0 G d„ d e-e(¦  «        Z1 G d!„ d"e(¦  «        Z2 G d#„ d$e-e(¦  «        Z3 G d%„ d&e¬¦  «        Z4 G d'„ d(e4¦  «        Z5 G d)„ d*e4¦  «        Z6 G d+„ d,e,¦  «        Z7 G d-„ d.e&¦  «        Z8 G d/„ d0e8¦  «        Z9 e:d1g¦  «        Z;d2„ Z<dS )3z+
Caching mechanism for compiled functions.
é    )ÚABCMetaÚabstractmethodN)ÚAppDirs)ÚPath)ÚNumbaWarningÚNumbaDeprecationWarning)ÚBaseContext)ÚCodeLibrary)ÚCompileResult)ÚconfigÚcompiler©Údumpsc                 óJ   — t           j        r| |z  } t          | ¦  «         d S d S ©N)r   ÚDEBUG_CACHEÚprint)ÚmsgÚargss     úCC:\Projects\Historical\venv\Lib\site-packages\numba/core/caching.pyÚ
_cache_logr   "   s/   € ÝÔð Ø�D‰jˆÝˆc‰
Œ
ˆ
ˆ
ˆ
ðð ó    c                   ó¢   — e Zd Ze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_overload1   r    r   c                 ó   — dS )z<
        Save the overload for the given signature.
        Nr   ©r   r#   Údatas      r   Úsave_overloadz_Cache.save_overload9   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.disableE   r    r   c                 ó   — dS )z"
        Flush the cache.
        Nr   r   s    r   Úflushz_Cache.flushK   r    r   N)Ú__name__Ú
__module__Ú__qualname__Úpropertyr   r   r%   r)   r+   r-   r/   r   r   r   r   r   (   s¾   € € € € € àØðð ñ „^ñ „Xðð
 ðð ñ „^ðð ðð ñ „^ðð
 ðð ñ „^ðð
 ðð ñ „^ðð
 ðð ñ „^ðð ð 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_pathS   s   € àˆtr   c                 ó   — d S r   r   r"   s      r   r%   zNullCache.load_overloadW   ó   € Øˆr   c                 ó   — d S r   r   )r   r#   Úcress      r   r)   zNullCache.save_overloadZ   r9   r   c                 ó   — d S r   r   r   s    r   r+   zNullCache.enable]   r9   r   c                 ó   — d S r   r   r   s    r   r-   zNullCache.disable`   r9   r   c                 ó   — d S r   r   r   s    r   r/   zNullCache.flushc   r9   r   N)
r0   r1   r2   r3   r   r%   r)   r+   r-   r/   r   r   r   r6   r6   R   sx   € € € € € Øðð ñ „Xððð ð ðð ð ðð ð ðð ð ðð ð ð ð r   r6   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_pathl   sN   € Ø×"Ò"Ñ$Ô$ˆÝ
Œ�D 4Ð(Ñ(Ô(Ð(åÔ 4Ð(Ñ(Ô(×.Ò.Ñ0Ô0Ð0Ð0Ð0r   c                 ó   — dS )zA
        Return the directory the function is cached in.
        Nr   r   s    r   rD   z_CacheLocator.get_cache_pathr   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_stampx   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_disambiguator   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 )zâGiven 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).
        éÿÿÿÿÚ_)
rE   rJ   ÚabspathÚdirnameÚsplitÚhashlibÚsha1ÚencodeÚ	hexdigestÚjoin)rT   rV   rJ   ÚsubpathÚ	parentdirÚhasheds         r   Úget_suitable_cache_subpathz(_CacheLocator.get_suitable_cache_subpathŽ   s€   € õ Œw�Š˜wÑ'Ô'ˆÝ”'—/’/ $Ñ'Ô'ˆÝ”G—M’M 'Ñ*Ô*¨2Ô.ˆ	õ ”˜gŸnšnÑ.Ô.Ñ/Ô/×9Ò9Ñ;Ô;ˆà�xŠx˜ FÐ+Ñ,Ô,Ð,r   N)r0   r1   r2   Ú__doc__rK   r   rD   rN   rP   ÚclassmethodrW   rf   r   r   r   r@   r@   g   s´   € € € € € ðð ð1ð 1ð 1ð ðð ñ „^ðð
 ðð ñ „^ðð ðð ñ „^ðð ð"ð "ñ „[ð"ð ð-ð -ñ „[ð-ð -ð -r   r@   )Úmaxsizec                 óÆ   — t          | d¦  «        5 }t          j        |                     ¦   «         ¦  «                             ¦   «         cd d d ¦  «         S # 1 swxY w Y   d S )NÚrb)Úopenr^   Úsha256ÚreadÚdigest)rJ   Úst_mtimeÚst_sizeÚfs       r   Ú_hash_source_filers       s–   € õ
 
ˆd�DÑ	Ô	ð 1˜QÝŒ~˜aŸfšf™hœhÑ'Ô'×.Ò.Ñ0Ô0ð1ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð 1ð 1s   ‘8AÁAÁAc                 óD  — t          j        | ¦  «        5 }|                     |¦  «        5 }t          j        |                     ¦   «         ¦  «                             ¦   «         cd d d ¦  «         cd d d ¦  «         S # 1 swxY w Y   	 d d d ¦  «         d S # 1 swxY w Y   d S r   )ÚzipfileÚZipFilerl   r^   rm   rn   ro   )Úzip_pathÚinternal_pathrp   rq   Úzfrr   s         r   Ú_hash_zipped_source_filerz   ©   s'  € õ
 
Œ˜Ñ	"Ô	"ð 5 bØ�WŠW�]Ñ#Ô#ð 	5 qÝ”> !§&¢&¡(¤(Ñ+Ô+×2Ò2Ñ4Ô4ð	5ð 	5ð 	5ð 	5ñ 	5ô 	5ð 	5ð5ð 5ð 5ð 5ñ 5ô 5ð 5ð 5ð	5ð 	5ð 	5ð 	5øøøð 	5ð 	5ð 	5ð 	5ð 	5ð5ð 5ð 5ñ 5ô 5ð 5ð 5ð 5ð 5ð 5ð 5ð 5øøøð 5ð 5ð 5ð 5ð 5ð 5s4   •B«8A<Á#BÁ<B 	Â BÂB 	ÂBÂBÂB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        }n| j        }t	          j        |¦  «        }t          ||j        |j        ¦  «        S ©NÚfrozenF)	ÚgetattrÚsysÚ
executableÚ_py_filerE   Ústatrs   rp   rq   )r   rJ   Ústs      r   rN   z._SourceFileBackedLocatorMixin.get_source_stamp¹   sI   € Ý•3˜ %Ñ(Ô(ð 	!Ý”>ˆDˆDà”=ˆDÝŒW�T‰]Œ]ˆÝ   r¤{°B´JÑ?Ô?Ð?r   c                 ó*   — t          | j        ¦  «        S r   )ÚstrÚ_linenor   s    r   rP   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   )rE   rJ   ÚexistsrK   ÚOSError©rT   rU   rV   r   s       r   rW   z+_SourceFileBackedLocatorMixin.from_functionÄ   sq   € åŒw�~Š~˜gÑ&Ô&ð 	àˆFØˆs�7˜GÑ$Ô$ˆð	Ø×"Ò"Ñ$Ô$Ð$Ð$øÝð 	ð 	ð 	àˆFˆFð	øøøð ˆó   ¯A Á
AÁAN)r0   r1   r2   rg   rN   rP   rh   rW   r   r   r   r|   r|   ³   sZ   € € € € € ðð ð
@ð @ð @ð!ð !ð !ð ð
ð 
ñ „[ð
ð 
ð 
r   r|   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   )rƒ   Ú__code__Úco_firstlinenorˆ   rf   rE   rJ   rb   r   Ú	CACHE_DIRÚ_cache_path)r   rU   rV   Úcache_subpaths       r   Ú__init__z!UserProvidedCacheLocator.__init__×   sJ   € ØˆŒØÔ'Ô6ˆŒØ×7Ò7¸Ñ@Ô@ˆÝœ7Ÿ<š<­Ô(8¸-ÑHÔHˆÔÐÐr   c                 ó   — | j         S r   ©r”   r   s    r   rD   z'UserProvidedCacheLocator.get_cache_pathÝ   ó   € ØÔÐr   c                 óv   •— t           j        sd S t          t          | ¦  «        }|                     ||¦  «        S r   )r   r“   Úsuperr�   rW   )rT   rU   rV   ÚparentÚ	__class__s       €r   rW   z&UserProvidedCacheLocator.from_functionà   s9   ø€ åÔð 	ØˆFÝÕ/°Ñ5Ô5ˆØ×#Ò# G¨WÑ5Ô5Ð5r   )	r0   r1   r2   rg   r–   rD   rh   rW   Ú__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__)	rƒ   r‘   r’   rˆ   rE   rJ   rb   r\   r”   )r   rU   rV   s      r   r–   zInTreeCacheLocator.__init__î   sD   € ØˆŒØÔ'Ô6ˆŒÝœ7Ÿ<š<­¬¯ª¸¼Ñ(FÔ(FÈÑVÔVˆÔÐÐr   c                 ó   — | j         S r   r˜   r   s    r   rD   z!InTreeCacheLocator.get_cache_pathó   r™   r   N)r0   r1   r2   rg   r–   rD   r   r   r   r¡   r¡   è   s?   € € € € € ðð ð
Wð Wð Wð
 ð  ð  ð  ð  r   r¡   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚInTreeCacheLocatorFsAgnosticam  
    A locator for functions backed by a regular Python module with a
    writable __pycache__ directory. This version is agnostic to filesystem differences,
    e.g. timestamp precision with milliseconds.

    .. deprecated::
        Source stamps are now content hashes, which are already
        filesystem-agnostic. Use :class:`InTreeCacheLocator` instead.
    c                 ór   •— t          j        dt          d¬¦  «          t          ¦   «         j        |i |¤Ž d S )Nz˜InTreeCacheLocatorFsAgnostic is deprecated; source stamps are now content hashes, which are already filesystem-agnostic. Use InTreeCacheLocator instead.é   )Ú
stacklevel)ÚwarningsÚwarnr   r›   r–   )r   r   Úkwargsr�   s      €r   r–   z%InTreeCacheLocatorFsAgnostic.__init__  sM   ø€ ÝŒð.õ $Øð	
ñ 	
ô 	
ð 	
ð 	�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ð)Ð)r   )r0   r1   r2   rg   r–   rž   rŸ   s   @r   r¦   r¦   ÷   sB   ø€ € € € € ðð ð*ð *ð *ð *ð *ð *ð *ð *ð *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)rƒ   r‘   r’   rˆ   r   Úuser_cache_dirrf   rE   rJ   rb   r”   ©r   rU   rV   Ú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   rD   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 r~   )rE   rJ   rŠ   r€   r�   rK   r‹   rŒ   s       r   rW   z"UserWideCacheLocator.from_function  s†   € å”—’˜wÑ'Ô'ð 	­7µ3¸À%Ñ+HÔ+Hð 	ð ˆFØˆs�7˜GÑ$Ô$ˆð	Ø×"Ò"Ñ$Ô$Ð$Ð$øÝð 	ð 	ð 	àˆFˆFð	øøøð ˆs   ÁA Á
A(Á'A(N)r0   r1   r2   rg   r–   rD   rh   rW   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)rƒ   ÚinspectÚ	getsourceÚ
isinstanceÚbytesÚ_bytes_sourcer`   )r   rU   rV   Úsources       r   r–   zIPythonCacheLocator.__init__2  sU   € ØˆŒõ Ô" 7Ñ+Ô+ˆÝ�f�eÑ$Ô$ð 	8Ø!'ˆDÔÐÐà!'§¢¨wÑ!7Ô!7ˆDÔÐÐ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.pathrE   rJ   rb   )r   rÄ   s     r   rD   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^   rm   rÁ   ra   r   s    r   rN   z$IPythonCacheLocator.get_source_stampH  s!   € ÝŒ~˜dÔ0Ñ1Ô1×;Ò;Ñ=Ô=Ð=r   c                 óÈ   — d                      | j                             d¦  «        d d…         ¦  «        }t          j        |¦  «                             ¦   «         d d…         S )Nr   Tr¨   é
   )rb   rÁ   Ú
splitlinesr^   rm   ra   )r   Ú
firstliness     r   rP   z%IPythonCacheLocator.get_disambiguatorK  sT   € ð —X’X˜dÔ0×;Ò;¸DÑAÔAÀ"À1À"ÔEÑFÔFˆ
ÝŒ~˜jÑ)Ô)×3Ò3Ñ5Ô5°c°r°cÔ:Ð: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_)Ú
startswithrE   rJ   Úbasenamer\   rK   r‹   rŒ   s       r   rW   z!IPythonCacheLocator.from_functionT  s©   € ð ×Ò˜{Ñ+Ô+ð	åŒw×Ò¥¤§¢°Ñ 8Ô 8Ñ9Ô9×DÒDÀ\ÑRÔRð	ð ˆFØˆs�7˜GÑ$Ô$ˆð	Ø×"Ò"Ñ$Ô$Ð$Ð$øÝð 	ð 	ð 	àˆFˆFð	øøøð ˆs   Á4B	 Â	
BÂBN)
r0   r1   r2   rg   r–   rD   rN   rP   rh   rW   r   r   r   r»   r»   -  sx   € € € € € ðð ð8ð 8ð 8ð
Dð 
Dð 
Dð>ð >ð >ð;ð ;ð ;ð ðð ñ „[ðð ð r   r»   c                   óP   — e Zd ZdZd„ Zed„ ¦   «         Zd„ Zd„ Ze	d„ ¦   «         Z
dS )ÚZipCacheLocatorzP
    A locator for functions backed by Python modules within a zip archive.
    c                 ó  — || _         |j        j        | _        |                      |¦  «        \  | _        | _        t          dd¬¦  «        }|j        }|  	                    |¦  «        }t          j                             ||¦  «        | _        d S r°   )rƒ   r‘   r’   rˆ   Ú_split_zip_pathÚ	_zip_pathÚ_internal_pathr   r´   rf   rE   rJ   rb   r”   rµ   s         r   r–   zZipCacheLocator.__init__i  s€   € ØˆŒØÔ'Ô6ˆŒØ.2×.BÒ.BÀ7Ñ.KÔ.KÑ+ˆŒ˜Ô+õ  '°UÐ;Ñ;Ô;ˆØÔ*ˆ	Ø×7Ò7¸Ñ@Ô@ˆÝœ7Ÿ<š<¨	°=ÑAÔAˆÔÐÐr   c           	      ó@  — t          | ¦  «        }t          |j        ¦  «        D ]l\  }}|                     d¦  «        rRt	          t          |j        d |dz   …         Ž ¦  «        }t	          t          |j        |dz   d …         Ž ¦  «        }||fc S Œmt          d¦  «        ‚)Nú.zipé   zNo zip file found in path)r   Ú	enumerateÚpartsÚendswithr‡   Ú
ValueError)rV   rJ   ÚiÚpartrw   rx   s         r   rÕ   zZipCacheLocator._split_zip_pathu  s§   € å�G‰}Œ}ˆÝ  ¤Ñ,Ô,ð 	/ð 	/‰GˆAˆtØ�}Š}˜VÑ$Ô$ð /Ý�t T¤Z°°!°a±%°Ô%8Ð9Ñ:Ô:�Ý #¥D¨$¬*°Q¸±U°W°WÔ*=Ð$>Ñ ?Ô ?�Ø Ð.Ð.Ð.Ð.ð/õ Ð4Ñ5Ô5Ð5r   c                 ó   — | j         S r   r˜   r   s    r   rD   zZipCacheLocator.get_cache_path  r™   r   c                 ó€   — t          j        | j        ¦  «        }t          | j        | j        |j        |j        ¦  «        S r   )rE   r„   rÖ   rz   r×   rp   rq   )r   r…   s     r   rN   z ZipCacheLocator.get_source_stamp‚  s:   € ÝŒW�T”^Ñ$Ô$ˆÝ'¨¬¸Ô8KØ(*¬°R´ZñAô Að 	Ar   c                 ó&   — d|vrd S  | ||¦  «        S )NrÙ   r   rS   s      r   rW   zZipCacheLocator.from_function‡  s$   € à˜Ð Ð Ø�4Øˆs�7˜GÑ$Ô$Ð$r   N)r0   r1   r2   rg   r–   ÚstaticmethodrÕ   rD   rN   rh   rW   r   r   r   rÓ   rÓ   d  s‡   € € € € € ðð ð
Bð 
Bð 
Bð ð6ð 6ñ „\ð6ð ð  ð  ðAð Að Að
 ð%ð %ñ „[ð%ð %ð %r   rÓ   c                   óš   — e Zd ZdZe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                 ó0  — |j         j        | _        	 |j        }n# t          $ r
 |j        }Y nw xY wt          j        rôg }t          j                             d¦  «        D ]Ñ}| 	                    ¦   «         }d|v rl| 
                    dd¦  «        \  }}	 t          j        |¦  «        }t          ||¦  «        }nc# t          t          f$ r}	t          d|› d�¦  «        |	‚d }	~	ww xY wt!          ¦   «                              |¦  «        }|€t          d|› d�¦  «        ‚|                     |¦  «         ŒÒn| j        }t)          j        |¦  «        }
|D ]}|                     ||
¦  «        }|� nŒt          d|›d|
›�¦  «        ‚|| _        t)          j        |¦  «        }t0          j                             t0          j                             |¦  «        ¦  «        d	         }|›d|›�}t          t8          d
d¦  «        }|                      ||¦  «        | _        d S )Nú,ú.rÚ   zFailed to import 'z8' specified via NUMBA_CACHE_LOCATOR_CLASSES env variablezUnknown cache locator class: 'zcannot cache function z : no locator available for file r   ÚabiflagsÚ )r‘   r’   rˆ   r2   ÚAttributeErrorr0   r   ÚCACHE_LOCATOR_CLASSESr]   ÚstripÚrsplitÚ	importlibÚimport_moduler€   rÇ   ÚRuntimeErrorÚglobalsÚgetÚappendÚ_locator_classesr½   ÚgetfilerW   Ú_locatorrE   rJ   ÚsplitextrÑ   r�   Úget_filename_baseÚ_filename_base)r   rU   ÚqualnameÚlocator_classesÚlocator_class_pathÚmodule_pathÚ
class_nameÚmodulerT   ÚeÚsource_pathÚlocatorÚfilenameÚmodnameÚfullnamerê   s                   r   r–   zCacheImpl.__init__�  s—  € ØÔ'Ô6ˆŒð	(ØÔ+ˆHˆHøÝð 	(ð 	(ð 	(ØÔ'ˆHˆHˆHð	(øøøõ Ô'ð 	4Ø ˆOÝ&,Ô&B×&HÒ&HÈÑ&MÔ&Mð ,ð ,Ð"Ø%7×%=Ò%=Ñ%?Ô%?Ð"ØÐ,Ð,Ð,à.@×.GÒ.GÈÈQÑ.OÔ.OÑ+�K ð^Ý!*Ô!8¸Ñ!EÔ!E˜Ý% f¨jÑ9Ô9˜˜øÝ'­Ð8ð ^ð ^ð ^Ý*ð ,VÐ@Rð ,Vð ,Vð ,Vñ Wô WØ\]ð^øøøøð^øøøõ
 "™)œ)Ÿ-š-Ð(:Ñ;Ô;�CØ�{Ý*ð ,VÐL^ð ,Vð ,Vð ,Vñ Wô Wð Wà×&Ò& sÑ+Ô+Ð+Ð+ð#,ð& #Ô3ˆOõ ”o gÑ.Ô.ˆØ"ð 	Hð 	HˆCØ×'Ò'¨°Ñ=Ô=ˆGØÐ"Ø�ð #õ �,Ø08°°¸+¸+ð Gñ Hô Hð HàˆŒõ ”? 7Ñ+Ô+ˆÝ”'×"Ò"¥2¤7×#3Ò#3°HÑ#=Ô#=Ñ>Ô>¸qÔAˆØ%˜g˜g x xÐ0ˆÝ�3 
¨BÑ/Ô/ˆØ"×4Ò4°X¸xÑHÔHˆÔÐÐs$   “ ›/®/Â$B8Â8C"Ã	CÃC"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   rÚ   )Úreplacer  rP   r�   Úversion_info)r   r  rê   Úfixed_fullnameÚfmts        r   rú   zCacheImpl.get_filename_baseÏ  sl   € ð "×)Ò)¨#¨rÑ2Ô2×:Ò:¸3ÀÑCÔCˆØˆØ�n d¤l×&DÒ&DÑ&FÔ&FÝÔ& qÔ)­3Ô+;¸AÔ+>ÀðJñ Jð 	Jr   c                 ó   — | j         S r   )rû   r   s    r   Úfilename_basezCacheImpl.filename_base×  s   € àÔ"Ð"r   c                 ó   — | j         S r   )rø   r   s    r   r  zCacheImpl.locatorÛ  s
   € àŒ}Ðr   c                 ó   — dS )z$Returns the serialized form the dataNr   ©r   r(   s     r   ÚreducezCacheImpl.reduceß  ó	   € ð 	ˆr   c                 ó   — dS )z4Returns the de-serialized form of the *reduced_data*Nr   )r   r$   Úreduced_datas      r   ÚrebuildzCacheImpl.rebuildä  r  r   c                 ó   — dS )zEReturns True if the given data is cachable; otherwise, returns False.Nr   r  s     r   Úcheck_cachablezCacheImpl.check_cachableé  r  r   N)r0   r1   r2   rg   r�   r¡   r®   r»   rÓ   rö   r–   rú   r3   r  r  r   r  r  r  r   r   r   ræ   ræ   �  sã   € € € € € ðð ð 	!ØØØØðÐð0Ið 0Ið 0Iðd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   r;   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Ð4 1�1”;ˆÐ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é   rY   z" FT)ÚanyÚliftedÚlibraryÚhas_dynamic_globalsÚfndescrü   r]   rª   Úwarn_explicitr   rø   rƒ   rˆ   )r   r;   Úcannot_cacher   s       r   r  z%CompileResultCacheImpl.check_cachable   s´   € ð ˆÝÐ4Ð4¨¬Ð4Ñ4Ô4Ñ4Ô4ð 	QØ3ˆLˆLØŒ\Ô-ð 	QðPˆLàð 	ð 	à”kÔ*×0Ò0°Ñ5Ô5°bÔ9Ð9Ð9¸<¸<ðIˆCåÔ" 3­Ø#'¤=Ô#9¸4¼<ñIô Ið Ià�5Øˆtr   N)r0   r1   r2   rg   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-  r5  s     r   r  z#CodeLibraryCacheImpl.check_cachable&  s   € ð Ô.Ð.Ð.r   c                 ó’   •— t          t          | ¦  «        }|                     ||¦  «        }d                     | j        |g¦  «        S )Nú-)r›   r2  rú   rb   Ú_filename_prefix)r   r  rê   rœ   Úresr�   s        €r   rú   z&CodeLibraryCacheImpl.get_filename_base,  sB   ø€ ÝÕ+¨TÑ2Ô2ˆØ×&Ò& x°Ñ:Ô:ˆØ�xŠx˜Ô.°Ð4Ñ5Ô5Ð5r   )
r0   r1   r2   rg   r=  r  r  r  rú   rž   rŸ   s   @r   r2  r2    sz   ø€ € € € € ðð ð Ðð5ð 5ð 5ðEð Eð Eð/ð /ð /ð6ð 6ð 6ð 6ð 6ð 6ð 6ð 6ð 6r   r2  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_namerE   rJ   rb   Ú_index_pathÚ_data_name_patternÚ_source_stampr±   Ú__version__Ú_version)r   r   r  Úsource_stamps       r   r–   zIndexDataCacheFile.__init__6  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_namerJ  Ú
_save_data)r   Úkeyr(   Ú	overloadsÚ	data_nameÚexistingrß   s          r   ÚsavezIndexDataCacheFile.saveA  s×   € ð ×$Ò$Ñ&Ô&ˆ	ð	(à! #œˆIˆIøÝð 	(ð 	(ð 	(å˜9×+Ò+Ñ-Ô-Ñ.Ô.ˆHÝ”_ QÑ'Ô'ð ð �Ø ŸOšO¨AÑ.Ô.�	Ø HÐ,Ð,Ø�Eð -à&ˆI�c‰NØ×Ò˜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)rL  rô   Ú
_load_datar‹   )r   rT  rU  rV  s       r   ÚloadzIndexDataCacheFile.loadT  sj   € ð ×$Ò$Ñ&Ô&ˆ	Ø—M’M #Ñ&Ô&ˆ	ØÐØˆFð	Ø—?’? 9Ñ-Ô-Ð-øÝð 	ð 	ð 	àˆFˆFð	øøø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).
        rk   Nz[cache] index loaded from %r)
rl   rC  Úpickler[  rn   ÚFileNotFoundErrorrG  Úloadsr   rE  )r   rr   Úversionr(   ÚstamprU  s         r   rL  zIndexDataCacheFile._load_indexb  s  € ð
	Ý�dÔ&¨Ñ-Ô-ð  °Ý œ+ a™.œ.�Ø—v’v‘x”x�ð ð  ð  ñ  ô  ð  ð  ð  ð  ð  ð  øøøð  ð  ð  ð  øøõ !ð 	ð 	ð 	àˆIˆIˆIð	øøøð �d”mÒ#Ð#ð ˆIÝ!œ<¨Ñ-Ô-ÑˆˆyÝÐ1°4Ô3CÑ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 )NrY   )Úprotocolz[cache] index saved to %r)	rE  Ú_dumpÚ_open_for_writerC  r]  ÚdumprG  Úwriter   )r   rU  r(   rr   s       r   rJ  zIndexDataCacheFile._save_index{  sÍ   € ØÔ! 9Ð,ˆØ�zŠz˜$ÑÔˆØ×!Ò! $Ô"2Ñ3Ô3ð 	°qÝŒK˜œ q°2Ð6Ñ6Ô6Ð6Ø�GŠG�D‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	õ 	Ð.°Ô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 )Nrk   z[cache] data loaded from %r)Ú
_data_pathrl   rn   r]  r_  r   )r   ÚnamerJ   rr   r(   Útups         r   rZ  zIndexDataCacheFile._load_dataƒ  s§   € Ø�Š˜tÑ$Ô$ˆÝ�$˜ÑÔð 	 Ø—6’6‘8”8ˆDð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	åŒl˜4Ñ Ô ˆÝÐ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)rd  ri  re  rg  r   )r   rj  r(   rJ   rr   s        r   rS  zIndexDataCacheFile._save_data‹  s°   € Ø�zŠz˜$ÑÔˆØ�Š˜tÑ$Ô$ˆØ×!Ò! $Ñ'Ô'ð 	¨1Ø�GŠG�D‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	åÐ-¨tÑ4Ô4Ð4Ð4Ð4s   Á A"Á"A&Á)A&c                 ó8   — | j                              |¬¦  «        S )N)Únumber)rD  Úformat)r   rn  s     r   rR  zIndexDataCacheFile._data_name’  s   € ØÔ&×-Ò-°VÐ-Ñ<Ô<Ð<r   c                 óL   — t           j                             | j        |¦  «        S r   )rE   rJ   rb   r”   )r   rj  s     r   ri  zIndexDataCacheFile._data_path•  s   € ÝŒw�|Š|˜DÔ,¨dÑ3Ô3Ð3r   c                 ó    — t          |¦  «        S r   r   )r   Úobjs     r   rd  zIndexDataCacheFile._dump˜  s   € Ý�S‰zŒzÐ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Úhexrl   rE   r  Ú	ExceptionÚunlinkr‹   )r   ÚfilepathÚuidÚtmpnamerr   s        r   re  z"IndexDataCacheFile._open_for_write›  s  è è € õ Œj‰lŒlÔ˜s ˜sÔ#ˆØ!)  ¨3¨3Ð/ˆð
	Ý�g˜tÑ$Ô$ð ¨Ø���ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð åŒJ�w Ñ)Ô)Ð)Ð)Ð)øÝð 	ð 	ð 	ðÝ”	˜'Ñ"Ô"Ð"Ð"øÝð ð ð Ø�ðøøøàð	øøøsR   «A. »AÁ A. ÁAÁA. ÁAÁA. Á.
B Á9BÂB Â
BÂB ÂBÂB N)r0   r1   r2   rg   r–   r/   rX  r[  rL  rJ  rZ  rS  rR  ri  rd  Ú
contextlibÚcontextmanagerre  r   r   r   r@  r@  2  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  rH  )ÚreprÚ_nameÚ_py_funcÚ_impl_classÚ_implr  rD   r”   rN   r  r@  Ú_cache_filer+   )r   rU   rH  r  s       r   r–   zCache.__init__É  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�   r0   r„  r   s    r   Ú__repr__zCache.__repr__Ö  s    € € Ø$(¤NÔ$;Ð$;Ð$;¸T¼Z¸Z¸ZÐHÐHr   c                 ó   — | j         S r   r˜   r   s    r   r   zCache.cache_pathÙ  s   € àÔÐr   c                 ó   — d| _         d S )NT©Ú_enabledr   s    r   r+   zCache.enableÝ  s   € ØˆŒˆˆr   c                 ó   — d| _         d S )NFr�  r   s    r   r-   zCache.disableà  s   € ØˆŒˆˆr   c                 ó8   — | j                              ¦   «          d S r   )rˆ  r/   r   s    r   r/   zCache.flushã  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_overloadæ  sŸ   € ð 	×ÒÑ Ô Ð Ø×3Ò3Ñ5Ô5ð 	<ð 	<Ø×&Ò& s¨NÑ;Ô;ð	<ð 	<ð 	<ð 	<ñ 	<ô 	<ð 	<ð 	<ð 	<ð 	<ð 	<ð 	<øøøð 	<ð 	<ð 	<ð 	<ð 	<ð 	<s   ©AÁAÁAc                 óÖ   — | j         sd S |                      ||                     ¦   «         ¦  «        }| j                             |¦  «        }|�| j                             ||¦  «        }|S r   )rŽ  Ú
_index_keyr8  rˆ  r[  r‡  r  )r   r#   r$   rT  r(   s        r   r”  zCache._load_overloadñ  sh   € ØŒ}ð 	ØˆFØ�oŠo˜c >×#9Ò#9Ñ#;Ô#;Ñ<Ô<ˆØÔ×$Ò$ SÑ)Ô)ˆØÐØ”:×%Ò% n°dÑ;Ô;ˆ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   )
rŽ  r‡  r  r  rK   r–  r8  r  rˆ  rX  )r   r#   r(   rT  s       r   r˜  zCache._save_overload  sŽ   € ØŒ}ð 	ØˆFØŒz×(Ò(¨Ñ.Ô.ð 	ØˆFØŒ
Ô×,Ò,Ñ.Ô.Ð.Ø�oŠo˜c 4¤<Ñ0Ô0ˆØŒz× Ò  Ñ&Ô&ˆØÔ×Ò˜c 4Ñ(Ô(Ð(Ð(Ð(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)rE   rj  r‹   ÚerrnoÚEACCES)r   r  s     r   r“  z'Cache._guard_against_spurious_io_errors  sw   è è € åŒ7�dŠ?ˆ?ðØ�����øÝð ð ð Ø”7�eœlÒ*Ð*Øð +Ð*Ð*Ð*Ð*Ð*øøøøðøøøð
 ˆEˆEˆEˆEˆEs   ” š
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ÐN¨q˜1œ?ÐNÐNÐNr   r   c                 óN   — t          j        | ¦  «                             ¦   «         S r   )r^   rm   ra   )r(  s    r   ú<lambda>z"Cache._index_key.<locals>.<lambda>)  s   € �7œ>¨!Ñ,Ô,×6Ò6Ñ8Ô8€ r   )r…  r‘   Úco_codeÚ__closure__Útupler   Úmagic_tuple)r   r#   r8  Ú	codebytesÚcvarsÚ	cvarbytesÚhashers          r   r–  zCache._index_key  s•   € ð ”MÔ*Ô2ˆ	ØŒ=Ô$Ð0ÝÐNÐN°D´MÔ4MÐNÑNÔNÑOÔOˆEõ ˜e™œˆIˆIàˆIà8Ð8ˆØ�W×(Ò(Ñ*Ô*¨V¨V°IÑ->Ô->Ø-3¨V°IÑ->Ô->ð-Að Bð 	Br   )r0   r1   r2   rg   r†  r–   rŠ  r3   r   r+   r-   r/   r%   r”  r)   r˜  r~  r  r“  r–  r   r   r   r�  r�  °  sý   € € € € € ðð ð, €Kðð ð ðIð Ið Ið ð ð  ñ „Xð ðð ð ðð ð ð!ð !ð !ð<ð <ð <ðð ð ð+ð +ð +ð)ð )ð )ð Ôðð ñ ÔððBð Bð Bð Bð Br   r�  c                   ó   — e Zd ZdZeZdS )ÚFunctionCachezF
    Implements Cache that saves and loads CompileResult objects.
    N)r0   r1   r2   rg   r  r†  r   r   r   r­  r­  .  s   € € € € € ðð ð )€K€K€Kr   r­  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)r0   r1   r2   r=  )Úprefixs   €r   ÚCustomCodeLibraryCacheImplr°  C  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)r0   r1   r2   rg   r†  )r²  s   €r   ÚLibraryCacher´  F  s    ø€ € € € € ð	ð 	ð 1ˆˆˆr   rµ  )Ú_lib_cache_prefixesÚaddr2  r�  )r±  rµ  r²  s   ` @r   Úmake_library_cacher¸  9  s�   øø€ ð Õ,Ð,Ð,Ð,Ð,Ý×Ò˜FÑ#Ô#Ð#ð"ð "ð "ð "ð "ð "ð "Õ%9ñ "ô "ð "ð1ð 1ð 1ð 1ð 1ð 1ð 1•uñ 1ô 1ð 1ð Ðr   )=rg   Úabcr   r   r~  rœ  Ú	functoolsr^   rð   r½   rP  rE   r]  r�   rG   rv  rª   Únumba.misc.appdirsr   ru   Úpathlibr   r±   Únumba.core.errorsr   r   Únumba.core.baser	   Únumba.core.codegenr
   Únumba.core.compilerr   Ú
numba.corer   r   Únumba.core.serializer   r   r   r6   r@   Ú	lru_cachers   rz   Úobjectr|   r�   r¡   r¦   r®   r»   rÓ   ræ   r  r2  r@  r�  r­  rN  r¶  r¸  r   r   r   ú<module>rÅ     sÐ  ððð ð
 (Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€Ø €€€Ø €€€à &Ð &Ð &Ð &Ð &Ð &Ø €€€Ø Ð Ð Ð Ð Ð à €€€Ø CÐ CÐ CÐ CÐ CÐ CÐ CÐ CØ 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø *Ð *Ð *Ð *Ð *Ð *Ø -Ð -Ð -Ð -Ð -Ð -Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø &Ð &Ð &Ð &Ð &Ð &ðð ð ð'ð 'ð 'ð 'ð '�wð 'ñ 'ô 'ð 'ðTð ð ð ð �ñ ô ð ð*6-ð 6-ð 6-ð 6-ð 6-˜gð 6-ñ 6-ô 6-ð 6-ðr €Ô˜TÐ"Ñ"Ô"ð1ð 1ñ #Ô"ð1ð €Ô˜TÐ"Ñ"Ô"ð5ð 5ñ #Ô"ð5ðð ð ð ð  Fñ ô ð ð>6ð 6ð 6ð 6ð 6Ð<¸mñ 6ô 6ð 6ð, ð  ð  ð  ð  Ð6¸ñ  ô  ð  ð*ð *ð *ð *ð *Ð#5ñ *ô *ð *ð,ð ð ð ð Ð8¸-ñ ô ð ð@4ð 4ð 4ð 4ð 4˜-ñ 4ô 4ð 4ðn'%ð '%ð '%ð '%ð '%Ð3°]ñ '%ô '%ð '%ðR_ð _ð _ð _ð _˜'ð _ñ _ô _ð _ðD!ð !ð !ð !ð !˜Yñ !ô !ð !ðH6ð 6ð 6ð 6ð 6˜9ñ 6ô 6ð 6ð>{ð {ð {ð {ð {˜ñ {ô {ð {ð|{Bð {Bð {Bð {Bð {BˆFñ {Bô {Bð {Bð|)ð )ð )ð )ð )�Eñ )ô )ð )ð �c˜2˜$‘i”iÐ ðð ð ð ð r   