
    Khl                     .   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r
S SK	r	S SKJr  S SKr S SKrS*S jrS r\R$                  R'                  \SS9\R$                  R)                  SS/5      S	 5       5       rS
 rS rS r\R$                  R'                  \SL SS9S 5       rS V s/ s H  n SU -   PM
     sn r\R6                  S:  a  \S V s/ s H  n SU -   PM
     sn -  r/ SQrS V s/ s H  n SU -   PM
     sn r\R6                  S:  a  \S V s/ s H  n SU -   PM
     sn -  rS r\R6                  S:  a  S/rO/ r\R$                  RA                  S5      S 5       r!/ SQr"\R6                  S:  a  \"/ SQ-  r"S r#S r$\R$                  RK                  \RL                  " S5      S;  S S9S! 5       r'S" r(\R$                  RA                  S#5      S$ 5       r)S% r*S& r+S'\,4S( jr-S) r.g! \ a    Sr GNf = fs  sn f s  sn f s  sn f s  sn f )+    N)IS_WASMc                    Uc  U R                   n0 n[        U 5       Hl  nUS:X  a  M  [        X5      n[        US5      (       d  M)  [        US5      (       d  M<  UR                  U:w  d  MN  UR                  S-   UR                   -   X#'   Mn     U$ )zEReturns a mapping of all objects with the wrong __module__ attribute.core
__module____name__.)r   dirgetattrhasattrr   )modulemodule_nameresultsnameitems        M/var/www/html/env/lib/python3.13/site-packages/numpy/tests/test_public_api.py	check_dirr      s}    ooGF6>v$D,''GD*,E,EOO{2 OOc1DMMAGM  N    c                  8    SS0n [        [        5      nX:X  d   eg )Nrecarrayznumpy.rec.recarray)r   np)	allowlistbad_resultss     r   test_numpy_namespacer   &   s*     	(I B-K ###r   zcan't start subprocess)reasonr   testingc                     [         R                  SSU -   4n[        R                  " U5      nU(       a   eU [	        [
        5      ;   d   eg)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_importr#   1   sD     >>4!7$!>
