o
    1&i                     @   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   sF   z| j |j W S  ty"   | | }|j|_|| j |j< | Y S w N)_memor   KeyErrorZlookup_globals)clsZfndescinst r   AC:\wamp64\www\opt\env\Lib\site-packages\numba/core/environment.pyfrom_fndesc   s   zEnvironment.from_fndescc                 C   s   d| j v}| 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 u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    '