
    mi                        d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlmZmZ  G d d	          ZddZeeef         ZdS )z'Intermediate representation of modules.    )annotations)JsonDict)ClassIR)FuncDeclFuncIR)	DeserMaps)RTypedeserialize_typec                  :    e Zd ZdZddZddZedd            ZdS )ModuleIRz(Intermediate representation of a module.fullnamestrimports	list[str]	functionslist[FuncIR]classeslist[ClassIR]final_nameslist[tuple[str, RType]]type_var_namesreturnNonec                    || _         |                                | _        || _        || _        || _        || _        t                      | _        d S )N)	r   copyr   r   r   r   r   setcapsules)selfr   r   r   r   r   r   s          j/var/www/html/bestrading.cuttalo.com/scripts/kaggle-env/lib/python3.11/site-packages/mypyc/ir/module_ir.py__init__zModuleIR.__init__   sI     !||~~"& -"%%%    r   c                    | j         | j        d | j        D             d | j        D             d | j        D             t          | j                  dS )Nc                6    g | ]}|                                 S  	serialize).0fs     r   
<listcomp>z&ModuleIR.serialize.<locals>.<listcomp>(   s     @@@A!++--@@@r!   c                6    g | ]}|                                 S r$   r%   )r'   cs     r   r)   z&ModuleIR.serialize.<locals>.<listcomp>)   s     <<<!<<<r!   c                @    g | ]\  }}||                                 fS r$   r%   )r'   kts      r   r)   z&ModuleIR.serialize.<locals>.<listcomp>*   s)    LLL41aQ.LLLr!   )r   r   r   r   r   r   )r   r   r   r   r   sortedr   )r   s    r   r&   zModuleIR.serialize$   sb    |@@@@@<<t|<<<LL4;KLLLt}--
 
 	
r!   datactxr   c           	         t          |d         |d         fd|d         D             fd|d         D             fd|d         D             g           }t          |d	                   |_        |S )
Nr   r   c                N    g | ]!}j         t          j        |                   "S r$   )r   r   get_id_from_json)r'   r(   r1   s     r   r)   z(ModuleIR.deserialize.<locals>.<listcomp>3   s+    TTTQS]84Q778TTTr!   r   c                :    g | ]}t          j        |          S r$   )r   deserialize)r'   r+   r1   s     r   r)   z(ModuleIR.deserialize.<locals>.<listcomp>4   s&    BBBQW C((BBBr!   r   c                :    g | ]\  }}|t          |          fS r$   )r
   )r'   r-   r.   r1   s      r   r)   z(ModuleIR.deserialize.<locals>.<listcomp>5   s-    KKKtq!a!!S))*KKKr!   r   r   )r   r   r   )clsr0   r1   modules     ` r   r6   zModuleIR.deserialize.   s    OTTTT${BSTTTBBBB$y/BBBKKKKtM7JKKK
 
 d:.//r!   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   )r0   r   r1   r   r   r   )__name__
__module____qualname____doc__r    r&   classmethodr6   r$   r!   r   r   r      sb        22( ( ( (*
 
 
 
 
 
 
 [
 
 
r!   r   r0   dict[str, JsonDict]r1   r   r   dict[str, ModuleIR]c                   |                                  D ]X}|d         D ]M}t          |d         |d                   }|j        j        vsJ d|j        z              |j        |j        <   NY|                                  D ]`}|d         D ]U}t	          j        |          }|j        j        j        vsJ d|j        j        z              |j        |j        j        <   Vafd| 	                                D             S )aG  Deserialize a collection of modules.

    The modules can contain dependencies on each other.

    Arguments:
        data: A dict containing the modules to deserialize.
        ctx: The deserialization maps to use and to populate.
             They are populated with information from the deserialized
             modules and as a precondition must have been populated by
             deserializing any dependencies of the modules being deserialized
             (outside of dependencies between the modules themselves).

    Returns a map containing the deserialized modules.
    r   namemodule_namezClass %s already in mapr   zMethod %s already in mapc                N    i | ]!\  }}|t                               |          "S r$   )r   r6   )r'   r-   vr1   s      r   
<dictcomp>z'deserialize_modules.<locals>.<dictcomp>\   s/    EEE1Ax##As++EEEr!   )
valuesr   r   r   r   r6   declidr   items)r0   r1   modr8   irmethodfuncs    `     r   deserialize_modulesrO   <   s.    {{}} * *y> 	* 	*CVc-&899B;ck1113Lr{3Z111')CK$$	*
 {{}} / / +& 	/ 	/F%fc22D9<s}444*TY-?? 544 +/CM$),''	/ FEEE

EEEEr!   N)r0   r?   r1   r   r   r@   )r=   
__future__r   mypyc.commonr   mypyc.ir.class_irr   mypyc.ir.func_irr   r   mypyc.ir.opsr   mypyc.ir.rtypesr	   r
   r   rO   dictr   	ModuleIRsr$   r!   r   <module>rX      s    - - " " " " " " ! ! ! ! ! ! % % % % % % - - - - - - - - " " " " " " 3 3 3 3 3 3 3 3- - - - - - - -` F  F  F  FJ h			r!   