%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/lib/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/lib/__pycache__/utils.cpython-39.opt-1.pyc

a

z[yc˃�@sXddlZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZddlm
Z
mZmZddlZgd�Zdd�Zdd	�ZGd
d�d�Zdd
�Zdd�Zdd�Zdd�Zd1dd�Zdd�Zdadad2dd�Zd3dd�Zed�d4dd��Z ed�ej!fd d!��Z"iZ#e�$d"ej%�Z&ed�d5d%d&��Z'd'd(�Z(d)d*�Z)d+d,�Z*d-d.�Z+d/d0�Z,dS)6�N)�issubclass_�issubsctype�
issubdtype)�
set_module)�ndarray�ufunc�asarray)rrr�	deprecate�deprecate_with_doc�get_include�info�source�who�lookfor�byte_bounds�	safe_evalcCsVddl}|jdur.tj�tj�|j�dd�}n$ddlm}tj�tj�|j�d�}|S)a�
    Return the directory that contains the NumPy \*.h header files.

    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.

    Notes
    -----
    When using ``distutils``, for example in ``setup.py``::

        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...

    rN�coreZinclude)	�numpyZshow_config�os�path�join�dirname�__file__�
numpy.corer)r�dr�r�5/usr/lib64/python3.9/site-packages/numpy/lib/utils.pyrs
rcCs
||_|S�N)�__name__)�func�namerrr�_set_function_name0sr!c@s"eZdZdZddd�Zdd�ZdS)�
_Deprecatez�
    Decorator class to deprecate old functions.

    Refer to `deprecate` for details.

    See Also
    --------
    deprecate

    NcCs||_||_||_dSr)�old_name�new_name�message)�selfr#r$r%rrr�__init__Asz_Deprecate.__init__csz|j}|j}|j}|dur>z
�j}Wnty<�j}Yn0|durPd|�nd||f�|durp�d|7���fdd�}t||�}�j}|dur��}n�|���d�}	t	|	dd��}
|	d�
�r�|
d	|}nRt|	d�d}|	dd�D](}t|�|
k�r�q|t|�d7}q�||d�}t�
�d	|
��d
��|g�}||_z
�j}
Wnt�yhYn0|j�|
�|S)z:
        Decorator call.  Refer to ``decorate``.

        Nz`%s` is deprecated!z%`%s` is deprecated, use `%s` instead!�
cstj�tdd��|i|��S)z1`arrayrange` is deprecated, use `arange` instead!�)�
stacklevel)�warnings�warn�DeprecationWarning)�args�kwds�Zdepdocrrr�newfunc]sz$_Deprecate.__call__.<locals>.newfunc�r� z

)r#r$r%r�AttributeErrorr!�__doc__�
expandtabs�split�_get_indent�lstrip�len�textwrap�indentr�__dict__�update)r&rr.�kwargsr#r$r%r1�doc�linesr<�skip�linerrr0r�__call__FsN

�

z_Deprecate.__call__)NNN)r�
__module__�__qualname__r5r'rDrrrrr"5s
r"cCsDtj}|D]&}t|���}|r
t|t|�|�}q
|tjkr@d}|S)zU
    Determines the leading whitespace that could be removed from all the lines.
    r)�sys�maxsizer:r9�min)rAr<rCZcontentrrrr8�s
r8cOs<|r*|d}|dd�}t|i|��|�St|i|��SdS)a�
    Issues a DeprecationWarning, adds warning to `old_name`'s
    docstring, rebinds ``old_name.__name__`` and returns the new
    function object.

    This function may also be used as a decorator.

    Parameters
    ----------
    func : function
        The function to be deprecated.
    old_name : str, optional
        The name of the function to be deprecated. Default is None, in
        which case the name of `func` is used.
    new_name : str, optional
        The new name for the function. Default is None, in which case the
        deprecation message is that `old_name` is deprecated. If given, the
        deprecation message is that `old_name` is deprecated and `new_name`
        should be used instead.
    message : str, optional
        Additional explanation of the deprecation.  Displayed in the
        docstring after the warning.

    Returns
    -------
    old_func : function
        The deprecated function.

    Examples
    --------
    Note that ``olduint`` returns a value after printing Deprecation
    Warning:

    >>> olduint = np.deprecate(np.uint)
    DeprecationWarning: `uint64` is deprecated! # may vary
    >>> olduint(6)
    6

    rr2N�r")r.r?�fnrrrr	�s
