
    Ǆg[                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
mZ d dlZg dZ ed      d        Z ed      d        Z G d d	      Zd
 Zd Zd Zd ZdadaddZddZ ed      dd       Zd Zd Zd Zd Zy)    N)ndarray)
set_module)get_includeinfoshow_runtimenumpyc                     ddl m} m}m} ddlm} t
        j                  t        j                  t        j                         dg}g g }}|D ]*  }| |   r|j                  |       |j                  |       , |j                  d|||di       	 ddlm} |j                   |               ||       y	# t        $ r t!        d       Y w xY w)
a(  
    Print information about various resources in the system
    including available intrinsic support and BLAS/LAPACK library
    in use

    .. versionadded:: 1.24.0

    See Also
    --------
    show_config : Show libraries in the system on which NumPy was built.

    Notes
    -----
    1. Information is derived with the help of `threadpoolctl <https://pypi.org/project/threadpoolctl/>`_
       library if available.
    2. SIMD related information is derived from ``__cpu_features__``,
       ``__cpu_baseline__`` and ``__cpu_dispatch__``

    r   __cpu_features____cpu_baseline____cpu_dispatch__)pprint)numpy_versionpythonunamesimd_extensions)baselinefound	not_found)threadpool_infozWARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build informationN)numpy._core._multiarray_umathr   r   r   r   np__version__sysversionplatformr   appendthreadpoolctlr   extendImportErrorprint)	r   r   r   r   config_foundfeatures_foundfeatures_not_foundfeaturer   s	            ]/home/mcse/projects/flask_80/flask-venv/lib/python3.12/site-packages/numpy/lib/_utils_impl.pyr   r      s    *  ++!
 L
 *,R&N# /G$!!'*%%g.	/
 (#+
 61O-. <  6 5 	66s   B6 6CCc                  T   ddl } | j                  Jt        j                  j	                  t        j                  j                  | j                        dd      }|S ddlm} t        j                  j	                  t        j                  j                  |j                        d      }|S )aX  
    Return the directory that contains the NumPy \*.h header files.

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

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

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

    Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using
    that is likely preferred for build systems other than ``setuptools``::

        $ numpy-config --cflags
        -I/path/to/site-packages/numpy/_core/include

        # Or rely on pkg-config:
        $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir)
        $ pkg-config --cflags
        -I/path/to/site-packages/numpy/_core/include

    r   N_coreinclude)	r   show_configospathjoindirname__file__numpy._corer(   )r   dr(   s      r&   r   r   I   sp    <  GGLL8'9M
 H 	$GGLL8)DH    c                       e Zd ZdZddZd Zy)
_Deprecatez
    Decorator class to deprecate old functions.

    Refer to `deprecate` for details.

    See Also
    --------
    deprecate

    Nc                 .    || _         || _        || _        y N)old_namenew_namemessage)selfr7   r8   r9   s       r&   __init__z_Deprecate.__init__~   s      r2   c                    | j                   }| j                  }| j                  }|j                  }|d|z  n	d|d|d|d|z   z  t	        j
                        fd       }||_        j                  }|}n|j                         j                  d      }	t        |	dd       }
