a
    ç´«jQY  ã                   @   s  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Z	d dlZd dl
mZ d dlZzd dlZW n ey†   dZY n0 d9dd„Zdd„ Zejjedd�ej d	d
g¡dd„ ƒƒZdd„ Zdd„ Zdd„ Zejjedu dd�dd„ ƒZdd„ dD ƒZe jdk �r"edd„ dD ƒ7 Zg d¢Zdd„ dD ƒZe jdk �rVedd„ d D ƒ7 Zd!d"„ Ze jdk �rrd#gZng Zej d$¡d%d&„ ƒZ g d'¢Z!e jdk �rªe!g d(¢7 Z!d)d*„ Z"d+d,„ Z#ejj$e %d-¡d.vd/d�d0d1„ ƒZ&d2d3„ Z'ej d4¡d5d6„ ƒZ(d7d8„ Z)dS ):é    N)ÚIS_WASMc                 C   sj   |du r| j }i }t| ƒD ]J}|dkr(qt| |ƒ}t|dƒrt|dƒr|j|kr|jd |j  ||< q|S )zEReturns a mapping of all objects with the wrong __module__ attribute.NÚcoreÚ
__module__Ú__name__Ú.)r   ÚdirÚgetattrÚhasattrr   )ÚmoduleÚmodule_nameÚresultsÚnameÚitem© r   úZ/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/numpy/tests/test_public_api.pyÚ	check_dir   s    
ÿr   c                  C   s"   dddœ} t tƒ}|| ksJ ‚d S )Nznumpy.rec.recarrayznumpy.__config__.show)ZrecarrayZshow_config)r   Únp)Z	allowlistÚbad_resultsr   r   r   Útest_numpy_namespace%   s
    þr   zcan't start subprocess)Úreasonr   Útestingc                 C   s6   t jdd|  f}t |¡}|r"J ‚| ttƒv s2J ‚dS )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-czimport numpy; numpy.N)ÚsysÚ
executableÚ
subprocessÚcheck_outputr   r   )r   ZexeÚresultr   r   r   Útest_import_lazy_import1   s    
r   c                   C   s$   t ttƒƒt tttƒƒƒks J ‚dS )zWAssert that output of dir has only one "testing/tester"
    attribute without duplicateN)Úlenr   r   Úsetr   r   r   r   Útest_dir_testingH   s    r   c                  C   s   t tjƒ} | i ksJ ‚d S ©N)r   r   Úlinalg©r   r   r   r   Útest_numpy_linalgN   s    
