
     h
?                     P   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n# e$ r dZY nw xY wddZd Ze	j                            ed          e	j                            ddd	g          d
                         Zd Zd Zd Ze	j                            edu d          d             Zd dD             Zg dZd dD             Zd Zg dZd Zg dZd Zd Z e	j        !                     ej"        d          dud          d             Z#dS )    N)IS_WASMc                     || j         }i }t          |           D ]R}t          | |          }t          |d          r0t          |d          r |j        |k    r|j        dz   |j         z   ||<   S|S )zEReturns a mapping of all objects with the wrong __module__ attribute.N
__module____name__.)r   dirgetattrhasattrr   )modulemodule_nameresultsnameitems        W/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/numpy/tests/test_public_api.py	check_dirr      s    oGF B Bvt$$D,'' 	BGD*,E,E 	BO{22 Oc1DMAGDMN    c                      i ddddddddd	dd
dddddddddddddddddddddd d!d"d#d$d%} | }t          t                    }||k    sJ d S )&NTesterz,numpy.testing._private.nosetester.NoseTester_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_boundsznumpy.lib.utils.byte_boundscompare_chararraysz/numpy.core._multiarray_umath.compare_chararrays	deprecateznumpy.lib.utils.deprecatedeprecate_with_docz"numpy.lib.utils.deprecate_with_docdispznumpy.lib.function_base.dispfastCopyAndTransposez1numpy.core._multiarray_umath.fastCopyAndTransposeget_array_wrapz#numpy.lib.shape_base.get_array_wrapget_includeznumpy.lib.utils.get_include
recfromcsvznumpy.lib.npyio.recfromcsv
recfromtxtznumpy.lib.npyio.recfromtxt	safe_evalznumpy.lib.utils.safe_evalset_string_functionz)numpy.core.arrayprint.set_string_functionznumpy.__config__.showznumpy.lib.utils.show_runtimeznumpy.lib.utils.who)show_configshow_runtimewho)r   np)undocumented	allowlistbad_resultss      r   test_numpy_namespacer,   !   s'   @M 	E 	;	
 	L 	4 	O 	0 	B 	. 	 S 	? 	4 	2 	2  	0!" 	J#$ /6$)  L. IB--K )######r   zcan't start subprocess)reasonr   testingr   c                     t           j        dd| z   f}t          j        |          }|rJ | t	          t
                    v sJ 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   exeresults      r   test_import_lazy_importr6   B   sL     >4!7$!>
?C$S))F: 3r77??????r   c                      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(   set r   r   test_dir_testingr;   Y   s;     s2ww<<3s3r77||,,,,,,,,r   c                  H    t          t          j                  } | i k    sJ d S N)r   r(   linalgr+   s    r   test_numpy_linalgr@   _   s(    BI&&K"r   c                  H    t          t          j                  } | i k    sJ d S r=   )r   r(   fftr?   s    r   test_numpy_fftrC   d   s(    BF##K"r   z#ctypes not available in this pythonc                      t          j        t          j        j        j                  } t          | dd           }|
J d            d S )Ntest_not_exportedzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)ctypesCDLLr(   core_multiarray_tests__file__r	   )cdllfs     r   test_NPY_NO_EXPORTrM   i   sC     ;rw09::D)400A99 499999r   c                     g | ]}d |z   S znumpy.r:   .0ss     r   
<listcomp>rS      s(     & & &1(Q, & & &r   )%	array_apizarray_api.linalg	ctypeslib	distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilzdistutils.logzdistutils.system_infodoczdoc.constantsz
doc.ufuncsf2pyrB   libz
lib.formatz
lib.mixinszlib.recfunctionszlib.scimathzlib.stride_tricksr>   maz	ma.extraszma.mrecordsmatlib
polynomialzpolynomial.chebyshevzpolynomial.hermitezpolynomial.hermite_ezpolynomial.laguerrezpolynomial.legendrezpolynomial.polynomialrandomr.   typingztyping.mypy_pluginversion)z
numpy.charznumpy.emathz	numpy.recc                     g | ]}d |z   S rO   r:   rP   s     r   rS   rS      s.     u u ux!| u u ur   )tcompatzcompat.py3kconftestrH   zcore.arrayprintzcore.defchararrayzcore.einsumfunczcore.fromnumericzcore.function_basezcore.getlimitszcore.memmapzcore.multiarrayzcore.numericzcore.numerictypeszcore.overrideszcore.recordszcore.shape_basez
core.umathzcore.umath_testszdistutils.armccompilerz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.unixccompilerdualz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.arraypadzlib.arraysetopszlib.arrayteratorzlib.function_basezlib.histogramszlib.index_trickszlib.nanfunctionsz	lib.npyiozlib.polynomialzlib.shape_basezlib.twodim_basezlib.type_checkzlib.ufunclikezlib.user_arrayz	lib.utilszlinalg.lapack_litezlinalg.linalgzma.benchzma.corezma.testutilszma.timer_comparison	matrixlibzmatrixlib.defmatrixzpolynomial.polyutilszrandom.mtrandzrandom.bit_generatorztesting.print_coercion_tablesztesting.utilsc                 d    d| v sd| v sd| v rdS | t           v rdS | t          v rd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   s    r   is_unexpectedrj   '  s[    t||x4''8t+;+;u~u%%%u***u4r   )znumpy.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.cversionsznumpy.core.generate_numpy_apiznumpy.distutils.msvc9compilerc                      g } t          j        t          j        t          j        dz   d          D ]3\  }}}t          |          r|t          vr|                     |           4| rt          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   rj   	SKIP_LISTappendAssertionError)modnames_modnameispkgs       r   test_all_modules_are_expectedry   I  s     H$2:<+:K;?A A A % %7E !! 	%gY&>&> OOG$$$ FD(DDEEEF Fr   )z
numpy.mathznumpy.distutils.log.sysznumpy.distutils.log.loggingznumpy.distutils.log.warningsznumpy.doc.constants.reznumpy.doc.constants.textwrapznumpy.lib.emathznumpy.lib.mathznumpy.matlib.charznumpy.matlib.recznumpy.matlib.emathznumpy.matlib.mathznumpy.matlib.linalgznumpy.matlib.fftznumpy.matlib.randomznumpy.matlib.ctypeslibznumpy.matlib.mac                      d }  | d          }t           D ] }|                     | |                     !|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                 n   g }t          j        |           }t          |d          r|j        }nt	          |          }|D ]t}|                    d          s]| dz   |z   }t          t          ||          t          j	                  r-t          |          r|t          vr|                    |           u|S )N__all__rv   r   )	importlibimport_moduler
   r|   r   