|	d	   j                         r	|
d
z  |z   }nAt        |	d	         dz   }|	dd D ]#  }t        |      |
kD  r n|t        |      dz   z  }% ||d }t        j                  d
|
z        dj                  |g      }||_        |S )z:
        Decorator call.  Refer to ``decorate``.

        Nz`%s` is deprecated!`z` is deprecated, use `z
` instead!
c                  L    t        j                  t        d        | i |S )N   
stacklevel)warningswarnDeprecationWarning)argskwdsdepdocfuncs     r&   newfuncz$_Deprecate.__call__.<locals>.newfunc   s$    MM&"4C&&&r2      r    z

)r7   r8   r9   __name__	functoolswraps__doc__
expandtabssplit_get_indentlstriplentextwrapindentr-   )r:   rI   rF   kwargsr7   r8   r9   rJ   doclinesrW   skiplinerH   s    `           @r&   __call__z_Deprecate.__call__   sn   
 ====,,}}H*X5F  *F dWn$F			' 
	' $ll;CNN$**40E qr+FQx  slS( 58}q(!!"I *D4y6)CIM)D* $%j__VS6\:F++vsm,Cr2   )NNN)rM   
__module____qualname__rP   r;   r]    r2   r&   r4   r4   r   s    	
0r2   r4   c                     t         j                  }| D ]6  }t        |j                               }|st	        |t        |      |z
        }8 |t         j                  k(  rd}|S )zU
    Determines the leading whitespace that could be removed from all the lines.
    r   )r   maxsizerU   rT   min)rZ   rW   r\   contents       r&   rS   rS      s\     [[F 6dkkm$TW!45F6 Mr2   c                      t        j                  dt        d       | r| d   }| dd }  t        | i ||      S t        | i |S )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.

    .. deprecated:: 2.0
        Use `~warnings.warn` with :exc:`DeprecationWarning` instead.

    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.lib.utils.deprecate(np.uint)
    DeprecationWarning: `uint64` is deprecated! # may vary
    >>> olduint(6)
    6

    b`deprecate` is deprecated, use `warn` with `DeprecationWarning` instead. (deprecated in NumPy 2.0)r@   rA   r   rK   NrC   rD   rE   r4   )rF   rX   fns      r&   	deprecateri      s^    ` MM	$ 	 !WABx*z4*6*2..4*6**r2   c                 R    t        j                  dt        d       t        |       S )a   
    Deprecates a function and includes the deprecation in its docstring.

    .. deprecated:: 2.0
        Use `~warnings.warn` with :exc:`DeprecationWarning` instead.

    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
                :exc:`DeprecationWarning`

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

    Returns
    -------
    obj : object

    rf   r@   rA   )r9   rg   )msgs    r&   deprecate_with_docrl     s*    < MM	$ 	 c""r2   c                     t        |       }|}| }d}|j                  |      }|D ]V  }||k(  rd}	n|}	|t        |      z   t        |	      z   }||kD  r#|dz   t        |      z   }|dz   d|dz   z  z   |z   }O||	z   |z   }X |S )Nz,  rK   z,
rL   r@   )rU   rR   )
name	argumentswidth
firstwidthknewstrsepstrarglistargumentaddstrs
             r&   _split_linery   7  s    TJAFFoof%G 
0
?FFHF+u9QX.Ae^c:a<&888CFf_x/F
0 Mr2   c                    t        | t               t               g       } | j                  | j                  i}| j                  g}| j                  g}	 t        |      dk(  r	 ||fS |j                  d      }|j                         D ]j  }t        ||   t        j                        s!||   j                  }||vs5||   j                  }|j                  |       |j                  |       |||<   l )Nr   )
__import__globalslocalsrM   __dict__rU   popkeys
isinstancetypes
ModuleTyper   )modulethedictdictlist
totraversethisdictxmodnamemoddicts           r&   _makenamedictr   O  s    	68R8Fv/G H//"J
z?a H >>!$ 	/A(1+u'7'78"1+..(*&qk22GOOG,%%g.'.GG$	/	 r2   c                    d}d}d }t        | dt        |             }t        |d|      }| j                  }| j                  j                  }|t
        j                  }t        d||       t        d| j                  |       t        d	||       t        d
