관리-도구
편집 파일: print_coercion_tables.cpython-37.pyc
B ��Fd{ � @ s d Z ddlmZmZmZ ddlZG dd� de�Zdd� Z dd d �Z ed� e ejd � e� ed � e� ed� e ejd ddd� e� ed� e ejd ddd� e� ed� e ejd ddd� e� ed� e ejd ddd� e� ed� e ejd dddd� dS )z:Prints type-coercion tables for the built-in NumPy types � )�division�absolute_import�print_functionNc @ s. e Zd Zdd� Zdd� Zdd� Ze�d�ZdS ) � GenericObjectc C s || _ d S )N)�v)�selfr � r �V/opt/alt/python37/lib64/python3.7/site-packages/numpy/testing/print_coercion_tables.py�__init__ s zGenericObject.__init__c C s | S )Nr )r �otherr r r �__add__ s zGenericObject.__add__c C s | S )Nr )r r r r r �__radd__ s zGenericObject.__radd__�ON)�__name__� __module__�__qualname__r r r �np�dtyper r r r r s r c C sv t ddd� x| D ]}t |dd� qW t � xD| D ]<}t |dd� x$| D ]}t tt�||��dd� qHW t � q2W d S )N�X� )�end)�print�intr Zcan_cast)�ntypes�char�row�colr r r �print_cancast_table s r Fc C sb t ddd� x| D ]}t |dd� qW t � �x.| D �]$}|dkrHt}n t�|�}t |dd� x�| D ]�}|dkrvt} n t�|�} yx|r�tj||�g|d�} n||�} | |�}|r�t�| j|j�j}n2t�| |�}t |tj �r�|jj}nt�t|��j}W nJ tk �r d}Y n2 t k �r* d}Y n tk �rB d}Y nX t |dd� qdW t � q4W d S ) N�+r )r r )r �!�@�#)r r r Z obj2sctype�array� promote_typesr r �add� isinstanceZndarray�type� ValueError� OverflowError� TypeError) r ZinputfirstvalueZinputsecondvalueZ firstarrayZuse_promote_typesr r Zrowtyper ZcoltypeZrowvalueZcolvalue�valuer r r �print_coercion_table s@ r+ zcan castZAllzJIn these tables, ValueError is '!', OverflowError is '@', TypeError is '#'zscalar + scalarzscalar + neg scalar���zarray + scalarTzarray + neg scalarr# )F) �__doc__� __future__r r r �numpyr �objectr r r+ r Z typecodesr r r r �<module> s0 (