HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/numpy/tests/__pycache__/test_public_api.cpython-310.pyc
o

���g�F�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZzddlZWne
y?dZYnwd6dd�Zdd�Ze	jjedd�e	j�d	d
g�dd���Zd
d�Zdd�Zdd�Ze	jjedudd�dd��Zdd�dD�Zejdkr�edd�dD�7Zgd�Zdd�dD�Zejdkr�edd�d D�7Zd!d"�Zgd#�Zejdkr�ed$g7Ze	j�d%�d&d'��Zgd(�Z ejdkr�e gd)�7Z d*d+�Z!d,d-�Z"e	jj#e�$d.�d/vd0d�d1d2��Z%e	j�d	gd3��d4d5��Z&dS)7�N)�IS_WASMcCs`|dur|j}i}t|�D] }t||�}t|d�r-t|d�r-|j|kr-|jd|j||<q
|S)zEReturns a mapping of all objects with the wrong __module__ attribute.N�
__module__�__name__�.)r�dir�getattr�hasattrr)�module�module_name�results�name�item�r�F/usr/local/lib/python3.10/dist-packages/numpy/tests/test_public_api.py�	check_dirs

�rcCs�idd�dd�dd�dd�dd	�d
d�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#d$��}|}tt�}||ksFJ�dS)%N�_add_newdoc_ufuncz.numpy.core._multiarray_umath._add_newdoc_ufunc�
add_docstringz*numpy.core._multiarray_umath.add_docstring�
add_newdocz#numpy.core.function_base.add_newdoc�add_newdoc_ufunc�byte_boundsznumpy.lib.utils.byte_bounds�compare_chararraysz/numpy.core._multiarray_umath.compare_chararrays�	deprecateznumpy.lib.utils.deprecate�deprecate_with_docz"numpy.lib.utils.deprecate_with_doc�dispznumpy.lib.function_base.disp�fastCopyAndTransposez1numpy.core._multiarray_umath.fastCopyAndTranspose�get_array_wrapz#numpy.lib.shape_base.get_array_wrap�get_includeznumpy.lib.utils.get_include�
recfromcsvznumpy.lib.npyio.recfromcsv�
recfromtxtznumpy.lib.npyio.recfromtxt�	safe_evalznumpy.lib.utils.safe_eval�set_string_functionz)numpy.core.arrayprint.set_string_function�show_configznumpy.__config__.showznumpy.lib.utils.show_runtimeznumpy.lib.utils.who)�show_runtime�who)r�np)�undocumented�	allowlist�bad_resultsrrr�test_numpy_namespace!sR��������	�
���
������r(zcan't start subprocess)�reasonr�testingcCs6tjdd|f}t�|�}|rJ�|tt�vsJ�dS)a�Make sure we can actually use the modules we lazy load.

    While not exported as part of the public API, it was accessible.  With the
    use of __getattr__ and __dir__, this isn't always true It can happen that
    an infinite recursion may happen.

    This is the only way I found that would force the failure to appear on the
    badly implemented code.

    We also test for the presence of the lazily imported modules in dir

    z-czimport numpy; numpy.N)�sys�
executable�
subprocess�check_outputrr$)r�exe�resultrrr�test_import_lazy_importAs
r1cCs$ttt��tttt���ksJ�dS)zWAssert that output of dir has only one "testing/tester"
    attribute without duplicateN)�lenrr$�setrrrr�test_dir_testingXs$r4cC�ttj�}|iksJ�dS�N)rr$�linalg�r'rrr�test_numpy_linalg^�
r9cCr5r6)rr$�fftr8rrr�test_numpy_fftcr:r<z#ctypes not available in this pythoncCs0t�tjjj�}t|dd�}|dusJd��dS)N�test_not_exportedzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)�ctypes�CDLLr$�core�_multiarray_tests�__file__r)�cdll�frrr�test_NPY_NO_EXPORThsrEcC�g|]}d|�qS�znumpy.r��.0�srrr�
<listcomp>~�rK)"�	array_apizarray_api.linalg�	ctypeslib�docz
doc.constantsz
doc.ufuncs�dtypes�
exceptions�f2pyr;�libz
lib.formatz
lib.mixinszlib.recfunctionszlib.scimathzlib.stride_tricksr7�maz	ma.extraszma.mrecords�matlib�
polynomialzpolynomial.chebyshevzpolynomial.hermitezpolynomial.hermite_ezpolynomial.laguerrezpolynomial.legendrezpolynomial.polynomial�randomr*ztesting.overrides�typingztyping.mypy_plugin�version)��cCrFrGrrHrrrrK���)�	distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilz
distutils.logzdistutils.system_info)z
numpy.charznumpy.emathz	numpy.reccCrFrGrrHrrrrK�rL):�compatzcompat.py3k�conftestr@zcore.arrayprintzcore.defchararrayzcore.einsumfunczcore.fromnumericzcore.function_basezcore.getlimitszcore.memmapzcore.multiarrayzcore.numericzcore.numerictypeszcore.overrideszcore.recordszcore.shape_basez
core.umathz
f2py.auxfuncszf2py.capi_mapsz
f2py.cb_ruleszf2py.cfuncszf2py.common_ruleszf2py.crackfortranz
f2py.diagnosezf2py.f2py2ezf2py.f90mod_ruleszf2py.func2subrz
f2py.rulesz
f2py.symboliczf2py.use_rulesz
fft.helperzlib.arraypadzlib.arraysetopszlib.arrayteratorzlib.function_basezlib.histogramszlib.index_trickszlib.nanfunctionsz	lib.npyiozlib.polynomialzlib.shape_basezlib.twodim_basezlib.type_checkz
lib.ufunclikezlib.user_arrayz	lib.utilszlinalg.lapack_litez
linalg.linalgzma.corezma.testutilszma.timer_comparison�	matrixlibzmatrixlib.defmatrixzpolynomial.polyutilsz
random.mtrandzrandom.bit_generatorztesting.print_coercion_tablescCrFrGrrHrrrrK�r\)7zdistutils.armccompilerzdistutils.fujitsuccompilerzdistutils.ccompilerzdistutils.ccompiler_optzdistutils.commandzdistutils.command.autodistzdistutils.command.bdist_rpmzdistutils.command.buildzdistutils.command.build_clibzdistutils.command.build_extzdistutils.command.build_pyzdistutils.command.build_scriptszdistutils.command.build_srczdistutils.command.configz!distutils.command.config_compilerzdistutils.command.developzdistutils.command.egg_infozdistutils.command.installzdistutils.command.install_clibzdistutils.command.install_dataz!distutils.command.install_headerszdistutils.command.sdistzdistutils.conv_templatezdistutils.corezdistutils.extensionzdistutils.fcompilerzdistutils.fcompiler.absoftzdistutils.fcompiler.armzdistutils.fcompiler.compaqzdistutils.fcompiler.environmentzdistutils.fcompiler.g95zdistutils.fcompiler.gnuzdistutils.fcompiler.hpuxzdistutils.fcompiler.ibmzdistutils.fcompiler.intelzdistutils.fcompiler.laheyzdistutils.fcompiler.mipszdistutils.fcompiler.nagzdistutils.fcompiler.nonezdistutils.fcompiler.pathf95zdistutils.fcompiler.pgzdistutils.fcompiler.nvzdistutils.fcompiler.sunzdistutils.fcompiler.vastzdistutils.fcompiler.fujitsuzdistutils.from_templatezdistutils.intelccompilerzdistutils.lib2defzdistutils.line_endingszdistutils.mingw32ccompilerzdistutils.msvccompilerzdistutils.npy_pkg_configzdistutils.numpy_distributionzdistutils.pathccompilerzdistutils.unixccompilercCsDd|vsd|vsd|vrdS|tvrdS|tvrdS|tvr dSdS)z%Check if this needs to be considered.z._z.testsz.setupFT)�PUBLIC_MODULES�PUBLIC_ALIASED_MODULES�PRIVATE_BUT_PRESENT_MODULES�rrrr�
is_unexpected1sre)znumpy.core.code_generatorsz!numpy.core.code_generators.genapiz)numpy.core.code_generators.generate_umathz+numpy.core.code_generators.ufunc_docstringsz-numpy.core.code_generators.generate_numpy_apiz-numpy.core.code_generators.generate_ufunc_apiz$numpy.core.code_generators.numpy_apiz-numpy.core.code_generators.generate_umath_docz/numpy.core.code_generators.verify_c_api_versionznumpy.core.cversionsznumpy.core.generate_numpy_apiznumpy.core.umath_testsznumpy.distutils.msvc9compilerz'ignore:.*np.compat.*:DeprecationWarningcCsXg}tjtjtjddd�D]\}}}t|�r |tvr |�|�q|r*td|����dS)z|
    Test that we don't add anything that looks like a new public module by
    accident.  Check is based on filenames.
    rN)�path�prefix�onerrorzFound unexpected modules: )	�pkgutil�
walk_packagesr$�__path__rre�	SKIP_LIST�append�AssertionError)�modnames�_�modname�ispkgrrr�test_all_modules_are_expectedWs�
��rs)z
numpy.mathznumpy.doc.constants.reznumpy.doc.constants.textwrapznumpy.lib.emathznumpy.lib.mathznumpy.matlib.charznumpy.matlib.recznumpy.matlib.emathznumpy.matlib.exceptionsznumpy.matlib.mathznumpy.matlib.linalgznumpy.matlib.fftznumpy.matlib.randomznumpy.matlib.ctypeslibznumpy.matlib.ma)znumpy.distutils.log.sysznumpy.distutils.log.loggingznumpy.distutils.log.warningscCs>dd�}|d�}tD]	}|�||��q
|rtd�|���dS)a�
    Method checking all objects. The pkgutil-based method in
    `test_all_modules_are_expected` does not catch imports into a namespace,
    only filenames.  So this test is more thorough, and checks this like:

        import .lib.scimath as emath

    To check if something in a module is (effectively) public, one can check if
    there's anything in that namespace that's a public function/object but is
    not exposed in a higher-level namespace.  For example for a `numpy.lib`
    submodule::

        mod = np.lib.mixins
        for obj in mod.__all__:
            if obj in np.__all__:
                continue
            elif obj in np.lib.__all__:
                continue

            else:
                print(obj)

    cSsxg}t�|�}t|d�r|j}nt|�}|D]#}|�d�s9|d|}tt||�tj	�r9t
|�r9|tvr9|�|�q|S)N�__all__rpr)
�	importlib�
import_modulerrtr�
startswith�
isinstancer�types�
ModuleTypere�SKIP_LIST_2rm)�mod_name�membersr	�objnames�objname�fullobjnamerrr�find_unexpected_members�s



�z@test_all_modules_are_expected_2.<locals>.find_unexpected_members�numpyz5Found unexpected object(s) that look like modules: {}N)ra�extendrn�format)r��unexpected_membersrqrrr�test_all_modules_are_expected_2�s��r�c	Cs�dd�}g}tD]}||�s|�|�q|rtd�|���tD]}zt|�Wqty5|�|�Yqw|r?td�|���tjdd��$}tj	dt
d�tj	dtd�tD]}||�sa|�|�qVWd	�n1slwY|rztd
�|���d	S)a	
    Check that all submodules listed higher up in this file can be imported

    Note that if a PRIVATE_BUT_PRESENT_MODULES entry goes missing, it may
    simply need to be removed from the list (deprecation may or may not be
    needed - apply common sense).
    c	Ss*zt�|�WdSttfyYdSw)NFT)rurv�ImportError�AttributeError)r
rrr�check_importable�s��z-test_api_importable.<locals>.check_importablez5Modules in the public API that cannot be imported: {}z1Modules in the public API that were not found: {}T)�record�always)�categoryNzPModules that are not really public but looked public and can not be imported: {})
rarmrnr�rb�evalr��warnings�catch_warnings�filterwarnings�DeprecationWarning�
ImportWarningrc)r��module_namesr
�wrrr�test_api_importable�sD
����
�����r��Py_DEBUG)Nr�0z�NumPy possibly built with `USE_DEBUG=True ./tools/travis-test.sh`, which does not expose the `array_api` entry point. See https://github.com/numpy/numpy/pull/19800cCs�t�d�tjv}tj��}z|jdd�}Wnty$|�	dg�}Ynwt
|�dkr6|r4d}t|�d�dSztdd�|D��}Wnt
yT|rQd	}t|�d�YdSw|��}d
|j�d�}|tjusiJ|��dS)z}
    Entry point for Array API implementation can be found with importlib and
    returns the numpy.array_api namespace.
    �platlibrM)�grouprz%No entry points for 'array_api' foundNcss�|]
}|jdkr|VqdS)r�Nrd)rI�eprrr�	<genexpr>
s�z-test_array_api_entry_point.<locals>.<genexpr>z%'numpy' not in array_api entry pointsznumpy entry point value 'z0' does not point to our Array API implementation)�	sysconfig�get_pathr$rBru�metadata�entry_points�selectr��getr2rn�next�
StopIteration�load�valuer�rM)�numpy_in_sitepackages�eps�xp_eps�msgr��xprrr�test_array_api_entry_point�s0
�

��r�)�ModuleDeprecationWarning�VisibleDeprecationWarning�ComplexWarning�TooHardError�	AxisErrorcCsR|tjvsJ�|t��vsJ�tt|�jdksJ�|tjjvs!J�ttj|�dS)Nznumpy.exceptions)r$rt�__dir__rrrQrdrrr�test_moved_exceptionss
r�r6)'r+r�r-riryrur�r�r$�pytest�
numpy.testingrr>r�rr(�mark�skipif�parametrizer1r4r9r<rEra�version_inforbrcrerlr�rsr{r�r��xfail�get_config_varr�r�rrrr�<module>sr�

 �

$�

<�=




40�
)