
    k=1ek                         d Z ddlZddlZddlZ G d dej        j                  Zd Z	 e e	d                    Z
 e e	d                    ZdS )zRGlobal objects with the content of the microarchitecture
JSON file and its schema
    Nc                   L    e Zd ZdZd Zed             Zd Zd Zd Z	d Z
d Zd	S )
LazyDictionaryzLazy dictionary that gets constructed on first access to any object key

    Args:
        factory (callable): factory function to construct the dictionary
    c                 >    || _         || _        || _        d | _        d S N)factoryargskwargs_data)selfr   r   r	   s       3lib/python3.11/site-packages/archspec/cpu/schema.py__init__zLazyDictionary.__init__   s"    	


    c                 V    | j          | j        | j        i | j        | _         | j         S )z)Returns the lazily constructed dictionary)r
   r   r   r	   r   s    r   datazLazyDictionary.data   s0     :%ty@DK@@DJzr   c                     | j         |         S r   r   r   keys     r   __getitem__zLazyDictionary.__getitem__!   s    y~r   c                     || j         |<   d S r   r   )r   r   values      r   __setitem__zLazyDictionary.__setitem__$   s    	#r   c                     | j         |= d S r   r   r   s     r   __delitem__zLazyDictionary.__delitem__'   s    IcNNNr   c                 *    t          | j                  S r   )iterr   r   s    r   __iter__zLazyDictionary.__iter__*   s    DIr   c                 *    t          | j                  S r   )lenr   r   s    r   __len__zLazyDictionary.__len__-   s    49~~r   N)__name__
__module____qualname____doc__r   propertyr   r   r   r   r   r!    r   r   r   r      s              X            r   r   c                      t           j                            t           j                            t                    ddd          t           j                                       fd}|S )Nz..jsoncpuc                      t           j                                      } t          | dd          5 }t	          j        |          cd d d            S # 1 swxY w Y   d S )Nrzutf-8)encoding)ospathjoinopenr)   load)filenamefilejson_dir	json_files     r   _factoryz!_load_json_file.<locals>._factory5   s    7<<)44(C'222 	#d9T??	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   AAA)r.   r/   r0   dirname__file__abspath)r6   r7   r5   s   ` @r   _load_json_filer;   1   sc    w||BGOOH55tVUKKHwx((H# # # # # #
 Or   zmicroarchitectures.jsonzmicroarchitectures_schema.json)r%   collections.abccollectionsr)   os.pathr.   abcMutableMappingr   r;   TARGETS_JSONSCHEMAr'   r   r   <module>rC      s   
       ! ! ! ! ![_3 ! ! !H	 	 	 ~oo.GHHII 
(HII	J	Jr   