r#   c                  C   s   t tjƒ} | i ksJ ‚d S r    )r   r   Úfftr"   r   r   r   Útest_numpy_fftS   s    
r%   z#ctypes not available in this pythonc                  C   s0   t  tjjj¡} t| dd ƒ}|d u s,J dƒ‚d S )NZtest_not_exportedzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)ÚctypesÚCDLLr   Ú_coreZ_multiarray_testsÚ__file__r   )ÚcdllÚfr   r   r   Útest_NPY_NO_EXPORTX   s    r,   c                 C   s   g | ]}d | ‘qS ©únumpy.r   ©Ú.0Úsr   r   r   Ú
<listcomp>n   ó    r2   ) Z	ctypeslibZdtypesÚ
exceptionsÚf2pyr$   Úlibzlib.array_utilsz
lib.formatzlib.introspectz
lib.mixinsz	lib.npyiozlib.recfunctionszlib.scimathzlib.stride_tricksr!   Úmaz	ma.extraszma.mrecordsZ
polynomialzpolynomial.chebyshevzpolynomial.hermitezpolynomial.hermite_ezpolynomial.laguerrezpolynomial.legendrezpolynomial.polynomialÚrandomÚstringsr   ztesting.overridesÚtypingztyping.mypy_pluginÚversion)é   é   c                 C   s   g | ]}d | ‘qS r-   r   r/   r   r   r   r2   ‘   s   )Ú	distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilzdistutils.logzdistutils.system_info)ú
numpy.charznumpy.emathz	numpy.recc                 C   s   g | ]}d | ‘qS r-   r   r/   r   r   r   r2   ¥   r3   ),Úcompatzcompat.py3kZconftestr   zcore.multiarrayzcore.numericz
core.umathzcore.arrayprintzcore.defchararrayzcore.einsumfunczcore.fromnumericzcore.function_basezcore.getlimitszcore.numerictypeszcore.overrideszcore.recordszcore.shape_basezf2py.auxfuncszf2py.capi_mapszf2py.cb_ruleszf2py.cfuncszf2py.common_ruleszf2py.crackfortranzf2py.diagnosezf2py.f2py2ezf2py.f90mod_ruleszf2py.func2subrz
f2py.ruleszf2py.symboliczf2py.use_rulesz
fft.helperzlib.user_arrayzlinalg.lapack_litezlinalg.linalgzma.corezma.testutilszma.timer_comparisonZmatlibZ	matrixlibzmatrixlib.defmatrixzpolynomial.polyutilszrandom.mtrandzrandom.bit_generatorztesting.print_coercion_tablesc                 C   s   g | ]}d | ‘qS r-   r   r/   r   r   r   r2   Ô   s   )7zdistutils.armccompilerzdistutils.fujitsuccompilerzdistutils.ccompilerzdistutils.ccompiler_optzdistutils.commandzdistutils.command.autodistzdistutils.command.bdist_rpmzdistutils.command.buildzdistutils.command.build_clibzdistutils.command.build_extzdistutils.command.build_pyzdistutils.command.build_scriptszdistutils.command.build_srczdistutils.command.configz!distutils.command.config_compilerzdistutils.command.developzdistutils.command.egg_infozdistutils.command.installzdistutils.command.install_clibzdistutils.command.install_dataz!distutils.command.install_headerszdistutils.command.sdistzdistutils.conv_templatezdistutils.corezdistutils.extensionzdistutils.fcompilerzdistutils.fcompiler.absoftzdistutils.fcompiler.armzdistutils.fcompiler.compaqzdistutils.fcompiler.environmentzdistutils.fcompiler.g95zdistutils.fcompiler.gnuzdistutils.fcompiler.hpuxzdistutils.fcompiler.ibmzdistutils.fcompiler.intelzdistutils.fcompiler.laheyzdistutils.fcompiler.mipszdistutils.fcompiler.nagzdistutils.fcompiler.nonezdistutils.fcompiler.pathf95zdistutils.fcompiler.pgzdistutils.fcompiler.nvzdistutils.fcompiler.sunzdistutils.fcompiler.vastzdistutils.fcompiler.fujitsuzdistutils.from_templatezdistutils.intelccompilerzdistutils.lib2defzdistutils.line_endingszdistutils.mingw32ccompilerzdistutils.msvccompilerzdistutils.npy_pkg_configzdistutils.numpy_distributionzdistutils.pathccompilerzdistutils.unixccompilerc                 C   sD   d| v sd| v sd| v rdS | t v r(dS | tv r4dS | tv r@dS dS )z%Check if this needs to be considered.z._z.testsz.setupFT)ÚPUBLIC_MODULESÚPUBLIC_ALIASED_MODULESÚPRIVATE_BUT_PRESENT_MODULES©r   r   r   r   Úis_unexpected  s    rE   znumpy.distutils.msvc9compilerz'ignore:.*np.compat.*:DeprecationWarningc                  C   sX   g } t jtjtjd dd�D ]$\}}}t|ƒr|tvr|  |¡ q| rTtd| › �ƒ‚dS )z|
    Test that we don't add anything that looks like a new public module by
    accident.  Check is based on filenames.
    r   N)ÚpathÚprefixÚonerrorzFound unexpected modules: )	ÚpkgutilÚwalk_packagesr   Ú__path__r   rE   Ú	SKIP_LISTÚappendÚAssertionError)ÚmodnamesÚ_ÚmodnameÚispkgr   r   r   Útest_all_modules_are_expected)  s    þrS   )znumpy.lib.mathznumpy.matlib.charznumpy.matlib.recznumpy.matlib.emathznumpy.matlib.exceptionsznumpy.matlib.mathznumpy.matlib.linalgznumpy.matlib.fftznumpy.matlib.randomznumpy.matlib.ctypeslibznumpy.matlib.ma)znumpy.distutils.log.sysznumpy.distutils.log.loggingznumpy.distutils.log.warningsc                  C   s>   dd„ } | dƒ}t D ]}| | |ƒ¡ q|r:td |¡ƒ‚dS )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)

    c                 S   sx   g }t  | ¡}t|dƒr |j}nt|ƒ}|D ]F}| d¡s,| d | }tt||ƒtj	ƒr,t