,r	cCs
t|d�S)a�
    Deprecates a function and includes the deprecation in its docstring.

    This function is used as a decorator. It returns an object that can be
    used to issue a DeprecationWarning, by passing the to-be decorated
    function as argument, this adds warning to the to-be decorated function's
    docstring and returns the new function object.

    See Also
    --------
    deprecate : Decorate a function such that it issues a `DeprecationWarning`

    Parameters
    ----------
    msg : str
        Additional explanation of the deprecation. Displayed in the
        docstring after the warning.

    Returns
    -------
    obj : object

    )r%rJ)�msgrrrr
�sr
c
Cs�|j}|dd}|d}|d}t|�jj}|}}|durN||j|7}nFt||�D]2\}}	|	dkrz||d|	7}qX||d|	7}qX||7}||fS)a#
    Returns pointers to the end-points of an array.

    Parameters
    ----------
    a : ndarray
        Input array. It must conform to the Python-side of the array
        interface.

    Returns
    -------
    (low, high) : tuple of 2 integers
        The first integer is the first byte of the array, the second
        integer is just past the last byte of the array.  If `a` is not
        contiguous it will not use every byte between the (`low`, `high`)
        values.

    Examples
    --------
    >>> I = np.eye(2, dtype='f'); I.dtype
    dtype('float32')
    >>> low, high = np.byte_bounds(I)
    >>> high - low == I.size*I.itemsize
    True
    >>> I = np.eye(2); I.dtype
    dtype('float64')
    >>> low, high = np.byte_bounds(I)
    >>> high - low == I.size*I.itemsize
    True

    �datar�strides�shapeNr2)Z__array_interface__r�dtype�itemsize�size�zip)
�aZaiZa_dataZastridesZashapeZbytes_aZa_lowZa_highrOZstriderrrr�s rc
Cs$|durt��j}|j}g}i}|��D]�}t||t�r(||}t|�}||��vrl|d||}d}n|||<|}d}d�t	t
|j��}	t
|j�}
|�
||	|
|jj|g�q(d}d}d}
d}|D]t}|t|d�kr�t|d�}|t|d�k�rt|d�}|
t|d�k�r"t|d�}
|dr�|t|d�7}q�t|�dk�r�td|�}td|�}td|
�}d	|d
|d
|d
f}t|ddt|�d
d�|D]l}td|dd
|t|d�d|dd
|t|d�d
|dd
|t|d�d
|df��q�td|�dS)a%
    Print the NumPy arrays in the given dictionary.

    If there is no dictionary passed in or `vardict` is None then returns
    NumPy arrays in the globals() dictionary (all NumPy arrays in the
    namespace).

    Parameters
    ----------
    vardict : dict, optional
        A dictionary possibly containing ndarrays.  Default is globals().

    Returns
    -------
    out : None
        Returns 'None'.

    Notes
    -----
    Prints out the name, shape, bytes and type of all of the ndarrays
    present in `vardict`.

    Examples
    --------
    >>> a = np.arange(10)
    >>> b = np.ones(20)
    >>> np.who()
    Name            Shape            Bytes            Type
    ===========================================================
    a               10               80               int64
    b               20               160              float64
    Upper bound on total bytes  =       240

    >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str',
    ... 'idx':5}
    >>> np.who(d)
    Name            Shape            Bytes            Type
    ===========================================================
    x               2                16               float64
    y               3                24               float64
    Upper bound on total bytes  =       40

    Nz (%s)rr2z x r)��
