
    sh
                     x    S r SSKJrJr  SSKJr  SSKJr  SSKJ	r	  SSK
JrJr  SSKJr  \S 5       r\S	 5       rg
)zd
This file provides internal compiler utilities that support certain special
operations with numpy.
    )typestyping)unpack_tuple)	intrinsic)impl_ret_new_ref)RequireLiteralValueTypingError)tuple_setitemc                    ^ SSK Jm  U4S jn[        U5      n[        R                  " US[        R
                  S9nU" U5      nXR4$ )zA version of numpy.empty whose dtype is inferred by the type system.

Expects `shape` to be a int-tuple.

There is special logic in the type-inferencer to handle the "refine"-ing
of undefined dtype.
r   )_empty_nd_implc                    > UR                   nUR                  5       (       d   e[        XS   5      nT" XXE5      n[        XXFR	                  5       5      $ )Nr   )return_type
is_preciser   r   	_getvalue)contextbuilder	signatureargsarrtyshapesresr   s          k/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/np/unsafe/ndarray.pycodegenempty_inferred.<locals>.codegen   sP    %%!!!!gAw/Wu=%II    C)ndimlayoutdtype)numba.np.arrayobjr   lenr   Array	undefined)	typingctxshaper   ndarray_tysigr   s         @r   empty_inferredr)      s@     1J 
UB{{3eooFH
5/C<r   c                 N  ^^ [        U[        R                  5      (       d  [        S5      eUR                  S:w  a$  [        SR                  UR                  5      5      e[        UR                  5      m[        R                  " UR                  TS9mT" X5      nUU4S jnX44$ )zConvert *array* into a tuple of *length*

Returns ``UniTuple(array.dtype, length)``

** Warning **
- No boundchecking.
  If *length* is longer than *array.size*, the behavior is undefined.
z$*length* argument must be a constant   zNot supported on array.ndim={})r   countc                   > S nUR                   S   [        R                  T/n[        R                  " T/UQ76 nU R                  [        R                  5      nU R                  T5      nUS   U" T5      U/n	U R                  XXi5      n
U
$ )Nc                 J    Un[        U5       H  n[        X4X   5      nM     U$ )N)ranger
   )arraylengthempty_tupleoutis        r   impl-to_fixed_tuple.<locals>.codegen.<locals>.impl?   s(    C6]#CEH5 #Jr   r   )r   r   intpr   r   get_value_typeget_constant_undefcompile_internal)r   r   r   r   r5   inner_argtypes	inner_sigll_idx_typer2   
inner_argsr   
tuple_size
tuple_types              r   r   to_fixed_tuple.<locals>.codegen>   s    	 $..+UZZD$$ZA.A	,,UZZ800<1g{:6D
&&wiL
r   )
isinstancer   IntegerLiteralr   r   r	   formatintliteral_valueUniTupler   )r$   r0   r1   r(   r   r?   r@   s        @@r   to_fixed_tuplerH   )   s     fe2233!"HIIzzQ:AA%**MNN V))*JekkDJ
U
#C" <r   N)__doc__
numba.corer   r   numba.core.cgutilsr   numba.core.extendingr   numba.core.imputilsr   numba.core.errorsr   r	   numba.cpython.unsafe.tupler
   r)   rH    r   r   <module>rQ      sF    % + * 0 > 4  4 % %r   