o
    1Æ&i•
  ã                   @   sx   d dl Z d dlmZ d dlmZ d dlmZmZm	Z	m
Z
 G dd„ deƒZedƒZG dd	„ d	e	jƒZG d
d„ dejƒZdS )é    N)Úthreadsafe_cached_property)ÚTargetDescriptor)ÚutilsÚtypingÚ
dispatcherÚcpuc                   @   sB   e Zd ZejZedd„ ƒZedd„ ƒZe	dd„ ƒZ
e	dd„ ƒZd	S )
Ú	CPUTargetc                 C   s   t  | j| j¡S ©N)r   Z
CPUContextÚtyping_contextZ_target_name©Úself© r   ú>C:\wamp64\www\opt\env\Lib\site-packages\numba/core/registry.pyÚ_toplevel_target_context   s   z"CPUTarget._toplevel_target_contextc                 C   s   t  ¡ S r	   )r   ÚContextr   r   r   r   Ú_toplevel_typing_context   s   z"CPUTarget._toplevel_typing_contextc                 C   ó   | j S )z5
        The target context for CPU targets.
        )r   r   r   r   r   Útarget_context   ó   zCPUTarget.target_contextc                 C   r   )z5
        The typing context for CPU targets.
        )r   r   r   r   r   r
       r   zCPUTarget.typing_contextN)Ú__name__Ú
__module__Ú__qualname__r   ZCPUTargetOptionsÚoptionsÚcached_propertyr   r   Úpropertyr   r
   r   r   r   r   r      s    


r   r   c                   @   s   e Zd ZeZdS )ÚCPUDispatcherN)r   r   r   Ú
cpu_targetZtargetdescrr   r   r   r   r   ,   s    r   c                       s8   e Zd ZdZ‡ fdd„Z‡ fdd„Z‡ fdd„Z‡  ZS )ÚDelayedRegistrya#  
    A unique dictionary but with deferred initialisation of the values.

    Attributes
    ----------
    ondemand:

        A dictionary of key -> value, where value is executed
        the first time it is is used.  It is used for part of a deferred
        initialization strategy.
    c                    sN   t  ¡ | _| dd ¡| _| dd ¡| _| jp| j| _tt| ƒj	|i |¤Ž d S )NÚkey_typeÚ
value_type)
r   Ú
UniqueDictÚondemandÚpopr   r   Ú_type_checkÚsuperr   Ú__init__)r   ÚargsÚkws©Ú	__class__r   r   r%   <   s
   
zDelayedRegistry.__init__c                    s2   || j v r| j | ƒ | |< | j |= tt| ƒ |¡S r	   )r!   r$   r   Ú__getitem__)r   Úitemr(   r   r   r*   C   s   
zDelayedRegistry.__getitem__c                    sL   | j rdd„ }| jd ur||| jƒ | jd ur||| jƒ tt| ƒ ||¡S )Nc                 S   s>   t |tƒr|| jv sJ | |fƒ‚d S t | |ƒsJ | |fƒ‚d S r	   )Ú
isinstanceÚtypeÚ__mro__)ÚxZty_xr   r   r   ÚcheckK   s   
z*DelayedRegistry.__setitem__.<locals>.check)r#   r   r   r$   r   Ú__setitem__)r   ÚkeyÚvaluer0   r(   r   r   r1   I   s   

zDelayedRegistry.__setitem__)r   r   r   Ú__doc__r%   r*   r1   Ú__classcell__r   r   r(   r   r   0   s
    r   )Ú
contextlibZnumba.core.utilsr   r   Znumba.core.descriptorsr   Z
numba.corer   r   r   r   r   r   Z
Dispatcherr   r    r   r   r   r   r   Ú<module>   s    