
    \j                        d dl mZ d dlZd dlZd dlmZ d dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ  G d d          Z G d dej                  ZdS )    )annotationsN)Path)build)Options)construct_groups)
emitmodule)Errors)Mapper)CompilerOptionsc                      e Zd ZddZdS )FakeSCCmod_ids	list[str]returnNonec                    || _         d S N)r   )selfr   s     ^/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/mypyc/test/test_emitmodule.py__init__zFakeSCC.__init__   s        N)r   r   r   r   )__name__
__module____qualname__r    r   r   r   r      s(             r   r   c                      e Zd ZddZdS )TestEmitModuler   r   c           	        t          j                    5 }t          j                                        5 }t          |          }|dz  }|dz  }|                    dd           |                    dd           t          j        t          |          dd           t          j        t          |          dd           g}t                      }d	|_        t          |          g|_        t          |d
z            |_        |D ]%}d	|j                            |j        i           d<   &t#          d	          }	t%          |dd	d           }
t'          j        |||	|
          }	 d |
D             }g }ddgddgfD ]}|                    t&          d|fd           t-          |          }t/          |          }t'          j        |||	|          }|j        dk    sJ |                                            d |                                D             }|d         j        }|J |                    d |D                        |d         |d         k    sJ 	 |j        j                                          n## |j        j                                          w xY w	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nza.pyzb.pyz)import b

class A: pass
class C(A): pass
zutf-8)encodingz0import a

class B(a.A): pass
class D(a.A): pass
abTz.mypy_cachemypyc)strict_traceback_checksF)use_shared_libgroup_name_overridec                .    i | ]\  }}|D ]
}|j         |S r   )module).0grouplib_namesources       r   
<dictcomp>zbTestEmitModule.test_compile_modules_to_ir_orders_scc_members_deterministically.<locals>.<dictcomp>3   sB       0?xX] NTFM8   r   sorted_componentsc                "    t          |          gS r   )r   )graphorders     r   <lambda>z`TestEmitModule.test_compile_modules_to_ir_orders_scc_members_deterministically.<locals>.<lambda>;   s    GENN3C r   r   c                2    i | ]}|j         D ]
}|j        |S r   )classesfullname)r(   r'   cls      r   r,   zbTestEmitModule.test_compile_modules_to_ir_orders_scc_members_deterministically.<locals>.<dictcomp>C   sA       ,2QWQ_ KMR   r   za.Ac                    g | ]	}|j         
S r   )r4   )r(   childs     r   
<listcomp>zbTestEmitModule.test_compile_modules_to_ir_orders_scc_members_deterministically.<locals>.<listcomp>H   s    -S-S-Sen-S-S-Sr      )!tempfileTemporaryDirectorypytestMonkeyPatchcontextr   
write_textr   BuildSourcestrr   preserve_asts	mypy_path	cache_dirper_module_options
setdefaultr'   r   r   r   parse_and_typechecksetattrr
   r	   compile_modules_to_ir
num_errorsnew_messagesvalueschildrenappendmanager	metastoreclose)r   tmp_dirmonkeypatchtmp_patha_pyb_pysourcesoptionsr+   compiler_optionsgroupsresult	group_mapchildren_by_orderr0   mappererrorsmodulesr3   rM   s                       r   ?test_compile_modules_to_ir_orders_scc_members_deterministicallyzNTestEmitModule.test_compile_modules_to_ir_orders_scc_members_deterministically   s   (** 3	1gv7I7Q7Q7S7S 3	1WbG}}Hf$Df$DOOKV]O^^^OOFQX    
 !#d))S$77!#d))S$77G iiG$(G!!$XG #H}$< = =G! Y YTX*55fmRHHQQ.tLLL%t  F  3GWFVX^__F1 CI  	 %'!"Cj3*5 U UE''"+,1CCC  
 $I..F#G__F(>(8& G ",11163F3F3H3H111 6=nn6F6F  G  'u~6H#///%,,-S-S(-S-S-STTTT(+/@/CCCCCC(..0000(..00000g3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1 3	1sN   KD1J+%C6I;J+; JJ+K+J/	/K2J/	3KK
KN)r   r   )r   r   r   ra   r   r   r   r   r      s(        41 41 41 41 41 41r   r   )
__future__r   r:   unittestpathlibr   r<   mypyr   mypy.optionsr   mypyc.buildr   mypyc.codegenr   mypyc.errorsr	   mypyc.irbuild.mapperr
   mypyc.optionsr   r   TestCaser   r   r   r   <module>rm      s!   " " " " " "                            ( ( ( ( ( ( $ $ $ $ $ $       ' ' ' ' ' ' ) ) ) ) ) )       
51 51 51 51 51X& 51 51 51 51 51r   