U
    ú¾|eg  ã                   @   sB   d dl Z d dlZd dlmZ G dd„ dejƒZdd„ Zdd„ ZdS )	é    N)Ú_dynfuncc                   @   sH   e Zd ZdZdZe ¡ Zedd„ ƒZ	dd„ Z
dd„ Zd	d
„ Zdd„ ZdS )ÚEnvironmentz~Stores globals and constant pyobjects for runtime.

    It is often needed to convert b/w nopython objects and pyobjects.
    )Úenv_nameÚ__weakref__c                 C   sL   z| j |j W S  tk
rF   | | ¡ ƒ}|j|_|| j |j< | Y S X d S ©N)Ú_memor   ÚKeyErrorÚlookup_globals)ÚclsÚfndescÚinst© r   úS/var/www/website-v5/atlas_env/lib/python3.8/site-packages/numba/core/environment.pyÚfrom_fndesc   s    zEnvironment.from_fndescc                 C   s   d| j k}| S ©NÚ__name__)Úglobals)ÚselfZis_dynr   r   r   Ú	can_cache   s    
zEnvironment.can_cachec                 C   s   t | j d¡| j| jffS r   )Ú_rebuild_envr   ÚgetÚconstsr   ©r   r   r   r   Ú
__reduce__    s
    
ýzEnvironment.__reduce__c                 C   s   d S r   r   r   r   r   r   Ú__del__'   s    zEnvironment.__del__c                 C   s   d| j ›d�S )Nz<Environment z >©r   r   r   r   r   Ú__repr__*   s    zEnvironment.__repr__N)r   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__ÚweakrefÚWeakValueDictionaryr   Úclassmethodr   r   r   r   r   r   r   r   r   r      s   

r   c                 C   sJ   t |ƒ}|d k	r|S t | ¡}t|jƒ}||jd d …< ||_|tj|< |S r   )Úlookup_environmentÚ	importlibÚimport_moduler   Ú__dict__r   r   r   )Úmodnamer   r   ÚenvÚmodr   r   r   r   .   s    


r   c                 C   s   t j | ¡S )zPReturns the Environment object for the given name;
    or None if not found
    )r   r   r   r   r   r   r   r$   <   s    r$   )r!   r%   Únumbar   r   r   r$   r   r   r   r   Ú<module>   s
   '