startswith
isinstancer	   types
ModuleTyperj   SKIP_LIST_2rs   )mod_namemembersr   objnamesobjnamefullobjnames         r   find_unexpected_membersz@test_all_modules_are_expected_2.<locals>.find_unexpected_members  s    (2269%% 	#~HH6{{H 	8 	8G%%c** 8&nw6gfg668HII 8$[11 8&k99#NN;777r   numpyz5Found unexpected object(s) that look like modules: {}N)rf   extendrt   format)r   unexpected_membersrw   s      r   test_all_modules_are_expected_2r   t  s    2  $ 1099! D D!!"9"9'"B"BCCCC G ++162D+E+EG G 	GG Gr   c                     d } g }t           D ]"} | |          s|                    |           #|r"t          d                    |                    t          D ]7}	 t          |           # t          $ r |                    |           Y 4w xY w|r"t          d                    |                    t          j        d          5 }t          j	        dt                     t          j	        dt                     t          D ]"} | |          s|                    |           #	 ddd           n# 1 swxY w 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                 b    	 t          j        |            n# t          t          f$ r Y dS w xY wdS )NFT)r}   r~   ImportErrorAttributeError)r   s    r   check_importablez-test_api_importable.<locals>.check_importable  sI    	#K0000^, 	 	 	55	 ts    ,,z5Modules 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: {})rf   rs   rt   r   rg   evalr   warningscatch_warningsfilterwarningsDeprecationWarningImportWarningrh   )r   module_namesr   ws       r   test_api_importabler     s      L% - -,, 	-,,, B ,,2F<,@,@B B 	B . - -	- 	- 	- 	-,,,,,	-  ? ))/)=)=? ? 	? 
	 	-	-	- 13EFFFF=AAAA6 	1 	1K##K00 1##K000	11 1 1 1 1 1 1 1 1 1 1 1 1 1 1  8 ""(&"6"68 8 	88 8s%   A..BBA!D::D>D>Py_DEBUGzNumPy 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                     t           j                                        } 	 |                     d          }n&# t          $ r |                     dg           }Y nw xY wt          |          dk    s
J d            	 t          d |D                       }n# t          $ r t          d          dw xY w|
                                }d|j         d	}|t          j        u s
J |            dS )
z}
    Entry point for Array API implementation can be found with importlib and
    returns the numpy.array_api namespace.
    rT   )groupr   z%No entry points for 'array_api' foundc              3   0   K   | ]}|j         d k    |V  dS )r   Nri   )rQ   eps     r   	<genexpr>z-test_array_api_entry_point.<locals>.<genexpr>  s.      <<G););"););););<<r   z%'numpy' not in array_api entry pointsNznumpy entry point value 'z0' does not point to our Array API implementation)r}   metadataentry_pointsselectr   getr8   nextStopIterationrt   loadvaluer   rT   )epsxp_epsr   xpmsgs        r   test_array_api_entry_pointr     s%    

)
)
+
+C*+.. * * *
 b))* v;;???C???P<<v<<<<< P P PDEE4OP 
B	9BH 	9 	9 	9     #     s   7  AA;B B0r=   )$r0   	sysconfigr2   ro   r   r}   r   r   r(   pytestnumpy.testingr   rF   r   r   r,   markskipifparametrizer6   r;   r@   rC   rM   rf   rg   rh   rj   rr   ry   r   r   r   xfailget_config_varr   r:   r   r   <module>r      s   



                      ! ! ! ! ! !MMMM   FFF
 
 
 
$ $ $B G$<==)X!677  87 >=*- - -  
  
 FdN@  B B5 5B B5(& & &) & & &R   u u u6 u u u p  &  	F F F,  *1G 1G 1Gh-8 -8 -8` IZ((4	8   & & & & &s   5 ??