zName %s Shape %s Bytes %s Typer3r(�=�z%s %s %s %s %s %s %s�z'
Upper bound on total bytes  =       %d)rG�	_getframe�f_back�	f_globals�keys�
isinstancer�idr�map�strrO�nbytes�appendrPr r:�int�max�print)Zvardict�frameZsta�cacher �varZidv�namestr�originalZshapestrZbytestrZmaxnameZmaxshapeZmaxbyteZ
totalbytes�valZsp1Zsp2Zsp3Zprvalrrrrs^,

�


  �rc
Cs�t|�}|}|}d}|�|�}|D]h}||kr4d}	n|}	|t|�t|	�}||kr~|dt|�}|dd|d|}q"||	|}q"|S)Nz, �r2z,
r3r))r:r7)
r �	arguments�widthZ
firstwidth�kZnewstrZsepstrZarglist�argumentZaddstrrrr�_split_line�s
rrrcCs�t|t�t�g�}|j|ji}|jg}|jg}t|�dkr<q�|�d�}|��D]L}t||t	j
�rN||j}||vrN||j}|�|�|�|�|||<qNq.||fS)Nr)�
__import__�globals�localsrr=r:�popr]r^�types�
ModuleTyperc)�moduleZthedictZdictlistZ
totraverseZthisdict�x�modnameZmoddictrrr�
_makenamedict�s 




r|c
Cs�d}d}dd�}t|dt|��}t|d|�}|j}|jj}|durHtj}td||d�td	|j|d�td
||d�td|j	|d�td||j
j�|d�td
||j
j�|d�td|j
j
|d�tdt|jjj�|f|d�tdd|d�|dv�rtd|tj|f|d�d}	nH|dk�r@td||f|d�tjdk}	ntd||f|d�tjdk}	td||	�|d�td|j|d�dS)aOProvide information about ndarray obj.

    Parameters
    ----------
    obj : ndarray
        Must be ndarray, not checked.
    output
        Where printed output goes.

    Notes
    -----
    Copied over from the numarray module prior to its removal.
    Adapted somewhat as only numpy is an option now.

    Called by info.

    rmcSs|Srr)rzrrr�<lambda>��z_info.<locals>.<lambda>�	__class__rNzclass: ��filezshape: z	strides: z
itemsize: z	aligned: zcontiguous: z	fortran: zdata pointer: %s%szbyteorder: r3)�endr�)�|rWz%s%s%sF�>z%sbig%s�bigz
%slittle%s�littlez
byteswap: ztype: %s)�getattr�typerNrP�	byteorderrG�stdoutrfrOrQ�flagsZaligned�
contiguousZfortran�hexZctypesZ_as_parameter_�value)
�obj�outputZextraZticZbp�clsZnmrNZendianZbyteswaprrr�_info�s>�


r��Lc	CsXddl}ddl}t|d�s$t|d�r,|j}nt|d�r<|j}|durJtj}|dur^tt��n�t|t	�rxt
||d��n�t|t��r\tdur�t
|�\aad}g}tD]�}zlt||}	t|	�|vr�td||d�n6|�t|	��td	||d�t|	�td
||d�|d7}Wq�t�y(Yq�0q�|dk�rHtd||d�ntd
||d��n�|�|��st|�|��r�|j}
zt|�|��}Wnt�y�d}Yn0t|
|�|k�r�t|
||�}n|
|}td|d|d�t|�|�|d��n\|�|��r6|j}
zt|�|��}Wnt�y4d}Yn0t|
|�|k�rVt|
||�}n|
|}td|d|d�|�|�}
|
du�r�t|d��r�t|�|j�|d�nt|�|�|d�|�|�}dd�|D�}|�rTtd|d�|D]J}t||d�}|du�r|�|�|��pd�\}}td||f|d��q�nt|d��rTt|�|�|d�dS)a�
    Get help information for a function, class, or module.

    Parameters
    ----------
    object : object or str, optional
        Input object or name to get information about. If `object` is a
        numpy object, its docstring is given. If it is a string, available
        modules are searched for matching objects.  If None, information
        about `info` itself is returned.
    maxwidth : int, optional
        Printing width.
    output : file like object, optional
        File like object that the output is written to, default is
        ``None``, in which case ``sys.stdout`` will be used.
        The object has to be opened in 'w' or 'a' mode.
    toplevel : str, optional
        Start search at this level.

    See Also
    --------
    source, lookfor

    Notes
    -----
    When used interactively with an object, ``np.info(obj)`` is equivalent
    to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython
    prompt.

    Examples
    --------
    >>> np.info(np.polyval) # doctest: +SKIP
       polyval(p, x)
         Evaluate the polynomial p at x.
         ...

    When using a string for `object` it is possible to get multiple results.

    >>> np.info('fft') # doctest: +SKIP
         *** Found in numpy ***
    Core FFT routines
    ...
         *** Found in numpy.fft ***
     fft(a, n=None, axis=-1)
    ...
         *** Repeat reference found in numpy.fft.fftpack ***
         *** Total of 3 references found. ***

    rNZ_ppimport_importer�_ppimport_module�_ppimport_attr)r�z+
     *** Repeat reference found in %s *** r�z     *** Found in %s ***�-r2zHelp for %s not found.z+
     *** Total of %d references found. ***z()r3r(r'cSsg|]}|ddkr|�qS)r�_r)�.0�methrrr�
<listcomp>lr~zinfo.<locals>.<listcomp>z

Methods:
�Nonez  %s  --  %sr5) �pydoc�inspect�hasattrr�r�rGr�rr^rr�ra�	_namedictr|�	_dictlistr_rfrc�KeyErrorZ
isfunctionZismethodrZ	signature�	Exceptionr:rr�getdoc�isclassr'Z
allmethodsr�Zsplitdoc)�objectZmaxwidthr�Ztoplevelr�r�ZnumfoundZobjlistrjr�r rnZargstrZdoc1�methodsZpublic_methodsr�ZthisobjZmethstr�otherrrrr�s�5
�

��
��






�rcCsXddl}z,td|�|�|d�t|�|�|d�WntyRtd|d�Yn0dS)a�
    Print or write to a file the source code for a NumPy object.

    The source code is only returned for objects written in Python. Many
    functions and classes are defined in C and will therefore not return
    useful information.

    Parameters
    ----------
    object : numpy object
        Input object. This can be any object (function, class, module,
        ...).
    output : file object, optional
        If `output` not supplied then source code is printed to screen
        (sys.stdout).  File object must be created with either write 'w' or
        append 'a' modes.

    See Also
    --------
    lookfor, info

    Examples
    --------
    >>> np.source(np.interp)                        #doctest: +SKIP
    In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py
    def interp(x, xp, fp, left=None, right=None):
        """.... (full docstring printed)"""
        if isinstance(x, (float, int, number)):
            return compiled_interp([x], xp, fp, left, right).item()
        else:
            return compiled_interp(x, xp, fp, left, right)

    The source code is only returned for objects written in Python.

    >>> np.source(np.array)                         #doctest: +SKIP
    Not available for this object.

    rNzIn file: %s
r�zNot available for this object.)r�rfZ
getsourcefileZ	getsourcer�)r�r�r�rrrr
{s)r
z[a-z0-9_]+\(.*[,=].*\)TFc	s�ddl}t|||��g}t|�������s0dS���D]@\}\}}	}
|	dvrPq8|���t�fdd��D��r8|�|�q8ddddd����fd	d
����fdd�}|j|d
�dd�	��}|dt
|�g}
|ddd�D]~}�|\�}	}dd�����d�D�}z(|d��}t�
|��r,|d��}Wnt�yFd}Yn0|
�d||f�q�|�sl|
�d�|du�r�|�d�	|
��n4t
|
�dk�r�|��}|d�	|
��ntd�	|
��dS)a�
    Do a keyword search on docstrings.

    A list of objects that matched the search is displayed,
    sorted by relevance. All given keywords need to be found in the
    docstring for it to be returned as a result, but the order does
    not matter.

    Parameters
    ----------
    what : str
        String containing words to look for.
    module : str or list, optional
        Name of module(s) whose docstrings to go through.
    import_modules : bool, optional
        Whether to import sub-modules in packages. Default is True.
    regenerate : bool, optional
        Whether to re-generate the docstring cache. Default is False.
    output : file-like, optional
        File-like object to write the output to. If omitted, use a pager.

    See Also
    --------
    source, info

    Notes
    -----
    Relevance is determined only roughly, by checking if the keywords occur
    in the function name, at the start of a docstring, etc.

    Examples
    --------
    >>> np.lookfor('binary representation') # doctest: +SKIP
    Search results for 'binary representation'
    ------------------------------------------
    numpy.binary_repr
        Return the binary representation of the input number as a string.
    numpy.core.setup_common.long_double_representation
        Given a binary dump as given by GNU od -b, look for long double
    numpy.base_repr
        Return a string representation of a number in the given base system.
    ...

    rN)ryr�c3s|]}|�vVqdSrr�r��w)r@rr�	<genexpr>�r~zlookfor.<locals>.<genexpr>i�����)r�classryr�cs�d}d�|�����d�dd���|t�fdd��D��7}|t�fdd��D��7}|t��d7}|��|d�7}|��d	�d
