§
    ƒÛgC  ã                   óx   — d Z ddlmZmZmZ ddlmZ ddlmZ ed„ ¦   «         Z	ed„ ¦   «         Z
ed„ ¦   «         ZdS )	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   — d„ } ||||j         ¦  «        }||fS )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                 ó  — |\  }}}t          ||j        ¦  «        }|                     ||¦  «         |                     ||                     d¦  «        |gd¬¦  «        }|                     ||¦  «         |                     |¦  «        S )Nr   T)Úinbounds)r   ÚtypeÚstoreÚgepÚload)	ÚcontextÚbuilderÚ	signatureÚargsÚtupÚidxÚvalÚstackÚoffptrs	            úP/granary/edev/quantum/lib/python3.11/site-packages/numba/cpython/unsafe/tuple.pyÚcodegenztuple_setitem.<locals>.codegen   s~   € Ø‰ˆˆS�#Ý˜G S¤XÑ.Ô.ˆØ�Š�c˜5Ñ!Ô!Ð!à—’˜U S§X¢X¨a¡[¤[°#Ð$6À�ÑFÔFˆØ�Š�c˜6Ñ"Ô"Ð"Ø�|Š|˜EÑ"Ô"Ð"ó    )Údtype)Ú	typingctxr   r   r   r   Úsigs         r   Útuple_setitemr      s2   € ð#ð #ð #ð ˆ#ˆc�3˜œ	Ñ
"Ô
"€CØ�ˆ<Ðr   c                 óô   ‡‡— t          |t          j        ¦  «        st          j        |¦  «        ‚t          |j        ¦  «        Št          j        t          j        ‰¬¦  «        Š ‰|¦  «        }ˆˆfd„}||fS )z"Creates a sz-tuple of full slices.)r   Úcountc                 ó   •— d„ }t           j        ‰g}t          j        ‰g|¢R Ž }|                      t           j        ¦  «        }|                      ‰¦  «        } |‰¦  «        |g}	|                      ||||	¦  «        }
|
S )Nc           	      ól   — |}t          | ¦  «        D ]!}t          ||t          d d ¦  «        ¦  «        }Œ"|S )N)Úranger   Úslice)ÚlengthÚempty_tupleÚoutÚis       r   Úimplz5build_full_slice_tuple.<locals>.codegen.<locals>.impl/   s>   € ØˆCÝ˜6‘]”]ð ?ð ?�Ý# C¨­E°$¸Ñ,=Ô,=Ñ>Ô>��Øˆ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   z'build_full_slice_tuple.<locals>.codegen.   s’   ø€ ð	ð 	ð 	õ  œ* jÐ1ˆÝÔ$ ZÐA°.ÐAÐAÐAˆ	Ø×,Ò,­U¬ZÑ8Ô8ˆà×0Ò0°Ñ<Ô<ˆØ!�k $Ñ'Ô'¨Ð5ˆ
à×&Ò& w°°iÀÑLÔLˆØˆ
r   )	Ú
isinstancer   ÚIntegerLiteralr   ÚRequireLiteralValueÚintÚliteral_valueÚUniTupleÚslice2_type)ÚtyctxÚszr   r   r3   r4   s       @@r   Úbuild_full_slice_tupler>   $   sŠ   øø€ õ �b�%Ô.Ñ/Ô/ð -ÝÔ(¨Ñ,Ô,Ð,åˆrÔÑ Ô €DÝ”¥eÔ&7¸tÐDÑDÔD€JØ
ˆ*�R‰.Œ.€Cðð ð ð ð ð ð" �ˆ<Ðr   c                 óŒ   — t          |t          j        ¦  «        sd|› �}t          j        |¦  «        ‚ ||¦  «        }d„ }||fS )aR  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                 ó   — |d         S )Nr   © )r   r   r   r   s       r   r   z$unpack_single_tuple.<locals>.codegenR   s   € Ø�AŒwˆr   )r5   r   Ú	BaseTupler   ÚUnsupportedError)r<   r   Úmsgr   r   s        r   Úunpack_single_tuplerE   B   sc   € õ �c�5œ?Ñ+Ô+ð +ð"Øð"ð "ˆåÔ% cÑ*Ô*Ð*à
ˆ#ˆc‰(Œ(€Cðð ð à�ˆ<Ðr   N)Ú__doc__Ú
numba.corer   r   r   Únumba.core.cgutilsr   Únumba.core.extendingr   r   r>   rE   rA   r   r   ú<module>rJ      s®   ððð ð
 -Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø *Ð *Ð *Ð *Ð *Ð *Ø *Ð *Ð *Ð *Ð *Ð *ð ðð ñ „ðð0 ðð ñ „ðð: ðð ñ „ðð ð r   