HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib64/python3.7/site-packages/numpy/core/__pycache__/arrayprint.cpython-37.pyc
B

<�Fdr�@s�dZddlmZmZmZdddgZdZddlZddlZej	ddkrxydd	l
mZWq�ek
rtdd	l
mZYq�Xn2ydd	lmZWn ek
r�dd	lmZYnXd
dlmZd
dlmZmZmZmZmZmZd
d
lmZmZmZmZmZd
dl m!Z!d
dl"m#Z#ej	ddk�r.ej$Z%ej$d
Z&nej'Z%ej'd
Z&dd�Z(da)da*da+da,da-da.da/da0dFdd�Z1dd�Z2dd�Z3dd�Z4dd�Z5d d!�Z6d"d#�Z7d$d%�Z8dGd(d)�Z9dHd+d,�Z:e:�dddd&d'e;dfd-d��Z<d.d/�Z=d0d1�Z>Gd2d3�d3e?�Z@d4d5�ZAGd6d7�d7e?�ZBGd8d9�d9e?�ZCGd:d;�d;e?�ZDGd<d=�d=e?�ZEGd>d?�d?e?�ZFGd@dA�dAe?�ZGGdBdC�dCe?�ZHGdDdE�dEe?�ZIdS)IzXArray printing function

$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $

�)�division�absolute_import�print_function�array2string�set_printoptions�get_printoptionsZrestructuredtextN�)�	get_ident�)�numerictypes)�maximum�minimum�absolute�	not_equal�isnan�isinf)�array�format_longfloat�datetime_as_string�
datetime_data�dtype)�ravel)�asarraycCs||S)N�)�x�yrr�H/opt/alt/python37/lib64/python3.7/site-packages/numpy/core/arrayprint.py�product-sri��F�K�nan�infcCs`|dk	r|a|dk	r|a|dk	r$|a|dk	r0|a|dk	r@|a|dk	rL|a|dk	rX|a|adS)a�

    Set printing options.

    These options determine the way floating point numbers, arrays and
    other NumPy objects are displayed.

    Parameters
    ----------
    precision : int, optional
        Number of digits of precision for floating point output (default 8).
    threshold : int, optional
        Total number of array elements which trigger summarization
        rather than full repr (default 1000).
    edgeitems : int, optional
        Number of array items in summary at beginning and end of
        each dimension (default 3).
    linewidth : int, optional
        The number of characters per line for the purpose of inserting
        line breaks (default 75).
    suppress : bool, optional
        Whether or not suppress printing of small floating point values
        using scientific notation (default False).
    nanstr : str, optional
        String representation of floating point not-a-number (default nan).
    infstr : str, optional
        String representation of floating point infinity (default inf).
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are::

            - 'bool'
            - 'int'
            - 'timedelta' : a `numpy.timedelta64`
            - 'datetime' : a `numpy.datetime64`
            - 'float'
            - 'longfloat' : 128-bit floats
            - 'complexfloat'
            - 'longcomplexfloat' : composed of two 128-bit floats
            - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
            - 'object' : `np.object_` arrays
            - 'str' : all other strings

        Other keys that can be used to set a group of types at once are::

            - 'all' : sets all types
            - 'int_kind' : sets 'int'
            - 'float_kind' : sets 'float' and 'longfloat'
            - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
            - 'str_kind' : sets 'str' and 'numpystr'

    See Also
    --------
    get_printoptions, set_string_function, array2string

    Notes
    -----
    `formatter` is always reset with a call to `set_printoptions`.

    Examples
    --------
    Floating point precision can be set:

    >>> np.set_printoptions(precision=4)
    >>> print(np.array([1.123456789]))
    [ 1.1235]

    Long arrays can be summarised:

    >>> np.set_printoptions(threshold=5)
    >>> print(np.arange(10))
    [0 1 2 ..., 7 8 9]

    Small results can be suppressed:

    >>> eps = np.finfo(float).eps
    >>> x = np.arange(4.)
    >>> x**2 - (x + eps)**2
    array([ -4.9304e-32,  -4.4409e-16,   0.0000e+00,   0.0000e+00])
    >>> np.set_printoptions(suppress=True)
    >>> x**2 - (x + eps)**2
    array([-0., -0.,  0.,  0.])

    A custom formatter can be used to display array elements as desired:

    >>> np.set_printoptions(formatter={'all':lambda x: 'int: '+str(-x)})
    >>> x = np.arange(3)
    >>> x
    array([int: 0, int: -1, int: -2])
    >>> np.set_printoptions()  # formatter gets reset
    >>> x
    array([0, 1, 2])

    To put back the default options, you can use:

    >>> np.set_printoptions(edgeitems=3,infstr='inf',
    ... linewidth=75, nanstr='nan', precision=8,
    ... suppress=False, threshold=1000, formatter=None)
    N)�_line_width�_summaryThreshold�_summaryEdgeItems�_float_output_precision�_float_output_suppress_small�_nan_str�_inf_str�
_formatter)�	precision�	threshold�	edgeitems�	linewidth�suppress�nanstr�infstr�	formatterrrrr;snc
Cstttttttttd�}|S)a	
    Return the current print options.

    Returns
    -------
    print_opts : dict
        Dictionary of current print options with keys

          - precision : int
          - threshold : int
          - edgeitems : int
          - linewidth : int
          - suppress : bool
          - nanstr : str
          - infstr : str
          - formatter : dict of callables

        For a full description of these options, see `set_printoptions`.

    See Also
    --------
    set_printoptions, set_string_function

    )r*r+r,r-r.r/r0r1)	�dictr%r#r$r"r&r'r(r))�drrrr�scs�ddlm}�jdkrNt��dtkrH|��dt��td�f�}qԈ}n�t��dtkr��fdd�ttt��t��D�}|��fdd�ttt��t�dd�D��n�fd	d�tdt���D�}|�t	|��}|S)
Nr
)�numeric�csg|]}t�|��qSr)�_leading_trailing)�.0�i)�arr�
<listcomp>�sz%_leading_trailing.<locals>.<listcomp>csg|]}t�|��qSr)r6)r7r8)r9rrr:�sr���csg|]}t�|��qSr)r6)r7r8)r9rrr:�s)
�r4�ndim�lenr$Zconcatenate�range�min�extend�tuple)r9�_nc�b�lr)r9rr6�s
r6cCs|rdSdSdS)Nz True�Falser)rrrr�_boolFormatter�srGcCs t|�tkrd}nd}|�|�S)z@ Object arrays containing lists should be printed unambiguously z
list({!r})z{!r})�type�list�format)�oZfmtrrr�_object_format�srLcCst|�S)N)�repr)rrrr�repr_format�srNcs�dd��fdd����fdd��fdd����fdd��fdd��fdd��fd	d�d
d�dd�dd�d
�}dd�}�dk	�r��fdd����D�}d|kr�x |��D]}|�d�||<q�Wd|kr�xdD]}|�d�||<q�Wd|k�rxdD]}|�d�||<q�Wd|k�r6xdD]}|�d�||<�qWd|k�r`xdD]}|�d�||<�qFWx,|��D] }||k�rj|�|�||<�qjW|S)NcSstS)N)rGrrrr�<lambda>�z!_get_formatdict.<locals>.<lambda>cst��S)N)�
IntegerFormatr)�datarrrOrPcst����S)N)�FloatFormatr)rRr*�suppress_smallrrrOrPcst��S)N)�LongFloatFormatr)r*rrrOrPcst����S)N)�
ComplexFormatr)rRr*rTrrrOscst��S)N)�LongComplexFormatr)r*rrrOrPcst��S)N)�DatetimeFormatr)rRrrrO	rPcst��S)N)�TimedeltaFormatr)rRrrrO
rPcSstS)N)rLrrrrrOrPcSstS)N)rNrrrrrOrPcSstS)N)�strrrrrrO
rP)�bool�int�float�	longfloat�complexfloat�longcomplexfloat�datetime�	timedelta�object�numpystrrZcs�fdd�S)Ncs�S)Nrr)rrrrOrPz3_get_formatdict.<locals>.indirect.<locals>.<lambda>r)rr)rr�indirectsz!_get_formatdict.<locals>.indirectcsg|]}�|dk	r|�qS)Nr)r7�k)r1rrr:sz#_get_formatdict.<locals>.<listcomp>�allZint_kind)r\Z
float_kind)r]r^Zcomplex_kind)r_r`Zstr_kind)rdrZ)�keys)rRr*rTr1�
formatdictreZfkeys�keyr)rRr1r*rTr�_get_formatdictsB













rkcCsz|j}|jdk	rfg}xH|jD]>}||}tt|�|||�}||jdkrPt|�}|�|�qWt|�S|j	}	t
||||�}
t|	tj
�r�|
d�St|	tj�r�t|	tj�r�|
d�S|
d�Sn�t|	tj�r�t|	tj�r�|
d�S|
d�Sn�t|	tj��rt|	tj��r|
d�S|
d	�SnXt|	tjtjf��r<|
d
�St|	tj��rT|
d�St|	tj��rl|
d�S|
d
�SdS)
z;
    find the right formatting function for the dtype_
    Nrr[rbr\r^r]r`r_rdrarc)r�fields�names�_get_format_functionr�shape�SubArrayFormat�append�StructureFormatrHrk�
issubclass�_ntZbool_ZintegerZtimedelta64Zfloatingr^ZcomplexfloatingZ
clongfloatZunicode_Zstring_Z
datetime64Zobject_)rRr*rTr1Zdtype_�format_functionsZ
field_nameZfield_values�format_functionZdtypeobjrirrrrn+sD







rn� r<c	Csn|jtkrd}t|�}nd}tt|��}t||||�}	d}
|
dt|�7}
t||	|j||
|t	|�dd�}|S)Nz..., r<rwr;)
�sizer#r6rrrnr>�_formatArrayr=r$)r9�max_line_widthr*rT�	separator�prefixr1�summary_insertrRrv�next_line_prefix�lstrrr�
_array2stringWs

r��...cs�fdd�}|S)a
    Like the python 3.2 reprlib.recursive_repr, but forwards *args and **kwargs

    Decorates a function such that if it calls itself with the same first
    argument, it returns `fillvalue` instead of recursing.

    Largely copied from reprlib.recursive_repr
    cs$t��t������fdd��}|S)Nc	sFt|�t�f}|�kr�S��|�z�|f|�|�S��|�XdS)N)�idr	�add�discard)�self�args�kwargsrj)�f�	fillvalue�repr_runningrr�wrapper}s
z>_recursive_guard.<locals>.decorating_function.<locals>.wrapper)�set�	functools�wraps)r�r�)r�)r�r�r�decorating_functionzsz-_recursive_guard.<locals>.decorating_functionr)r�r�r)r�r�_recursive_guardps
r�c	Cs�|dkrt}|dkrt}|dkr$t}|dkr0t}|jdkr�|��}|jjdk	rzt|g|jd�}	t	|	|||�}
|
|	d�}q�||�}n.t
�t|j�dkr�d}nt
|||||||d�}|S)a�
    Return a string representation of an array.

    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        The maximum number of columns the string should span. Newline
        characters splits the string appropriately after array elements.
    precision : int, optional
        Floating point precision. Default is the current printing
        precision (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent very small numbers as zero. A number is "very small" if it
        is smaller than the current printing precision.
    separator : str, optional
        Inserted between elements.
    prefix : str, optional
        An array is typically printed as::

          'prefix(' + array2string(a) + ')'

        The length of the prefix string is used to align the
        output correctly.
    style : function, optional
        A function that accepts an ndarray and returns a string.  Used only
        when the shape of `a` is equal to ``()``, i.e. for 0-D arrays.
    formatter : dict of callables, optional
        If not None, the keys should indicate the type(s) that the respective
        formatting function applies to.  Callables should return a string.
        Types that are not specified (by their corresponding keys) are handled
        by the default formatters.  Individual types for which a formatter
        can be set are::

            - 'bool'
            - 'int'
            - 'timedelta' : a `numpy.timedelta64`
            - 'datetime' : a `numpy.datetime64`
            - 'float'
            - 'longfloat' : 128-bit floats
            - 'complexfloat'
            - 'longcomplexfloat' : composed of two 128-bit floats
            - 'numpystr' : types `numpy.string_` and `numpy.unicode_`
            - 'str' : all other strings

        Other keys that can be used to set a group of types at once are::

            - 'all' : sets all types
            - 'int_kind' : sets 'int'
            - 'float_kind' : sets 'float' and 'longfloat'
            - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat'
            - 'str_kind' : sets 'str' and 'numpystr'

    Returns
    -------
    array_str : str
        String representation of the array.

    Raises
    ------
    TypeError
        if a callable in `formatter` does not return a string.

    See Also
    --------
    array_str, array_repr, set_printoptions, get_printoptions

    Notes
    -----
    If a formatter is specified for a certain type, the `precision` keyword is
    ignored for that type.

    This is a very flexible function; `array_repr` and `array_str` are using
    `array2string` internally so keywords with the same name should work
    identically in all three functions.

    Examples
    --------
    >>> x = np.array([1e-16,1,2,3])
    >>> print(np.array2string(x, precision=2, separator=',',
    ...                       suppress_small=True))
    [ 0., 1., 2., 3.]

    >>> x  = np.arange(3.)
    >>> np.array2string(x, formatter={'float_kind':lambda x: "%.2f" % x})
    '[0.00 1.00 2.00]'

    >>> x  = np.arange(3)
    >>> np.array2string(x, formatter={'int':lambda x: hex(x)})
    '[0x0L 0x1L 0x2L]'

    Nr)rrz[])r1)r"r%r&r)ro�itemrrlrrnr��reducerr�)r9rzr*rTr{r|Zstyler1r�arrrvrrrrr�s*b


