
    J/Ph
                         d 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mZ ddlmZ ed             Zed	             Zd
S )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                     ddl m fd}t          |          }t          j        |dt          j                  } ||          }||fS )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                     |j         }|                                sJ t          ||d                   } | |||          }t          | |||                                          S )Nr   )return_type
is_preciser   r   	_getvalue)contextbuilder	signatureargsarrtyshapesresr   s          W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/np/unsafe/ndarray.pycodegenzempty_inferred.<locals>.codegen   sg    %!!!!!gtAw//nWguf==%III    C)ndimlayoutdtype)numba.np.arrayobjr   lenr   Array	undefined)	typingctxshaper   ndarray_tysigr   s         @r   empty_inferredr(      sq     100000J J J J J 
UB{3eoFFFH
(5//C<r   c                 F   t          |t          j                  st          d          |j        dk    r't          d                    |j                            t          |j                  t          j	        |j
                   ||          }fd}||fS )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                 &   d }|j         d         t          j        g}t          j        g|R  }|                     t          j                  }|                               }|d          |          |g}	|                     ||||	          }
|
S )Nc                 \    |}t          |          D ]}t          ||| |                   }|S )N)ranger
   )arraylengthempty_tupleoutis        r   implz-to_fixed_tuple.<locals>.codegen.<locals>.impl?   s8    C6]] 6 6#CE!H55Jr   r   )r   r   intpr   r   get_value_typeget_constant_undefcompile_internal)r   r   r   r   r4   inner_argtypes	inner_sigll_idx_typer1   
inner_argsr   
tuple_size
tuple_types              r   r   zto_fixed_tuple.<locals>.codegen>   s    	 	 	 $.+UZD$ZA.AAA	,,UZ8800<<1g{{:66D
&&wiLL
r   )
isinstancer   IntegerLiteralr   r   r	   formatintliteral_valueUniTupler   )r#   r/   r0   r'   r   r=   r>   s        @@r   to_fixed_tuplerE   )   s     fe233 J!"HIIIzQ:AA%*MMNNN V)**JekDDDJ
*UF
#
#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(   rE    r   r   <module>rN      s     % $ $ $ $ $ $ $ + + + + + + * * * * * * 0 0 0 0 0 0 > > > > > > > > 4 4 4 4 4 4   4 % % % % %r   