K i[ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z gdZ e ddZe ddZGdd Zd Zd Zd Zd ZdadaddZddZe dddZdZdZdZdZy)N)ndarray) set_module) get_includeinfo show_runtimenumpycddlm}ddlm}m}m}t j tjtjdg}gg}}|D]*}||r|j||j|,|jd|||di|jdt jjjd i dd lm}|j#|||y#t$$rt'd YwxYw) 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 `_ library if available. 2. SIMD related information is derived from ``__cpu_features__``, ``__cpu_baseline__`` and ``__cpu_dispatch__`` r)pprint__cpu_baseline____cpu_dispatch____cpu_features__) numpy_versionpythonunamesimd_extensions)baselinefound not_found&ignore_floating_point_errors_in_matmulN)threadpool_infozWARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information)r numpy._core._multiarray_umathr r rnp __version__sysversionplatformrappend_core_multiarray_umath_blas_supports_fpe threadpoolctlrextend ImportErrorprint) r r r r config_foundfeatures_foundfeatures_not_foundfeaturers [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/lib/_utils_impl.pyrrs* ++!  L *,R&N#/ G $  ! !' *  % %g . / (#+ 0**==dC C 61O-.  < 6 5 66s C11DDcTddl}|jJtjj tjj |j dd}|Sddlm}tjj tjj |j d}|S)a 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 Examples -------- >>> np.get_include() '.../site-packages/numpy/core/include' # may vary rNrinclude) r show_configospathjoindirname__file__ numpy._corer)rdrs r*rrPsqF  GGLL8'9 M H $ GGLL8) D HceZdZdZddZdZy) _Deprecatez Decorator class to deprecate old functions. Refer to `deprecate` for details. See Also -------- deprecate Nc.||_||_||_yN)old_namenew_namemessage)selfr:r;r<s r*__init__z_Deprecate.__init__s     r5ct |j}|j}|j}| j}|d|d n d|d|d | d|zz t j  fd}||_j }| }n|jjd} t| dd} | d jr | d z|z}nAt| d dz} | ddD]#} t| | kDrn| t| dzz } %|| d}tj d | z d |}||_|S) z: Decorator call. Refer to ``decorate``. N`z` is deprecated!z` is deprecated, use `z ` instead! cLtjtd|i|S)N stacklevel)warningswarnDeprecationWarning)argskwdsdepdocfuncs r*newfuncz$_Deprecate.__call__..newfuncs$ MM&"4 C&& &r5r z )r:r;r<__name__ functoolswraps__doc__ expandtabssplit _get_indentlstriplentextwrapindent)r=rLrIkwargsr:r;r<rMdoclinesrZskiplinerKs ` @r*__call__z_Deprecate.__call__sq ====,,  }}H   "23F "8 *MF   dWn $F   '  '$ll ;CNN$**40E qr+FQx slS(58}q(!!"I*D4y6)CIM)D*$%j__VS6\:FHD&Cr5)NNN)rP __module__ __qualname__rSr>r`r5r*r7r7~s  /r5r7ctj}|D]6}t|j}|st |t||z }8|tjk(rd}|S)zU Determines the leading whitespace that could be removed from all the lines. r)rmaxsizerXrWmin)r]rZr_contents r*rVrVs\[[F6dkkm$ TW!45F6 Mr5ctjdtd|r|d}|dd}t|i||St|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)rCrDrrNNrFrGrHr7)rIr[fns r* deprecaterls^` MM $   !WABx*z4*6*2..4*6**r5cRtjdtdt|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 rirCrD)r<rj)msgs r*deprecate_with_docros*< MM $   c ""r5ct|}|}|}d}|j|}|D]V}||k(rd} n|} |t|zt| z}||kDr#|dzt|z}|dzd|dzzz|z}O|| z|z}X|S)Nz, rNz, rOrC)rXrU) name argumentswidth firstwidthknewstrsepstrarglistargumentaddstrs r* _split_liner|BsTJA F Foof%G 0 ?FF H F + u9QX.Ae^cZ!^&<>!$ /A(1+u'7'78"1+..(*&qk22GOOG,%%g.'.GG$ / r5cd}d}d}t|dt|}t|d|}|j}|jj}|t j }td||td|j|td ||td |j|td ||jj|td ||jj|td |jj|tdt|jj j"||tdd||dvr$t|t j||d} nP|dk(r&t|d||t jdk7} n%t|d||t jdk7} td|| |td|j|y)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. rqc|Sr9rc)rs r*z_info..s1r5 __class__rPNzclass: filezshape: z strides: z itemsize: z aligned: z contiguous: z fortran: zdata pointer: z byteorder: rO)endr)|=F>biglittlez byteswap: ztype: )getattrtypestridesdtype byteorderrstdoutr%shapeitemsizeflagsaligned contiguousfortranhexctypes_as_parameter_value) objoutputextraticbpclsnmrendianbyteswaps r*_inforos$ E C B #{DI .C j# &BkkG YY F ~ )Rf% )SYYV, +wV, , 62 +r#))++,6: ."SYY112@ +syy((v6 SZZ66<<=>ugF   -Sv.  cmm_SE*8 3 SV,==E) VC5!/==H, ,8 62 F399+ V,r5clddl}ddl}t|ds t|dr |j}nt|dr |j}|t j }|ttyt|trt||yt|trtt|\a ad}g}tD]y} t||} t| |vrt!d|d| nF|j#t| t!d |d | t| t!d |z| |d z }{|dk(rt!d|d| yt!d|z| y|j'|s|j)|r{|j*} t|j-|} t1| | z|kDrt3| | |} n| | z} t!d| zdz| t!|j5|| y|j7|rJ|j*} t|j-|} t1| | z|kDrt3| | |} n| | z} t!d| zdz| |j5|} | 3t|drCt!|j5|j8| nt!|j5|| |j;|}|Dcgc] }|ddk7s |}}|r^t!d| |D]K}t=||d}|'|j?|j5|xsd\}}t!d|d| Myyt|drt!|j5|| yy#t$$rYwxYw#t.$rd} YwxYw#t.$rd} Y}wxYwcc}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 rN_ppimport_importer_ppimport_module_ppimport_attr)rz$ *** Repeat reference found in z *** rz *** Found in z ***-rNz Help for z not found.z+ *** Total of %d references found. ***z()rOrAr>_z Methods: Nonez z -- rS) inspectpydochasattrrrrrrrrrstr _namedictr _dictlistidr%rKeyError isfunctionismethodrP signature ExceptionrXr|getdocisclassr> allmethodsrsplitdoc)objectmaxwidthrtoplevelrrnumfoundobjlistnamestrrrrrsargstrdoc1methodsmethpublic_methodsthisobjmethstrothers r*rrsD,- 6- .(( ) *&& ~ ~ T FG $ fV$ FC  #0#: Iy  G (0c7g%A'%P%NN2c7+.wit<6JI#.v6A   q= IfX[1 ? :  ?   # gnnV$62 $u   I  I $FsC:A6M= N N N1,N1= N  N  NN N.-N.cdtjdtdddl}|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)rCrDrN)rFrGrHast literal_eval)sourcers r* safe_evalrGs4l MM 2     F ##r5cd|jdk(r|S|jd|}tj|}tjj |r|j d}|js|St|tjr|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. r)axisF)where) sizetakerisnanma isMaskedArrayfilledanyrgenericcopyto)dataresultrpotential_nansns r*_median_nancheckrs* yyA~ YYrY-N  A uu1 HHUO 557 &"**%IIfnA. Mr5cddlm}m}m}t |dk(rt |dk(rydj |}|D]}||r |d|dz }|d|dz }|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. rr rqrO*?)rr r rrXr0)r r renabled_featuresr)s r* _opt_infors  !c*:&;q&@xx 01#/ G $ !G9A .  !G9A .  / r5c|j|jdu}g}g}g}g}|jjD]v\}}t|d}||durd}|j ||j ||j |d|j t |dkrdn|dx|s|S|||||j d} tj| |jS|jC|j\} } t| } |j| | ur|Stj| | fS|j|Stj|jS) 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")``. NrTrNrC)namesformatsoffsetstitlesr)align) fieldsmetadataitems drop_metadatarrXrrrisalignedstructsubdtyper) rfound_metadatarrrrrrfieldfield_dt structurerr new_subdtypes r*rrs`* ||t3 <<--/ @KD%$U1X.HuQx'!% LL  NN8 $ NN58 $ MM#e*q.$eAh ? @Lw7f( xx )>)>??  #..%$X. >> !lh&>Lxxu-.. >> !Lxx ""r5)rr9)NLNr)rQr.rrrYrrFrrr3r numpy._utilsr__all__rrr7rVrlror|rrrrrrrrrrcr5r*r s   #   G::z G* * Z@@F >+B&#d(   (3-l G^3^3B@$F(T@<#r5