
    hg              	       t   S r SSKrSSKrSSKrSSKrSSKJr   " S S\R                  R                  5      r
SrSrSS\S	\S
\\R                  \R                  4   4S jjrS\R                  S\R                  4S jr\
" \/\" SSS9Q76 r\
" \/\" S5      Q76 r\
" \/\" SSS9Q76 r\
" \/\" S5      Q76 rg)zRGlobal objects with the content of the microarchitecture
JSON file and its schema
    N)Tuplec                   L    \ rS rSrSrS r\S 5       rS rS r	S r
S rS	 rS
rg)LazyDictionary   zLazy dictionary that gets constructed on first access to any object key

Args:
    factory (callable): factory function to construct the dictionary
c                 6    Xl         X l        X0l        S U l        g N)factoryargskwargs_data)selfr	   r
   r   s       3lib/python3.13/site-packages/archspec/cpu/schema.py__init__LazyDictionary.__init__   s    	
    c                     U R                   c+  U R                  " U R                  0 U R                  D6U l         U R                   $ )z)Returns the lazily constructed dictionary)r   r	   r
   r   r   s    r   dataLazyDictionary.data   s5     ::tyy@DKK@DJzzr   c                      U R                   U   $ r   r   r   keys     r   __getitem__LazyDictionary.__getitem__#   s    yy~r   c                      X R                   U'   g r   r   )r   r   values      r   __setitem__LazyDictionary.__setitem__&   s    		#r   c                     U R                   U	 g r   r   r   s     r   __delitem__LazyDictionary.__delitem__)   s    IIcNr   c                 ,    [        U R                  5      $ r   )iterr   r   s    r   __iter__LazyDictionary.__iter__,   s    DIIr   c                 ,    [        U R                  5      $ r   )lenr   r   s    r   __len__LazyDictionary.__len__/   s    499~r   )r   r
   r	   r   N)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   r!   r%   r)   __static_attributes__ r   r   r   r      s9      r   r   ARCHSPEC_CPU_DIRARCHSPEC_EXTENSION_CPU_DIRfilenameallow_customreturnc                    [         R                  " [        5      R                  S-  S-  S-  nU(       aC  [        [
        R                  ;   a+  [         R                  " [
        R                  [           5      nUR                  5       nX -  nSnU(       aW  [        [
        R                  ;   a?  [         R                  " [
        R                  [           5      nUR                  5         XP-  nX44$ )a   Given a filename, returns the absolute path for the main JSON file, and an
optional absolute path for an extension JSON file.

Args:
    filename: filename for the JSON file
    allow_custom: if True, allows overriding the location  where the file resides
z..jsoncpuN)	pathlibPath__file__parentDIR_FROM_ENVIRONMENTosenvironabsoluteEXTENSION_DIR_FROM_ENVIRONMENT)r5   r6   json_dir	json_fileextension_fileextension_dirs         r   
_json_filerH   :   s     ||H%,,t3f<uDH,

:<<

+? @A  "H#IN6"**DRZZ0N%OP &1$$r   rE   rF   c                    [        U SSS9 n[        R                  " U5      nS S S 5        U(       a  UR                  5       (       d  W$ [        USSS9 n[        R                  " U5      nS S S 5        [	        WR                  5       5      nU H   nUW;  a  M  X6   R                  XF   5        M"     U$ ! , (       d  f       N= f! , (       d  f       N`= f)Nrzutf-8)encoding)openr9   loadexistslistkeysupdate)rE   rF   filer   extension_datatop_level_sectionsr   s          r   _loadrU   Q   s    	iw	/4yy 
0 !6!6!8!8	ncG	44 
5 diik*!n$	,-	 " K! 
0	/ 
5	4s   B4C4
C
Czmicroarchitectures.jsonT)r6   zmicroarchitectures_schema.jsonz
cpuid.jsonzcpuid_schema.json)F)r/   collections.abccollectionsr9   r@   r;   typingr   abcMutableMappingr   r?   rC   strboolr<   rH   rU   TARGETS_JSONTARGETS_JSON_SCHEMA
CPUID_JSONCPUID_JSON_SCHEMAr2   r   r   <module>ra      s   
   	  ![__33 !J *  "> % %D %U7<<QXQ]Q]C]=^ %.W\\ 7<< , e_j1JY]&^_ %UZZ8X-YZ  EPJ|$$OP
 #5K:6I+JK r   