
    shC                     d    S r SSKJrJrJr  SSKJr  SSKJr  \S 5       r	\S 5       r
\S 5       rg)	z
This file provides internal compiler utilities that support certain special
operations with tuple and workarounds for limitations enforced in userland.
    )typestypingerrors)alloca_once)	intrinsicc                 4    S nU" XUR                   5      nXT4$ )a  Return a copy of the tuple with item at *idx* replaced with *val*.

Operation: ``out = tup[:idx] + (val,) + tup[idx + 1:]

**Warning**

- No boundchecking.
- The dtype of the tuple cannot be changed.
  *val* is always cast to the existing dtype of the tuple.
c                     Uu  pEn[        XR                  5      nUR                  XG5        UR                  XuR                  S5      U/SS9nUR                  Xh5        UR	                  U5      $ )Nr   T)inbounds)r   typestoregepload)	contextbuilder	signatureargstupidxvalstackoffptrs	            n/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/cpython/unsafe/tuple.pycodegentuple_setitem.<locals>.codegen   s_    #GXX.c!UXXa[#$6Fc"||E""    )dtype)	typingctxr   r   r   r   sigs         r   tuple_setitemr      s!    # c		
"C<r   c                   ^^ [        U[        R                  5      (       d  [        R                  " U5      e[        UR                  5      m[        R                  " [        R                  TS9mT" U5      nUU4S jnX#4$ )z"Creates a sz-tuple of full slices.)r   countc                    > S n[         R                  T/n[        R                  " T/UQ76 nU R	                  [         R                  5      nU R                  T5      nU" T5      U/n	U R                  XXi5      n
U
$ )Nc           	      Z    Un[        U 5       H  n[        X#[        S S 5      5      nM     U$ )N)ranger   slice)lengthempty_tupleoutis       r   impl5build_full_slice_tuple.<locals>.codegen.<locals>.impl/   s-    C6]#CE$,=> #Jr   )r   intpr   r   get_value_typeget_constant_undefcompile_internal)r   r   r   r   r*   inner_argtypes	inner_sigll_idx_typer'   
inner_argsressize
tuple_types              r   r   'build_full_slice_tuple.<locals>.codegen.   sw    	  **j1$$ZA.A	,,UZZ800<!$'5
&&wiL
r   )	
isinstancer   IntegerLiteralr   RequireLiteralValueintliteral_valueUniTupleslice2_type)tyctxszr   r   r5   r6   s       @@r   build_full_slice_tuplerA   $   sg     b%..//((,,r De&7&7tDJ
R.C" <r   c                     [        U[        R                  5      (       d  SU 3n[        R                  " U5      eU" U5      nS nX44$ )a>  This exists to handle the situation y = (*x,), the interpreter injects a
call to it in the case of a single value unpack. It's not possible at
interpreting time to differentiate between an unpack on a variable sized
container e.g. list and a fixed one, e.g. tuple. This function handles the
situation should it arise.
zBOnly tuples are supported when unpacking a single item, got type: c                     US   $ )Nr    )r   r   r   r   s       r   r   $unpack_single_tuple.<locals>.codegenR   s    Awr   )r8   r   	BaseTupler   UnsupportedError)r?   r   msgr   r   s        r   unpack_single_tuplerI   B   sM     c5??++5"%%c**
c(C<r   N)__doc__
numba.corer   r   r   numba.core.cgutilsr   numba.core.extendingr   r   rA   rI   rD   r   r   <module>rN      sT   
 - , * *  0  :  r   