|ƒr,|tvr,| |¡ q,|S )NÚ__all__rP   r   )Ú	importlibÚimport_moduler	   rT   r   Ú
startswithÚ
isinstancer   ÚtypesÚ
ModuleTyperE   ÚSKIP_LIST_2rM   )Úmod_nameÚmembersr
   ZobjnamesZobjnameZfullobjnamer   r   r   Úfind_unexpected_membersn  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^   Zunexpected_membersrQ   r   r   r   Útest_all_modules_are_expected_2U  s    ÿrb   c               	   C   sú   dd„ } g }t D ]}| |ƒs| |¡ q|r:td |¡ƒ‚tD ].}zt|ƒ W q> tyj   | |¡ Y q>0 q>|r€td |¡ƒ‚tjdd��H}tj	dt
d� tj	dtd� tD ]}| |ƒs®| |¡ q®W d	  ƒ n1 sÚ0    Y  |rötd
 |¡ƒ‚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              	   S   s,   zt  | ¡ W n ttfy&   Y dS 0 dS )NFT)rU   rV   ÚImportErrorÚAttributeError)r   r   r   r   Ú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: {})rA   rM   rN   ra   rB   Úevalrd   ÚwarningsÚcatch_warningsÚfilterwarningsÚDeprecationWarningÚImportWarningrC   )re   Zmodule_namesr   Úwr   r   r   Útest_api_importable‰  s8    ÿÿ*þrp   Ú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/19800c                  C   sâ   t  d¡tjv } tj ¡ }z|jdd�}W n tyH   | 	dg ¡}Y n0 t
|ƒdkrl| rhd}t|ƒd‚dS ztdd„ |D ƒƒ}W n& ty¨   | r¢d	}t|ƒd‚Y dS 0 |jd
kr¸dS | ¡ }d|j› d�}|tu sÞJ |ƒ‚dS )zx
    Entry point for Array API implementation can be found with importlib and
    returns the main numpy namespace.
    ÚplatlibZ	array_api)Úgroupr   z%No entry points for 'array_api' foundNc                 s   s   | ]}|j d kr|V  qdS )r_   NrD   )r0   Úepr   r   r   Ú	<genexpr>Û  r3   z-test_array_api_entry_point.<locals>.<genexpr>z%'numpy' not in array_api entry pointsznumpy.array_apiznumpy entry point value 'z0' does not point to our Array API implementation)Ú	sysconfigÚget_pathr   r)   rU   ÚmetadataZentry_pointsÚselectrd   Úgetr   rN   ÚnextÚStopIterationÚvalueÚloadr_   )Znumpy_in_sitepackagesZepsZxp_epsÚmsgru   Zxpr   r   r   Útest_array_api_entry_point¹  s0    



ÿr�   c                  C   sV   dd„ } dd„ }| t jƒ}||ƒ}| t  ¡ ƒ}||ƒ}||ksRJ d| |¡› �ƒ‚dS )zˆ
    Checks if `dir(np)` and `np.__all__` are consistent and return
    the same content, excluding exceptions and private members.
    c                 S   s   dd„ | D ƒS )Nc                 S   s   h | ]}|  d ¡s|’qS )rP   )rW   )r0   Úmr   r   r   Ú	<setcomp>ø  r3   zYtest_main_namespace_all_dir_coherence.<locals>._remove_private_members.<locals>.<setcomp>r   ©Z
