HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
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_printoptions�restructuredtextN�)�	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/r0r1r2)	�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)r7)r8r9)r:rrr;�sr���csg|]}t�|��qSr)r7)r8r9)r:rrr;�s)
�r5�ndim�lenr%Zconcatenate�range�min�extend�tuple)r:�_nc�b�lr)r:rr7�s
r7cCs|rdSdSdS)Nz True�Falser)rrrr�_boolFormatter�srHcCs t|�tkrd}nd}|�|�S)z@ Object arrays containing lists should be printed unambiguously z
list({!r})z{!r})�type�list�format)�o�fmtrrr�_object_format�srNcCst|�S)N)�repr)rrrr�repr_format�srPc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)rHrrrr�<lambda>�z!_get_formatdict.<locals>.<lambda>cst��S)N)�
IntegerFormatr)�datarrrQrRcst����S)N)�FloatFormatr)rTr+�suppress_smallrrrQrRcst��S)N)�LongFloatFormatr)r+rrrQrRcst����S)N)�
ComplexFormatr)rTr+rVrrrQscst��S)N)�LongComplexFormatr)r+rrrQrRcst��S)N)�DatetimeFormatr)rTrrrQ	rRcst��S)N)�TimedeltaFormatr)rTrrrQ
rRcSstS)N)rNrrrrrQrRcSstS)N)rPrrrrrQrRcSstS)N)�strrrrrrQ
rR)�bool�int�float�	longfloat�complexfloat�longcomplexfloat�datetime�	timedelta�object�numpystrr\cs�fdd�S)Ncs�S)Nrr)rrrrQrRz3_get_formatdict.<locals>.indirect.<locals>.<lambda>r)rr)rr�indirectsz!_get_formatdict.<locals>.indirectcsg|]}�|dk	r|�qS)Nr)r8�k)r2rrr;sz#_get_formatdict.<locals>.<listcomp>�allZint_kind)r^Z
float_kind)r_r`Zcomplex_kind)rarbZstr_kind)rfr\)�keys)rTr+rVr2�
formatdictrgZfkeys�keyr)rTr2r+rVr�_get_formatdictsB













rmcCsz|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]rdr^r`r_rbrarfrcre)r�fields�names�_get_format_functionr�shape�SubArrayFormat�append�StructureFormatrIrm�
issubclass�_ntZbool_�integerZtimedelta64Zfloatingr`ZcomplexfloatingZ
clongfloatZunicode_Zstring_Z
datetime64Zobject_)rTr+rVr2Zdtype_�format_functions�
field_nameZfield_values�format_functionZdtypeobjrkrrrrp+sD







rp� r=c	Csn|jtkrd}t|�}nd}tt|��}t||||�}	d}
|
dt|�7}
t||	|j||
|t	|�dd�}|S)Nz..., r=r{r<)
�sizer$r7rrrpr?�_formatArrayr>r%)r:�max_line_widthr+rV�	separator�prefixr2�summary_insertrTrz�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�kwargsrl)�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[])r2)r#r&r'r*rq�itemrrnrrpr��reducerr�)r:r~r+rVrr��styler2r�arrrzr�rrrr�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.r6r=rr<z]
�[Nr{r�)�
ValueErrorr?r@r�r�r}�max)r:rzZrankr�r�rZ
edge_itemsr�Z
leading_itemsZtrailing_itemsZsummary_insert1r�r�r9r��seprrrr}s`	


(
(
r}c@s(eZdZd
dd�Zdd�Zddd�Zd	S)rUFc	CsP||_||_||_d|_d|_d|_y|�|�Wnttfk
rJYnXdS)NFr)	r+rV�sign�
exp_format�large_exponent�max_str_len�
fillFormat�	TypeError�NotImplementedError)r�rTr+rVr�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)r5�ignore)rirgg�חATg-C��6?g@�@g>��N}a+g}Ô%�I�Trz%+�%z%d.%dez%%.%dfcsg|]}t|�j���qSr)�_digitsr+)r8r)rKr�rrr;�sz*FloatFormat.fillFormat.<locals>.<listcomp>r6z%#+z%#z%d.%dfz%%%ds)r=r5�errstaterrrr�compressr?r
r�rr�rVr�r+r�r�r�rAr\r^�anyr(r)�special_fmtrK)	r�rTrD�specialZvalidZnon_zeroZmax_valZmin_valr+r)rKr�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)r5r�)�invalid�+r�-�������0r{)r=r5r�rr�r�r(rr)rKr�r�r�r?)r�r�strip_zerosrDr�Zexpsign�zrrr�__call__�s0