cCs@t|���t|���|kr0||��d7}|}||7}||fS)N�
)r>�rstrip)�s�line�word�max_line_lenr~rrr�_extendLines
r�cCsv|dkrtd��|r2d|t|�kr2|}|}	|}
nd}t|�}	d}
|dk�r"d}|}x4t|�D](}
|||
�|}t|||||�\}}q^W|
r�t|||
||�\}}x:t|	dd�D]*}
|||
�|}t|||||�\}}q�W||d�}t|||||�\}}||d7}d|t|�d	�}�nPd}|��}xlt|�D]`}
|
dk�rN||7}|t||
||d|d
||||�7}|��|��dt|dd�}�q8W|
�r�|||
d7}xxt|	dd�D]h}
|�s�|
|	k�r�||7}|t||
||d|d
||||�7}|��|��dt|dd�}�q�W|�s<|	dk�rD||7}|t|d||d|d
||||���d7}|S)zgformatArray is designed for two modes of operation:

    1. Full output

    2. Summarized output

    rzrank shouldn't be zero.r5r<r
r;z]
�[Nrwr�)�
ValueErrorr>r?r�r�ry�max)r9rvZrankr�r~r{Z
edge_itemsr}Z
leading_itemsZtrailing_itemsZsummary_insert1r�r�r8r��seprrrrys`	


(
(
ryc@s(eZdZd
dd�Zdd�Zddd�Zd	S)rSFc	CsP||_||_||_d|_d|_d|_y|�|�Wnttfk
rJYnXdS)NFr)	r*rT�sign�
exp_format�large_exponent�max_str_len�
fillFormat�	TypeError�NotImplementedError)r�rRr*rTr�rrr�__init__[szFloatFormat.__init__c		s�ddlm}|jdd���t|�t|�B}t|d�|@}t|�|��}t|�dkr^d}d}nBt	�
|�}t�
|�}|dkr�d�_�j
s�|d	ks�||d
kr�d�_WdQRX�j�rd|ko�dknp�|dk�_d
�j�_�jr�jd7_�j�rd�nd��d�j�jf�n�d�jf�t|��rLt��fdd�|D��}nd}t�j|�}ttt|���|d�_|�|��r�t�jtt�tt�d��_�j�r�d�nd��d�j|f�d�jf�_��_dS)Nr
)r4�ignore)rgrgg�חATg-C��6?g@�@g>��N}a+g}Ô%�I�Trz%+�%z%d.%dez%%.%dfcsg|]}t|�j���qSr)�_digitsr*)r7r)rJr�rrr:�sz*FloatFormat.fillFormat.<locals>.<listcomp>r5z%#+z%#z%d.%dfz%%%ds)r<r4�errstaterrrr�compressr>rr�r
r�rTr�r*r�r�r�r@rZr\�anyr'r(�special_fmtrJ)	r�rRrCZspecialZvalidZnon_zeroZmax_valZmin_valr*r)rJr�rr�isR

"
zFloatFormat.fillFormatTc	Cs:ddlm}|jdd��vt|�rF|jr8|jdtfS|jtfSnDt|�r�|dkrz|jrl|jdtfS|jtfSn|jdtfSWdQRX|j	|}|j
r�|d}|dks�|dkr�|dd	�d
|d	d�}n\|j�r|dd
k�r6d|dd�|d	d�}n(|�r6|�d
�}|dt
|�t
|�}|S)Nr
)r4r�)Zinvalid�+r�-�������0rw)r<r4r�rr�r�r'rr(rJr�r�r�r>)r�r�strip_zerosrCr�Zexpsign�zrrr�__call__�s0

zFloatFormat.__call__N)F)T)�__name__�
__module__�__qualname__r�r�r�rrrrrSZs
3rScCs6|dkr.||}|�d�}|t|�t|�SdSdS)Nrr�)r�r>)rr*rJr�r�rrrr��s