member_setr   r   r   Ú_remove_private_members÷  s    zFtest_main_namespace_all_dir_coherence.<locals>._remove_private_membersc                 S   s   |   dh¡S )NÚbool)Ú
differencer„   r   r   r   Ú_remove_exceptionsú  s    ÿzAtest_main_namespace_all_dir_coherence.<locals>._remove_exceptionszMembers that break symmetry: N)r   rT   Ú__dir__Úsymmetric_difference)r…   rˆ   Zall_membersZdir_membersr   r   r   Ú%test_main_namespace_all_dir_coherenceò  s    

ÿÿr‹   z:ignore:numpy.core(\.\w+)? is deprecated:DeprecationWarningc                  C   s¾   ddl m}  ttjƒD ]¢}| d¡s|dv sd|› �tv r<qttj|ƒ}t 	|¡r¦|}|}t|ƒD ]@}| d¡rrqbt||ƒ}t
d|› �|gd�}|t||ƒu sbJ ‚qbq|t| |ƒu sJ ‚qdS )	zp
    Check that all "semi-public" members of `numpy._core` are also accessible
    from `numpy.core` shims.
    r   NrP   )Útestsr9   r.   Ú__znumpy.core.)Úfromlist)Z
numpy.corer   r   r   r(   rW   rB   r   ÚinspectÚismoduleÚ
__import__)r   Úmember_nameÚmemberÚ	submoduleZsubmodule_nameZsubmodule_member_nameZsubmodule_memberZcore_submoduler   r   r   Útest_core_shims_coherence  s2    ÿþý


þÿr•   c                  C   sž  ddl m} m}m}m}m}m} ddlm} t	h}t
ƒ }tƒ }	g }
t	g}t|ƒdk�r~| ¡ }t|ƒD �]}t||ƒ}t |¡rÄd|jv rÄ| d¡sÄd|jvrÄ|dvrÄ||vrÄ| |¡ | |¡ qft |¡sät||ƒsät|t	jƒrf||v �rf|jdv �r|jdk�rqf|jd	k�r$|j d
¡�r$qf|jdv �r>|jdk�r>qf|jdk�rLqf|
 |j|j|	| f¡ qf| |¡ |j|	|< qfqH~~~	t|
ƒdk�sšJ |
ƒ‚dS )zÞ
    Check that each public function is available from one location only.

    Test performs BFS search traversing NumPy's public API. It flags
    any function-like object that is accessible from more that one place.
    r   )ÚAnyÚCallableÚDictÚListÚSetÚTuple)Ú_ArrayFunctionDispatcherr_   rP   znumpy._core)r5   r7   r   rŒ   )ÚabsoluteZarccosZarccoshZarcsinZarcsinhZarctanZarctan2ZarctanhZ
left_shiftZright_shiftÚ	conjugateÚinvertÚ	remainderÚdivideZconcatenateÚpowerZ	transposeZtrimcoefznumpy.polynomial)ÚaddÚequalÚ	not_equalZgreaterZgreater_equalÚlessZ
less_equalznumpy.stringsr?   N)r:   r–   r—   r˜   r™   rš   r›   Znumpy._core._multiarray_umathrœ   r   r   Údictr   Úpopr   r   r�   r�   r   rW   rM   r£   Ú
isfunctionrX   Zufunc)r–   r—   r˜   r™   rš   r›   Zdispatched_functionZvisited_modulesZvisited_functionsZfunctions_original_pathsZduplicated_functionsZmodules_queuer
   r’   r“   r   r   r   Útest_functions_single_location:  st     
ÿþýüúù	
ÿþ
ý
ÿìÿ
þø	þÿ
rª   )N)*r   rw   r   rI   rY   rU   r�   rj   r_   r   Znumpy.testingr   Zpytestr&   rc   r   r   ÚmarkZskipifZparametrizer   r   r#   r%   r,   rA   Úversion_inforB   rC   rE   rL   rl   rS   r[   rb   rp   ZxfailÚget_config_varr�   r‹   r•   rª   r   r   r   r   Ú<module>   sx   

ÿ
"ÿ.ÿ=

40ý
1ÿ
,