
    hi                       d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZmZmZ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mZmZ ddlmZ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)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1  ededef                   Z2 eee2ge2f          ej3        d                    Z4e4d/d'            Z5d0d-Z6d.S )1a?  Transform a mypy AST to the IR form (Intermediate Representation).

For example, consider a function like this:

   def f(x: int) -> int:
       return x * 2 + 1

It would be translated to something that conceptually looks like this:

   r0 = 2
   r1 = 1
   r2 = x * r0 :: int
   r3 = r2 + r1 :: int
   return r3

This module deals with the module-level IR transformation logic and
putting it all together. The actual IR is implemented in mypyc.ir.

For the core of the IR transform implementation, look at build_ir()
below, mypyc.irbuild.builder, and mypyc.irbuild.visitor.
    )annotations)AnyCallableTypeVarcast)Graph)ClassDef
ExpressionFuncDefMypyFile)state)Type)analyze_always_defined_attrs)TOP_LEVEL_NAME)Errors)FuncDeclFuncIRFuncSignature)ModuleIR	ModuleIRs)none_rprimitive)	IRBuilder)Mapper)PreBuildVisitor)build_type_map create_generator_class_if_needed"find_singledispatch_register_impls)IRBuilderVisitor)compute_vtable)CompilerOptionsF.)boundTmoduleslist[MypyFile]graphr   typesdict[Expression, Type]mapperr   optionsr    errorsr   returnr   c                    t          || ||||           t          | |          }i }|j        dk    r|S g }| D ]}	t          ||	|j        |          }
|	                    |
           |
j        D ]:}t          |t                    r#d|j	         }t          |	j        d|||           ;t                      }t          |	j        |||||
|||j        	  	        }||_        t!          ||	           t#          |	j        t%          |j                  |j        |j        |j        |j                  }|||	j        <   |                    |j                   t3          |           |D ]}|j        rt7          |           |S )zBuild basic IR for a set of modules that have been type-checked by mypy.

    The returned IR is not complete and requires additional
    transformations, such as the insertion of refcount handling.
    r   ___N)name_suffix)r   r   
num_errorsr   decorators_to_removeacceptnested_funcs
isinstancer   liner   fullnamer   r   singledispatch_implsbuildertransform_mypy_filer   listimports	functionsclassesfinal_namestype_var_namesextendr   is_ext_classr   )r#   r%   r&   r(   r)   r*   singledispatch_inforesult	class_irsmodulepbvfdefsuffixvisitorr7   	module_ircirs                    b/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/mypyc/irbuild/main.pybuild_irrL   7   s    67E5'6BBB<WfMMF1 I (* (*ff.A.VX]^^c $ 	 	D$(( *ty**0OT4V   
 #$$O4

 

 " 	GV,,,O!!O"
 
	 #,v)))) +++      	 3M    r7   r   mypyfiler   Nonec                   |j         dv rdS |                     |j         |j                   d |j        D             }|D ]3}| j        j        |j                 }| j                            |           4| 	                    d           | 
                    dd           |j        D ]}|                     |           |                                  |                                 \  }}}}	}t          g t                    }
t!          t#          t$          d| j        |
          ||d          }| j                            |           dS )z Generate IR for a single module.)typingabcNc                <    g | ]}t          |t                    |S  )r3   r	   ).0nodes     rK   
<listcomp>z'transform_mypy_file.<locals>.<listcomp>   s'    LLLD(1K1KLtLLLrM   z<module>builtins)traceback_name)r5   
set_modulepathdefsr(   
type_to_irinfor<   appendenter
gen_importr1   maybe_add_implicit_returnleaver   r   r   r   r   module_namer;   )r7   rN   r<   clsirrV   args_blocksret_typesigfunc_irs               rK   r8   r8      sb    --- 	x((-888LLLLLG  # #^&sx0r""""MM* z2&&&   t%%''' $+==?? D!VXq
O
,
,Cw':C@@!	  G W%%%%%rM   N)r#   r$   r%   r   r&   r'   r(   r   r)   r    r*   r   r+   r   )r7   r   rN   r   r+   rO   )7__doc__
__future__r   rQ   r   r   r   r   
mypy.buildr   
mypy.nodesr	   r
   r   r   
mypy.stater   
mypy.typesr   mypyc.analysis.attrdefinedr   mypyc.commonr   mypyc.errorsr   mypyc.ir.func_irr   r   r   mypyc.ir.module_irr   r   mypyc.ir.rtypesr   mypyc.irbuild.builderr   mypyc.irbuild.mapperr   mypyc.irbuild.prebuildvisitorr   mypyc.irbuild.preparer   r   r   mypyc.irbuild.visitorr   mypyc.irbuild.vtabler   mypyc.optionsr    r!   strict_optional_setstrict_optional_decrL   r8   rT   rM   rK   <module>r      sM   , # " " " " " / / / / / / / / / / / /       > > > > > > > > > > > >             C C C C C C ' ' ' ' ' '       < < < < < < < < < < 2 2 2 2 2 2 2 2 + + + + + + + + + + + + ' ' ' ' ' ' 9 9 9 9 9 9         
 3 2 2 2 2 2 / / / / / / ) ) ) ) ) ) GCxS)***d8QCF+-FU-Ft-L-LMM  I I I IX%& %& %& %& %& %&rM   