?C$$S)F: 3r7??r   c                  ~    [        [        [        5      5      [        [        [        [        5      5      5      :X  d   eg)zSAssert that output of dir has only one "testing/tester"
attribute without duplicateN)lenr	   r   set r   r   test_dir_testingr(   H   s'     s2w<3s3r7|,,,,r   c                  F    [        [        R                  5      n U 0 :X  d   eg N)r   r   linalgr   s    r   test_numpy_linalgr-   N   s    BII&K"r   c                  F    [        [        R                  5      n U 0 :X  d   eg r*   )r   r   fftr,   s    r   test_numpy_fftr0   S   s    BFF#K"r   z#ctypes not available in this pythonc                      [         R                  " [        R                  R                  R
                  5      n [        U SS 5      nUb   S5       eg )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_EXPORTr:   X   sG     ;;rxx11::;D)40A9 5 4 59r   ) 	ctypeslib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.mrecords
polynomialzpolynomial.chebyshevzpolynomial.hermitezpolynomial.hermite_ezpolynomial.laguerrezpolynomial.legendrezpolynomial.polynomialrandomstringsr   ztesting.overridestypingztyping.mypy_pluginversionnumpy.)      )	distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilzdistutils.logzdistutils.system_info)
numpy.charznumpy.emath	numpy.rec),compatzcompat.py3k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_comparisonmatlib	matrixlibzmatrixlib.defmatrixzpolynomial.polyutilszrandom.mtrandzrandom.bit_generatorztesting.print_coercion_tables)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                 l    SU ;   d  SU ;   d  SU ;   a  gU [         ;   a  gU [        ;   a  gU [        ;   a  gg)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_unexpectedrU     s@    t|x4'8t+;~%%**r   znumpy.distutils.msvc9compilerz'ignore:.*np.compat.*:DeprecationWarningc                     / n [         R                  " [        R                  [        R                  S-   SS9 H5  u  pn[        U5      (       d  M  U[        ;  d  M$  U R                  U5        M7     U (       a  [        SU  35      eg)zp
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   rU   	SKIP_LISTappendAssertionError)modnames_modnameispkgs       r   test_all_modules_are_expectedrd   )  sy     H$22:<++:K;?AE !!gY&> OOG$A 9(DEE r   )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                      S n U " S5      n[          H  nUR                  U " U5      5        M     U(       a  [        SR                  U5      5      eg)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[         R                  " U 5      n[        US5      (       a  UR                  nO[	        U5      nU H|  nUR                  S5      (       a  M  U S-   U-   n[        [        X$5      [        R                  5      (       d  MM  [        U5      (       d  M_  U[        ;  d  Mk  UR                  U5        M~     U$ )N__all__ra   r   )	importlibimport_moduler   rg   r	   
startswith
isinstancer
   types
ModuleTyperU   SKIP_LIST_2r^   )mod_namemembersr   objnamesobjnamefullobjnames         r   find_unexpected_members@test_all_modules_are_expected_2.<locals>.find_unexpected_membersn  s    ((269%%~~H6{HG%%c**&nw6gf68H8HII$[11&k9#NN;7   r   numpyz5Found unexpected object(s) that look like modules: {}N)rQ   extendr_   format)rt   unexpected_membersrb   s      r   test_all_modules_are_expected_2rz   U  s[    2$ 19!!!"9'"BC "  ++162D+EG 	G r   c                     S n / n[          H#  nU " U5      (       a  M  UR                  U5        M%     U(       a  [        SR                  U5      5      e[         H  n [        U5        M     U(       a  [        SR                  U5      5      e[        R                  " SS9 n[        R                  " S[        S9  [        R                  " S[        S9  [         H#  nU " U5      (       a  M  UR                  U5        M%     SSS5        U(       a  [        S	R                  U5      5      eg! [         a    UR                  U5         M  f = f! , (       d  f       NR= f)
z
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                 ^     [         R                  " U 5        g! [        [        4 a     gf = f)NFT)rh   ri   ImportErrorAttributeError)r   s    r   check_importable-test_api_importable.<locals>.check_importable  s3    	##K0  ^, 		s    ,,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: {})rQ   r^   r_   rx   rR   evalr~   warningscatch_warningsfilterwarningsDeprecationWarningImportWarningrS   )r   module_namesr   ws       r   test_api_importabler     s7    L%,,, &  ,,2F<,@B 	B .	- .  ))/)=? 	? 
	 	 	-3EF=A6K#K00##K0 7 
.  ""(&"68 	8   	-,	- 
.	-s%   D,"AE-E,E
E
EPy_DEBUG)Nr   0zNumPy 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                  .   [         R                  " S5      [        R                  ;   n [        R
                  R                  5       n UR                  SS9n[        U5      S:X  a  U (       a  Sn[        U5      Seg [        S U 5       5      nUR                  S	:X  a  gUR                  5       nS
UR                   S3nU[         L d   U5       eg! [         a    UR                  S/ 5      n Nf = f! [         a    U (       a  Sn[        U5      Se gf = f)zl
Entry point for Array API implementation can be found with importlib and
returns the main numpy namespace.
platlib	array_api)groupr   z%No entry points for 'array_api' foundNc              3   H   #    U  H  oR                   S :X  d  M  Uv   M     g7f)rv   NrT   ).0eps     r   	<genexpr>-test_array_api_entry_point.<locals>.<genexpr>  s     <vG);""vs   "	"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   r7   rh   metadataentry_pointsselectr~   getr%   r_   nextStopIterationvalueloadrv   )numpy_in_sitepackagesepsxp_epsmsgr   xps         r   test_array_api_entry_pointr     s     &..y9R[[H



)
)
+C*+. 6{a 9C %4/<v<< 
xx$$ 		B
#BHH: .9 	9  ;;C  *
 b)*   9C %4/	s$   C <C2 C/.C/2DDc                      S n S nU " [         R                  5      nU" U5      nU " [         R                  " 5       5      nU" U5      nX#:X  d   SUR                  U5       35       eg)z|
Checks if `dir(np)` and `np.__all__` are consistent and return
the same content, excluding exceptions and private members.
c                 `    U  Vs1 s H  oR                  S5      (       a  M  UiM     sn$ s  snf )Nra   )rj   )
member_setms     r   _remove_private_membersFtest_main_namespace_all_dir_coherence.<locals>._remove_private_members  s#    %?:a\\#->:???s   ++c                 &    U R                  S15      $ )Nbool)
difference)r   s    r   _remove_exceptionsAtest_main_namespace_all_dir_coherence.<locals>._remove_exceptions  s    $$&
  	r   zMembers that break symmetry: N)r   rg   __dir__symmetric_difference)r   r   all_membersdir_memberss       r   %test_main_namespace_all_dir_coherencer     sm    
@
 *"**5K$[1K)"**,7K$[1K% '++K8
9	;%r   z:ignore:numpy.core(\.\w+)? is deprecated:DeprecationWarningc                     SSK Jn   [        [        R                  5       H  nUR                  S5      (       d  US;   d  SU 3[        ;   a  M.  [        [        R                  U5      n[        R                  " U5      (       aY  UnUn[        U5       HD  nUR                  S5      (       a  M  [        X55      n[        SU 3U/S9nU[        Xu5      L a  MD   e   M  U[        X5      L a  M   e   g)	zd
Check that all "semi-public" members of `numpy._core` are also accessible
from `numpy.core` shims.
r   Nra   )testsrC   rF   __znumpy.core.)fromlist)
numpy.corer   r	   r   r5   rj   rR   r
   inspectismodule
__import__)r   member_namemember	submodulesubmodule_namesubmodule_member_namesubmodule_membercore_submodules           r   test_core_shims_coherencer     s     288} ""3''22}%)??;/
 F##I(N),Y%(33D99#*9#L !+!.!1234"
 (7",    *8  WT7777E %r   c                  ~   SSK Jn JnJnJnJnJn  SSKJn  [        1n[        5       n[        5       n	/ n
[        /n[        U5      S:  Ga  UR                  5       n[        U5       GH  n[        X5      n[         R"                  " U5      (       ae  SUR$                  ;   aU  UR'                  S5      (       d?  SUR$                  ;  a/  US;  a)  X;  a$  UR)                  U5        UR+                  U5        M  [         R,                  " U5      (       d"  [/        X[        R0                  45      (       d  M  X;   a  UR$                  S;   a  UR$                  S:X  a  M  UR$                  S	:X  a#  UR$                  R'                  S
5      (       a  GM&  UR$                  S;   a  UR$                  S:X  a  GMI  UR$                  S:X  a  GM\  U
R)                  UR$                  UR$                  X   45        GM  UR+                  U5        UR$                  X'   GM     [        U5      S:  a  GM  AAA	[        U
5      S:X  d   U
5       eg)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)_ArrayFunctionDispatcherrv   ra   numpy._core)r>   r@   r   r   )absolutearccosarccosharcsinarcsinharctanarctan2arctanh
left_shiftright_shift	conjugateinvert	remainderdivideconcatenatepower	transposetrimcoefznumpy.polynomialaddequal	not_equalgreatergreater_equalless
less_equalnumpy.stringsrJ   N)rD   r   r   r   r   r   r   numpy._core._multiarray_umathr   r   r&   dictr%   popr	   r
   r   r   r   rj   r^   r   
isfunctionrk   ufunc)r   r   r   r   r   r   dispatched_functionvisited_modulesvisited_functionsfunctions_original_pathsduplicated_functionsmodules_queuer   r   r   s                  r   test_functions_single_locationr   :  s    =< /1TO14 ?Cf )+DM
m
q
 ""$v;KV1F   ((6??***3//V__4#EE-$$V,##F+ ""6**6#BCC.  , & 72  :5223EFF   +  !//_<  ,6  )//19; &))&17=,4a '	 m
q
 l 	?,D#$)?+??)r   c            	         [         /n [         1n[        5       n/ n[        U 5      S:  Ga  U R                  5       n[	        U5       GH  n[        XE5      n[        R                  " U5      (       ae  SUR                  ;   aU  UR                  S5      (       d?  SUR                  ;  a/  US;  a)  Xa;  a$  U R                  U5        UR                  U5        M  [        R                  " U5      (       a  M  [        US5      (       d  M  UR                  R                  S5      (       a  M  UR                  UR                  :w  d  M  Xb;  d  GM  UR                  S;   a  UR                  S:X  a  GM(  UR                  S	:X  a  UR                  S:X  d   UR                  S
:X  a  UR                  S:X  a  GMk  UR                  S;   a  GM~  UR                  [        UR                  UR                  UR                  S95        UR                  U5        GM     [        U 5      S:  a  GM  U(       a  [        U5      S:X  d   U5       eg g )Nr   rv   ra   r   )charr   r;   r>   r@   lapack_litemrecordsr   r   rA   rD   mtrandbit_generatorr   r   r   r   r   rK   )	BitGenerator	GeneratorMT19937PCG64	PCG64DXSMPhiloxRandomStateSFC64SeedSequence)Funcactualexpected)r   r&   r%   r   r	   r
   r   r   r   rj   r^   r   r   r   r   r   r   r   incorrect_entriesr   r   r   s          r   test___module___attributer    s   DMdO
m
q
 ""$v;KV1F   ((6??***3//V__4 $ 
 -$$V,##F+$$V,,
++OO..s33!!V__4/ ?? '  oo8 __
2v'7Q__0V__5S ?? '  !((#__%00!' "%%f-k ' m
q
 r $%*=,==* r   returnc                 Z   U R                   nU R                  nU R                  nX!R                  S5      S   :X  d   e[        R
                  U   n[        R                  " [        UR                  S5      U5      nXPL =(       d'    UR                  S5      =(       a    UR                   U:H  $ )Nr   znumpy.random)
__qualname__r   r   splitr   modules	functoolsreducer
   rj   )objqualnamer   r   r   
actual_objs         r   _check___qualname__r    s    H<<D..K>>#&r****[[%F!!'8>>#+>GJ 	
 "">2 0##x/r   c                     [         /n [         1n[        5       n/ n[        U 5      S:  Ga  U R                  5       n[	        U5       GHR  n[        XE5      n[        R                  " U5      (       ae  SUR                  ;   aU  UR                  S5      (       d?  US;  a9  SUR                  ;  a)  Xa;  a$  U R                  U5        UR                  U5        M  [        R                  " U5      (       a  M  [        US5      (       d  M  UR                  R                  S5      (       a  M  UR                  S5      (       a  M  [        U5      (       a  GM  Xb;  d  GM  UR                  [        UR                  UR                  S95        UR                  U5        GMU     [        U 5      S:  a  GM  U(       a  [        U5      S:X  d   U5       eg g )Nr   rv   ra   )r>   r@   r   r   rD   r   r;   r   r   r   )r  r	  )r   r&   r%   r   r	   r
   r   r   r   rj   r^   r   r   r  r   r  r
  s          r   test___qualname___attributer    s|   DMdO
m
q
 ""$v;KV1F   ((6??***3// $  V__4-$$V,##F+$$V,,
++OO..s33**3//'///!((%22V__
 "%%f-; ' m
q
 B $%*=,==* r   r*   )/r  r   r   r   rZ   rl   rh   r   r   rv   r   numpy.testingr   pytestr3   r}   r   r   markskipifparametrizer#   r(   r-   r0   r:   rQ   version_inforR   rS   rU   r]   r   rd   rn   rz   r   xfailget_config_varr   r   r   r   r  r   r  r  )ss   0r   <module>r$     s    
          ! 
$ G$<=)- . >*-

 FdN@  B5B5(!) ! !)1(Q, !) !D g
	
1 
	 	N -6 - -6x!| -6 - \ g8
:$8
1 8
:$ :z" g01II EFF GF, g  K1Gh-8` Z(>	8  ..b2 A)8)8Xp@f@>F $(>_  Fv!F	(-^:$s)   G4 3HH6HH4H ?H 