| j                  |       t        d || j                  j                        |       t        d || j                  j                        |       t        d| j                  j                  |       t        dt        | j                  j                   j"                        ||       t        dd|       |dv r$t        |t
        j                  ||       d}	nP|dk(  r&t        |d||       t
        j                  dk7  }	n%t        |d||       t
        j                  dk7  }	t        d ||	      |       t        d| j                  z  |       y)aO  Provide 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.

    rn   c                     | S r6   r`   )r   s    r&   <lambda>z_info.<locals>.<lambda>w  s    1 r2   	__class__rM   Nzclass: filezshape: z	strides: z
itemsize: z	aligned: zcontiguous: z	fortran: zdata pointer: zbyteorder: rL   )endr   )|=F>biglittlez
byteswap: ztype: %s)getattrtypestridesdtype	byteorderr   stdoutr!   shapeitemsizeflagsaligned
contiguousfortranhexctypes_as_parameter_value)
objoutputextraticbpclsnmr   endianbyteswaps
             r&   _infor   c  s   $ E
C	B
#{DI
.C	j#	&BkkGYY  F~	)Rf%	)SYYV,	+wV,	,62	+r#))++,6:	."SYY112@	+syy((v6	 #CJJ$=$=$C$C DeL
 
-Sv.#s}}c2@	33$62==E)c3'f5==H,	,862	*syy
 v.r2   c                 f   ddl }ddl}t        | d      st        | d      r| j                  } nt        | d      r| j                  } |t
        j                  }| t        t               yt        | t              rt        | |       yt        | t              rt        t        |      \  aad}g }t        D ]w  }	 t        |   |    }	t        |	      |v rt!        d|z  |       nE|j#                  t        |	             t!        d	|z  |       t        |	       t!        d
|z  |       |dz  }y |dk(  rt!        d| z  |       yt!        d|z  |       y|j'                  |       s|j)                  |       r{| j*                  }
	 t        |j-                  |             }t1        |
|z         |kD  rt3        |
||      }n|
|z   }t!        d|z   dz   |       t!        |j5                  |       |       y|j7                  |       rJ| j*                  }
	 t        |j-                  |             }t1        |
|z         |kD  rt3        |
||      }n|
|z   }t!        d|z   dz   |       |j5                  |       }|3t        | d      rCt!        |j5                  | j8                        |       nt!        |j5                  |       |       |j;                  |       }|D cg c]  }|d   dk7  s| }}|r^t!        d|       |D ]K  }t=        | |d      }|'|j?                  |j5                  |      xs d      \  }}t!        d|d|       M yyt        | d      rt!        |j5                  |       |       yy# t$        $ r Y w xY w# t.        $ r d}Y w xY w# t.        $ r d}Y }w xY wc c}w )a  
    Get help information for an array, function, class, or module.

    Parameters
    ----------
    object : object or str, optional
        Input object or name to get information about. If `object` is
        an `ndarray` instance, information about the array is printed.
        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.

    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. ***

    When the argument is an array, information about the array is printed.

    >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64)
    >>> np.info(a)
    class:  ndarray
    shape:  (2, 3)
    strides:  (24, 8)
    itemsize:  8
    aligned:  True
    contiguous:  True
    fortran:  False
    data pointer: 0x562b6e0d2860  # may vary
    byteorder:  little
    byteswap:  False
    type: complex64

    r   N_ppimport_importer_ppimport_module_ppimport_attr)r   z+
     *** Repeat reference found in %s *** r   z     *** Found in %s ***-rK   zHelp for %s not found.z+
     *** Total of %d references found. ***z()rL   r>   r;   _z

Methods:
Nonez  z  --  rP   ) pydocinspecthasattrr   r   r   r   r   r   r   r   str	_namedictr   	_dictlistidr!   r   KeyError
isfunctionismethodrM   	signature	ExceptionrU   ry   getdocisclassr;   
allmethodsr   splitdoc)objectmaxwidthr   toplevelr   r   numfoundobjlistnamestrr   ro   rp   argstrdoc1methodsmethpublic_methodsthisobjmethstrothers                       r&   r   r     s   D ,-6-.((	)	*&&~~T
	FG	$fV$	FC	 #0#: Iy  	G(0c7g% BDKL%
 NN2c7+4w>VLI#h,V4A	  q=*V3&A :<DE
 
		F	#w'7'7'?	G--f56I tI~) y(;FI%FcFlT!/gnnV$62		 	G--f56I tI~) y(;FI%FcFlT!/~~f%<vz*gnnV__5FC'..(v6""6*+2E4d1gn$EE"0& E!&$5&%*^^#NN73=v&NGU g6VDE  
	#gnnV$62 
$u    	I	  	I	$ FsC   :A4M:N
 N N.)N.:	NN
NNN+*N+c                 d    t        j                  dt        d       ddl}|j	                  |       S )a  
    Protected string evaluation.

    .. deprecated:: 2.0
        Use `ast.literal_eval` instead.

    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...>

    z`safe_eval` is deprecated. Use `ast.literal_eval` instead. Be aware of security implications, such as memory exhaustion based attacks (deprecated in NumPy 2.0)r@   rA   r   N)rC   rD   rE   astliteral_eval)sourcer   s     r&   	safe_evalr   <  s4    l MM	2 	 F##r2   c                 d   | j                   dk(  r|S | j                  d|      }t        j                  |      }t        j                  j                  |      r|j                  d      }|j                         s|S t        |t        j                        r|S t        j                  |||       |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.
    r   )axisF)where)sizetaker   isnanmaisMaskedArrayfilledanyr   genericcopyto)dataresultr   potential_nansns        r&   _median_nancheckr     s    * yyA~YYrY-N
 A 
uu1HHUO557 &"**% IIfnA.Mr2   c                      ddl m} m}m} t	        |      dk(  rt	        |      dk(  rydj                  |      }|D ]  }| |   r
|d| dz  }|d| dz  } |S )a  
    Returns a string containing the CPU features supported
    by the current build.

    The format of the string can be explained as follows:
        - Dispatched features supported by the running machine end with `*`.
        - Dispatched features not supported by the running machine
          end with `?`.
        - Remaining features represent the baseline.

    Returns:
        str: A formatted string indicating the supported CPU features.
    r   r
   rn   rL   *?)r   r   r   r   rU   r-   )r   r   r   enabled_featuresr%   s        r&   	_opt_infor     s      !c*:&;q&@xx 01# /G$!G9A.!G9A.	/ r2   c                   | j                   | j                  du}g }g }g }g }| j                   j                         D ]v  \  }}t        |d         }||d   urd}|j	                  |       |j	                  |       |j	                  |d          |j	                  t        |      dk  rdn|d          x |s| S t        ||||| j                        }	t        j                  |	| j                        S | j                  C| j                  \  }
}t        |
      }| j                  ||
u r| S t        j                  ||f      S | j                  | S t        j                  | j                        S )	a  
    Returns the dtype unchanged if it contained no metadata or a copy of the
    dtype if it (or any of its structure dtypes) contained metadata.

    This utility is used by `np.save` and `np.savez` to drop metadata before
    saving.

    .. note::

        Due to its limitation this function may move to a more appropriate
        home or change in the future and is considered semi-public API only.

    .. warning::

        This function does not preserve more strange things like record dtypes
        and user dtypes may simply return the wrong thing.  If you need to be
        sure about the latter, check the result with:
        ``np.can_cast(new_dtype, dtype, casting="no")``.

    Nr   TrK      r@   )namesformatsoffsetstitlesr   )align)fieldsmetadataitemsdrop_metadatar   rU   dictr   r   r   isalignedstructsubdtyper   )r   found_metadatar   r   r   r   ro   fieldfield_dt	structurer  r   new_subdtypes                r&   r   r     sa   * ||t3 <<--/ 	@KD%$U1X.HuQx'!%LLNN8$NN58$MM#e*q.$eAh?	@ L'&^^%	
 xx	)>)>??		#..%$X.>>!lh&>Lxxu-.. >>!Lxx		""r2   )r   r6   )NL   Nr   )r+   r   rV   r   rerC   rN   r   r0   r   numpy._utilsr   r   r   __all__r   r   r4   rS   ri   rl   ry   r   r   r   r   r   r   r   r   r   r`   r2   r&   <module>r     s    	 
   	     # 
 G2 2j G% %PA AH>+B&#d& 		(3/l G_3 _3D@$F(T<<#r2   