HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/numpy/testing/__pycache__/print_coercion_tables.cpython-310.pyc
o

6��a�@s@dZddlZddlmZGdd�d�Zdd�Zdd	d
�Zdddd�d
d�Ze	dkr�e
d�eejd�e
�e
d�e
�e
d�eejdddd�e
�e
d�eejdddd�e
�e
d�eejdddd�e
�e
d�eejdddd�e
�e
d�eejddddd�e
d�edddd�dSdS)z:Prints type-coercion tables for the built-in NumPy types

�N)�
namedtuplec@s.eZdZdd�Zdd�Zdd�Ze�d�ZdS)	�
GenericObjectcCs
||_dS�N)�v)�selfr�r�E/usr/lib/python3/dist-packages/numpy/testing/print_coercion_tables.py�__init__
s
zGenericObject.__init__cC�|Srr�r�otherrrr�__add__
�zGenericObject.__add__cCr
rrrrrr�__radd__rzGenericObject.__radd__�ON)�__name__�
__module__�__qualname__r	r
r�np�dtyperrrrr	s
rcCs�tddd�|D]}t|dd�qt�|D]@}t|dd�|D]2}t�||d�r,d}n t�||d�r6d}nt�||d�r@d	}nt�||d
�rJd}nd}t|dd�q t�qdS)N�X� ��end�equiv�#�safe�=�	same_kind�~�unsafe�.)�printr�can_cast)�ntypes�char�row�col�castrrr�print_cancast_tables&�r)Fc

CsFtddd�|D]}t|dd�qt�|D]�}|dkrt}nt�|�}t|dd�|D]p}|dkr5t}	nt�|�}	z<|rHtj||�g|d�}
n||�}
|	|�}|r\t�|
j|j�j}nt�|
|�}t	|tj
�rm|jj}nt�t|��j}Wnty�d}Ynt
y�d}Ynty�d}Ynwt|dd�q,t�qdS)	N�+rrr)r�!�@r)r"rr�
obj2sctype�array�
promote_typesrr%�add�
isinstance�ndarray�type�
ValueError�
OverflowError�	TypeError)
r$�inputfirstvalue�inputsecondvalue�
firstarray�use_promote_typesr%r&�rowtyper'�coltype�rowvalue�colvalue�valuerrr�print_coercion_table*sF


���r@T�r#�legacy�flagsc	s�ddlm}dddddd�}dd	d
ddd
ddd�}tdgd��}|ddd��|�}i�t��|D]Y}��|d���|d�|d�vrLi�|d<�|d}	||d}|dr^dnd}d}|drj|dO}|drr|dO}|drz|dO}||}||||d�|	|d<q0tjd��fd d!�}
t�|
d"��d.���fd$d%�	}|r�t�td&�t�|d#�|r�t�td'�t�|d�|r�t�t|d�d(|d�d)|d�d*|d�d+��t�|d,�d-Sd-S)/z[Prints new casts, the values given are default "can-cast" values, not
    actual ones.
    r)�get_all_cast_informationrrrr!)r����u▗u█u▚u▐u▄u▜u▙u▟)r�rErFrHrG���	cast_inforAr�from�to�castingrB�L�requires_pyapirE�supports_unalignedrF�no_floatingpoint_errorsrH�Allcs@t�|j�}z��|j�}Wntytj}Ynw||jfSr)rrr3�indexr%r4�inf)�xr�indx)�typesrr�sorter�s
�
z$print_new_cast_table.<locals>.sorter)�keyr#cs�tddd��D]
}tt�|j�jdd�qt��D](}tt�|j�jdd���|i�}�D]}tt|�|��|�dd�q0t�qdS)Nrrr)r"rrr3r%�get�getattr)�field�dt�from_dtr&�to_dt)�dtypes�no_cast_info�tablerr�print_table�s�z)print_new_cast_table.<locals>.print_tablezDCasting: # is equivalent, = is safe, ~ is same-kind, and . is unsafez+L denotes a legacy cast . a non-legacy one.z: no flags, z	: PyAPI, z: supports unaligned, z: no-float-errorsrCN)r#)	�numpy.core._multiarray_testsrDr�setr0r�	typecodes�sortedr")r#rBrCrD�
cast_table�flags_tablerL�castsr(�to_dictrZrer)rbrcrdrYr�print_new_cast_tableSst��

�
��rn�__main__zcan castrTzJIn these tables, ValueError is '!', OverflowError is '@', TypeError is '#'zscalar + scalarzscalar + neg scalar���zarray + scalarzarray + neg scalarr/zNew casting type promotion:)F)�__doc__�numpyr�collectionsrrr)r@rnrr"rhrrrr�<module>s<
)_