zFloatFormat.__call__N)F)T)�__name__�
__module__�__qualname__r�r�r�rrrrrUZs
3rUcCs6|dkr.||}|�d�}|t|�t|�SdSdS)Nrr�)r�r?)rr+rKr�r�rrrr��s

r�c@seZdZdd�Zdd�ZdS)rSc	Csly<tttt�|���ttt�|����}dt|�d|_Wn*ttfk
rTYnt	k
rfYnXdS)Nr�r4)
r�r?r\r
r�rrKr�r�r�)r�rTr�rrrr��szIntegerFormat.__init__cCs.t|krtkr"nn
|j|Sd|SdS)Nz%s)�_MININT�_MAXINTrK)r�rrrrr��s
zIntegerFormat.__call__N)r�r�r�r�r�rrrrrS�s
rSc@seZdZddd�Zdd�ZdS)rWFcCs||_||_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�r{rr�)rr�r(rr)rr+)r�rrrrr��s


zLongFloatFormat.__call__N)F)r�r�r�r�r�rrrrrW�s
rWc@seZdZdd�Zdd�ZdS)rYcCst|�|_t|dd�|_dS)NT)r�)rW�real_format�imag_format)r�r+rrrr��s
zLongComplexFormat.__init__cCs$|�|j�}|�|j�}||dS)N�j)r��realr��imag)r�r�rr9rrrr��szLongComplexFormat.__call__N)r�r�r�r�r�rrrrrY�srYc@seZdZdd�Zdd�ZdS)rXcCs(t|j||�|_t|j||dd�|_dS)NT)r�)rUr�r�r�r�)r�rr+rVrrrr�s
zComplexFormat.__init__cCs`|j|jdd�}|j|jdd�}|jjsP|�d�}|ddt|�t|�}n|d}||S)NF)r�r�r�r{)r�r�r�r�r�r�r?)r�rr�r9r�rrrr�
s
zComplexFormat.__call__N)r�r�r�r�r�rrrrrXsrXc@seZdZddd�Zdd�ZdS)rZN�	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�rrrrrZs
rZc@seZdZdd�Zdd�ZdS)r[cCs�|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�r4z'NaT')rr�r�	byteorder�viewrr?r�r\r
r�rrK�rjust�_nat)r�rTZ	nat_valueZ	int_dtypeZint_view�vr�rrrr�+s

zTimedeltaFormat.__init__cCs2|d�d�|�d�kr|jS|j|�d�SdS)Nrr�)r�r�rK�astype)r�rrrrr�=szTimedeltaFormat.__call__N)r�r�r�r�r�rrrrr[*sr[c@seZdZdd�Zdd�ZdS)rrcCs
||_dS)N)rz)r�rzrrrr�FszSubArrayFormat.__init__csJ|jdkr*dd��fdd�|D��dSdd��fdd�|D��dS)Nrr�z, c3s|]}��|�VqdS)N)rz)r8r:)r�rr�	<genexpr>Ksz*SubArrayFormat.__call__.<locals>.<genexpr>�]c3s|]}��|�VqdS)N)r�)r8r:)r�rrr�Ls)r>�join)r�r�r)r�rr�Is
 zSubArrayFormat.__call__N)r�r�r�r�r�rrrrrrEsrrc@seZdZdd�Zdd�ZdS)rtcCs||_t|�|_dS)N)rxr?�
num_fields)r�rxrrrr�PszStructureFormat.__init__cCsTd}x(t||j�D]\}}|||�d7}qWd|jkrD|dd�n
|dd�dS)N�(z, rr�r<�))�ziprxr�)r�rr��fieldrzrrrr�TszStructureFormat.__call__N)r�r�r�r�r�rrrrrtOsrt)NNNNNNNN)r{r=N)r�)J�__doc__�
__future__rrr�__all__�
__docformat__�sysr��version_info�_threadr
�ImportError�
_dummy_thread�thread�dummy_threadr=rrv�umathr
rrrrr�
multiarrayrrrrrZfromnumericrr5r�maxsizer�r�Zmaxintrr%r$r&r'r#r(r)r*rrr7rHrNrPrmrpr�r�rOrr�r}rerUr�rSrWrYrXrZr[rrrtrrrr�<module>s~
	 
{#+,

}Cd