r�c@seZdZdd�Zdd�ZdS)rQc	Csly<tttt�|���ttt�|����}dt|�d|_Wn*ttfk
rTYnt	k
rfYnXdS)Nr�r3)
r�r>rZrr�r
rJr�r�r�)r�rRr�rrrr��szIntegerFormat.__init__cCs.t|krtkr"nn
|j|Sd|SdS)Nz%s)�_MININT�_MAXINTrJ)r�rrrrr��s
zIntegerFormat.__call__N)r�r�r�r�r�rrrrrQ�s
rQc@seZdZddd�Zdd�ZdS)rUFcCs||_||_dS)N)r*r�)r�r*r�rrrr��szLongFloatFormat.__init__cCs�t|�r |jrdtSdtSnnt|�rR|dkrH|jr>dtSdtSq�dtSn<|dkr�|jrpdt||j�Sdt||j�Snt||j�SdS)Nr�rwrr�)rr�r'rr(rr*)r�rrrrr��s


zLongFloatFormat.__call__N)F)r�r�r�r�r�rrrrrU�s
rUc@seZdZdd�Zdd�ZdS)rWcCst|�|_t|dd�|_dS)NT)r�)rU�real_format�imag_format)r�r*rrrr��s
zLongComplexFormat.__init__cCs$|�|j�}|�|j�}||dS)N�j)r��realr��imag)r�r�rr8rrrr��szLongComplexFormat.__call__N)r�r�r�r�r�rrrrrW�srWc@seZdZdd�Zdd�ZdS)rVcCs(t|j||�|_t|j||dd�|_dS)NT)r�)rSr�r�r�r�)r�rr*rTrrrr�s
zComplexFormat.__init__cCs`|j|jdd�}|j|jdd�}|jjsP|�d�}|ddt|�t|�}n|d}||S)NF)r�r�r�rw)r�r�r�r�r�r�r>)r�rr�r8r�rrrr�
s
zComplexFormat.__call__N)r�r�r�r�r�rrrrrVsrVc@seZdZddd�Zdd�ZdS)rXN�	same_kindcCsJ|dkr(|jjdkr$t|j�d}nd}|dkr4d}||_||_||_dS)N�Mrr�Znaive)r�kindr�timezone�unit�casting)r�rr�r�r�rrrr�szDatetimeFormat.__init__cCsdt||j|j|jd�S)Nz'%s')r�r�r�)rr�r�r�)r�rrrrr�$szDatetimeFormat.__call__)NNr�)r�r�r�r�r�rrrrrXs
rXc@seZdZdd�Zdd�ZdS)rYcCs�|jjdkr�tdg|jd�d}t|jjd�}|�|�}|t||�|��}t|�dkr�tttt	�
|���ttt�
|����}nd}t|�t|�kr�t|d�}dt|�d|_d	�
|�|_dS)
N�mZNaT)rr�i8�r�r3z'NaT')rr�r�	byteorder�viewrr>r�rZrr�r
rJ�rjust�_nat)r�rRZ	nat_valueZ	int_dtypeZint_view�vr�rrrr�+s

zTimedeltaFormat.__init__cCs2|d�d�|�d�kr|jS|j|�d�SdS)Nr
r�)r�r�rJZastype)r�rrrrr�=szTimedeltaFormat.__call__N)r�r�r�r�r�rrrrrY*srYc@seZdZdd�Zdd�ZdS)rpcCs
||_dS)N)rv)r�rvrrrr�FszSubArrayFormat.__init__csJ|jdkr*dd��fdd�|D��dSdd��fdd�|D��dS)Nr
r�z, c3s|]}��|�VqdS)N)rv)r7r9)r�rr�	<genexpr>Ksz*SubArrayFormat.__call__.<locals>.<genexpr>�]c3s|]}��|�VqdS)N)r�)r7r9)r�rrr�Ls)r=�join)r�r�r)r�rr�Is
 zSubArrayFormat.__call__N)r�r�r�r�r�rrrrrpEsrpc@seZdZdd�Zdd�ZdS)rrcCs||_t|�|_dS)N)rur>�
num_fields)r�rurrrr�PszStructureFormat.__init__cCsTd}x(t||j�D]\}}|||�d7}qWd|jkrD|dd�n
|dd�dS)N�(z, r
r�r;�))�ziprur�)r�rr�Zfieldrvrrrr�TszStructureFormat.__call__N)r�r�r�r�r�rrrrrrOsrr)NNNNNNNN)rwr<N)r�)J�__doc__Z
__future__rrr�__all__Z
__docformat__�sysr��version_info�_threadr	�ImportErrorZ
_dummy_threadZthreadZdummy_threadr<rrtZumathrr
rrrrZ
multiarrayrrrrrZfromnumericrr4r�maxsizer�r�Zmaxintrr$r#r%r&r"r'r(r)rrr6rGrLrNrkrnr�r�rMrr�ryrcrSr�rQrUrWrVrXrYrprrrrrr�<module>s~
	 
{#+,

}Cd