U
    9%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   KeyErrorZlookup_globals)clsZfndescinst r   U/var/www/html/Darija-Ai-API/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#   Znumbar   r   r   r"   r   r   r   r   <module>   s
   '