7}|t|dd�7}|S)
Nrr(rYcsg|]}|�vrd�qS)��rr�)�	first_docrrr�r~z.lookfor.<locals>.relevance.<locals>.<listcomp>csg|]}|�vrd�qS)�rr�)r rrr�r~rXr��.rV�di����)	r�lower�stripr7�sumr:�get�countre)r Zdocstr�kind�index�r)�kind_relevance�whats)r�r r�	relevances zlookfor.<locals>.relevancecs�|g�|�R�Srr)rT)rhr�rr�relevance_valuesz lookfor.<locals>.relevance_value)�keyzSearch results for '%s'r3r����cSsg|]}|��r|���qSr)r�)r�rCrrrr�s�zlookfor.<locals>.<listcomp>r(r2rmz	%s
    %szNothing found.rV)r��_lookfor_generate_cacherar�r7�items�allrc�sortrr:r��_function_signature_re�search�
IndexError�writeZgetpagerrf)Zwhatry�import_modules�
regenerater�r��foundr Z	docstringr�r�r��s�	help_textZixZdoclinesr�Zpagerr)rhr@r�r�r�rr�sL/�


rc
Cs�ddl}ddlm}|dur d}t|t�rZzt|�WntyLiYS0tj|}n8t|t	�snt|t
�r�i}|D]}|�t|||��qv|St
|�tvr�|s�tt
|�Si}|tt
|�<i}d}|j|fg}	|	�r�|	�d�\}
}t
|�|vr�q�d|t
|�<|d7}d}|�|��r:d}z
|j}
Wnt�y>d}
Yn0|�r`t|d	��r`|jD�]}t�|�D]�}tj�||�}tj�||d
�}tj�|��r�|�d��r�|dd�}ntj�|��rh|}n�qh|d
k�rؐqhzPtj}tj}z0|�t_|�t_td|
|f�W|t_|t_n|t_|t_0Wn.t�y>�Ynt�yVY�qhYn0�qh�qXt |�D]�\}}z$t!|dd|
|f�}t!|dd�}Wn$t"�y�d|
|f}d}Yn0d|v�r�|�r�d||f}|�#|
d��s�t|t$��rhn�qhn$|�|��s|
du�s||
v�s�qh|	�%d|
|f|f��qhnL|�&|��rvd}t |�D] \}}|	�%d|
|f|f��qRnt|d��r�d}z|�'|�}Wnt"�y�d}Yn0|dur�|||f||
<q�|S)a�
    Generate docstring cache for given module.

    Parameters
    ----------
    module : str, None, module
        Module for which to generate docstring cache
    import_modules : bool
        Whether to import sub-modules in packages.
    regenerate : bool
        Re-generate the docstring cache

    Returns
    -------
    cache : dict {obj_full_name: (docstring, kind, index), ...}
        Docstring cache for the module, either cached one (regenerate=False)
        or newly generated.

    rN)�StringIOrTr2r�ry�__path__z__init__.pyz.py���r'z%s.%srrEr�r�rDr)(r��ior�r^rars�ImportErrorrG�modules�list�tupler>r�r_�_lookfor_cachesrrvZismodule�__all__r4r�r�r�listdirrr�isfile�endswithr��stderr�KeyboardInterrupt�
BaseException�_getmembersr��	NameError�
startswithrrcr�r�)ryr�r�r�r�rh�mod�seenr��stackr �itemr�Z_allZpthZmod_pathZthis_pyZinit_pyZ	to_importZ
old_stdoutZ
old_stderr�n�vZ	item_name�mod_namer@rrrr�2s�


�

�
�
 
r�csDddl}z|���}Wn(ty>�fdd�t��D�}Yn0|S)Nrcs$g|]}t�|�r|t�|�f�qSr)r�r�)r�rz�r�rrr��s
�z_getmembers.<locals>.<listcomp>)r�Z
getmembersr��dir)r�r��membersrr�rr��sr�cCsddl}|�|�S)au
    Protected string evaluation.

    Evaluate a string containing a Python literal expression without
    allowing the execution of arbitrary non-literal code.

    .. warning::

        This function is identical to :py:meth:`ast.literal_eval` and
        has the same security implications.  It may not always be safe
        to evaluate large input strings.

    Parameters
    ----------
    source : str
        The string to evaluate.

    Returns
    -------
    obj : object
       The result of evaluating `source`.

    Raises
    ------
    SyntaxError
        If the code has invalid Python syntax, or if it contains
        non-literal code.

    Examples
    --------
    >>> np.safe_eval('1')
    1
    >>> np.safe_eval('[1, 2, 3]')
    [1, 2, 3]
    >>> np.safe_eval('{"foo": ("bar", 10.0)}')
    {'foo': ('bar', 10.0)}

    >>> np.safe_eval('import os')
    Traceback (most recent call last):
      ...
    SyntaxError: invalid syntax

    >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()')
    Traceback (most recent call last):
      ...
    ValueError: malformed node or string: <_ast.Call object at 0x...>

    rN)�astZliteral_eval)r
r�rrrr�s2rcCsr|jdkr|St�|jd|d��}tj�|�r8|�d�}t�|���dkrnt	|tj
�rd|j�tj
�Stj
||<|S)a{
    Utility function to check median result from data for NaN values at the end
    and return NaN in that case. Input result can also be a MaskedArray.

    Parameters
    ----------
    data : array
        Sorted input data to median function
    result : Array or MaskedArray
        Result of median function.
    axis : int
        Axis along which the median was computed.

    Returns
    -------
    result : scalar or ndarray
        Median or NaN in axes which contained NaN in the input.  If the input
        was an array, NaN will be inserted in-place.  If a scalar, either the
        input itself or a scalar NaN.
    rr�)�axisF)rR�npZisnanZtakeZmaZ
isMaskedArrayZfilledZ
count_nonzeroZravelr^ZgenericrPr��nan)rM�resultr�r�rrr�_median_nancheck�s


r�cCsrddlm}m}m}t|�dkr0t|�dkr0dSd�|�}|D].}||r\|d|�d�7}q>|d|�d�7}q>|S)a�
    Returns a string contains the supported CPU features by the current build.

    The string format can be explained as follows:
        - dispatched features that are supported by the running machine
          end with `*`.
        - dispatched features that are "not" supported by the running machine
          end with `?`.
        - remained features are representing the baseline.
    r)�__cpu_features__�__cpu_baseline__�__cpu_dispatch__rmr3�*�?)Znumpy.core._multiarray_umathr�r�r�r:r)r�r�r�Zenabled_featuresZfeaturerrr�	_opt_info!s
r�)N)r)N)Nr�Nr)NTFN)-rrGr;rw�rer+Znumpy.core.numerictypesrrrZnumpy.core.overridesrrrrrrr�r�rr!r"r8r	r
rrrrr�r�r|r�rr�r
r��compile�Ir�rr�r�rr�r�rrrr�<module>sPL59
g

63�{
6$

Zerion Mini Shell 1.0