+
    eil  c                   s>   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RI
t^ RIHt  ^ RItRR ltR t]	P$                  P'                  ]RR7      ]	P$                  P)                  RR.4      R	 4       4       tR
 tR tR t]	P$                  P'                  ]RJ RR7      R 4       t. RNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NRNR*NR+NR,NR-N U u. uF  p R.V ,           NK  	  up t]P6                  R8  d!   ]R U u. uF  p R.V ,           NK  	  up ,          t. ROt. R/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWN U u. uF  p R.V ,           NK  	  up t]P6                  R8  d   ]. RXNRYNRZNR[NR\NR]NR^NR_NR`NRaNRbNRcNRdNReNRfNRgNRhNRiNRjNRkNRlNRmNRnNRoNRpNRqNRrNRsNRtNRuNRvNRwNRxNRyNRzNR{NR|NR}NR~NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRN U u. uF  p R.V ,           NK  	  up ,          tR t]P6                  R8  d   . tMR.tR t . ROt!]P6                  R8  d   ]!. RO,          t!R t"R t#]	P$                  PI                  ]PJ                  ! R4      R9  RR7      R 4       t&R t']	P$                  PQ                  R4      R 4       t)R t*R t+R R lt,R t-R#   ] d    Rt ELi ; iu up i u up i u up i u up i )    N)IS_WASMc                s8   Vf   V P                   p/ p\        V 4       Fx  pVR8X  d   K  \        W4      p\        VR4      '       g   K+  \        VR4      '       g   K?  VP                  V8w  g   KR  VP                  R,           VP                   ,           W#&   Kz  	  V# )zEReturns a mapping of all objects with the wrong __module__ attribute.core
__module____name__.)r   dirgetattrhasattrr   )modulemodule_nameZresultsnameZitems   &&   B/usr/lib64/python3.14/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                  s<    R R/p \        \        4      pW8X  g   Q hR# )recarrayznumpy.rec.recarrayN)r   np)Z	allowlistbad_results     r   test_numpy_namespacer   &   s*     	(I B-K ###r   zcan't start subprocess)Zreasonr   testingc                s    \         P                  RRV ,           3p\        P                  ! V4      pV'       d   Q hV \	        \
        4      9   g   Q hR# )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)sysZ
executable
subprocessZcheck_outputr   r   )r   ZexeZresults   &  r   test_import_lazy_importr   1   sD     >>4!7$!>
?C$$S)F: 3r7??r   c                 s    \        \        \        4      4      \        \        \        \        4      4      4      8X  g   Q hR# )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                  J    \        \        P                  4      p V / 8X  g   Q hR # N)r   r   linalgr       r   test_numpy_linalgr    N   s    BII&K"r   c                  r   r   )r   r   fftr   r   r   test_numpy_fftr"   S   s    BFF#K"r   z#ctypes not available in this pythonc                  s    \         P                  ! \        P                  P                  P
                  4      p \        V R R4      pVe   Q R4       hR# )Ztest_not_exportedNzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)ctypesZCDLLr   _coreZ_multiarray_tests__file__r   )ZcdllZfr   r   test_NPY_NO_EXPORTr&   X   sG     ;;rxx11::;D)40A9 5 4 59r   Z	ctypeslibZdtypesZ
exceptionsf2pyr!   Z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.polynomialZrandomstringsztesting.overridestypingztyping.mypy_pluginZversionnumpy.Z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matlibZ	matrixlibzmatrixlib.defmatrixzpolynomial.polyutilszrandom.mtrandzrandom.bit_generatorztesting.print_coercion_tablesz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                s    RV 9  ;'       dF    RV 9  ;'       d9    RV 9  ;'       d,    V \         9  ;'       d    V \        9  ;'       d
    V \        9  # )z%Check if this needs to be considered.z._z.testsz.setup)PUBLIC_MODULESPUBLIC_ALIASED_MODULESPRIVATE_BUT_PRESENT_MODULESr      &r   is_unexpectedr2     sm     	D 	4 	4XT1 	4 	4hd6J 	4 	4&	4 	4..	4 	4 33	r   znumpy.distutils.msvc9compilerc                 s$   . p \         P                  ! \        P                  \        P                  R,           RR7       F7  w  rp\        V4      '       g   K  V\        9  g   K&  V P                  V4       K9  	  V '       d   \        RV  24      hR# )zp
Test that we don't add anything that looks like a new public module by
accident.  Check is based on filenames.
r   N)ZpathZprefixZonerrorzFound unexpected modules: )	pkgutilZwalk_packagesr   Z__path__r   r2   	SKIP_LISTappendAssertionError)Zmodnames_modnameZispkg       r   test_all_modules_are_expectedr:     sy     H$22:<++:K;?AE !!gY&> OOG$A 9(DEE r   c                 s    R p V ! R4      p\          F  pVP                  V ! V4      4       K  	  V'       d   \        RV 24      hR# )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   . p\         P                  ! V 4      p\        VR 4      '       d   VP                  pM\	        V4      pV F  pVP                  R4      '       d   K  V R,           V,           p\        \        W$4      \        P                  4      '       g   KW  \        V4      '       g   Kj  V\        9  g   Kw  VP                  V4       K  	  V# )__all__r7   r   )	importlibimport_moduler   r;   r   
startswith
isinstancer   typesZ
ModuleTyper2   SKIP_LIST_2r5   )Zmod_nameZmembersr	   ZobjnamesZobjnameZfullobjname   &     r   find_unexpected_membersZ@test_all_modules_are_expected_2.<locals>.find_unexpected_membersa  s    ((269%%~~H6{HG%%c**&nw6gf68H8HII$[11&k9#NN;7   r   numpyz3Found unexpected object(s) that look like modules: N)r-   Zextendr6   )rC   Zunexpected_membersr8   s      r   test_all_modules_are_expected_2rE   H  sY    2$ 19!!!"9'"BC "  ));(<> ? 	? r   c                 s   R p . p\          F$  pV ! V4      '       d   K  VP                  V4       K&  	  V'       d   \        RV 24      h\         F  p \	        V4       K  	  V'       d   \        RV 24      h\        P                  ! RR7      ;_uu_ 4       p\        P                  ! R\        R7       \        P                  ! R\        R7       \         F$  pV ! V4      '       d   K  VP                  V4       K&  	  RRR4       V'       d   \        R	V 24      hR#   \
         d    TP                  T4        K  i ; i  + '       g   i     LK; i)
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                 sd     \         P                  ! V 4       R#   \        \        3 d     R # i ; i)FT)r<   r=   ImportErrorAttributeError)r
   r1   r   check_importableZ-test_api_importable.<locals>.check_importable  s3    	##K0  ^, 		s    //z3Modules in the public API that cannot be imported: z/Modules in the public API that were not found: T)recordZalways)ZcategoryNzNModules that are not really public but looked public and can not be imported: )r-   r5   r6   r.   ZevalrG   warningsZcatch_warningsfilterwarningsZDeprecationWarningZImportWarningr/   )rH   Zmodule_namesr
   Zwr9   r   test_api_importablerL   |  s9    L%,,, &  **69 : 	: .	- .  ''3n6 7 	7 
	 	 	-	-3EF=A6K#K00##K0 7 
.  @ ,~/ 0 	0   	-,	- 
.	-s%   DAE*ED?>D?E	Z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                 s   \         P                  ! R4      \        P                  9   p \        P
                  P                  4       pVP                  RR7      p\        V4      ^ 8X  d   V '       d   Rp\        V4      RhR#  \        R V 4       4      pTP                  R8X  d   R# TP                  4       pR	TP                   R
2pT\        J g   Q T4       hR#   \         d    T '       d   Rp\        T4      Rh R# i ; i)zl
Entry point for Array API implementation can be found with importlib and
returns the main numpy namespace.
ZplatlibZ	array_api)Zgroupz%No entry points for 'array_api' foundNc              3   sJ   "   T F  qP                   R 8X  g   K  Vx  K  	  R# 5i)rD   Nr0   )Z.0ep   & r   Z	<genexpr>Z-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)	sysconfigZget_pathr   r%   r<   ZmetadataZentry_pointsZselectr   r6   ZnextZStopIterationZvalueZloadrD   )Znumpy_in_sitepackagesZepsZxp_epsZmsgrM   Zxps         r   test_array_api_entry_pointrP     s      &..y9R[[H



)
)
+CZZkZ*F
6{a 9C %4/<v<< 
xx$$ 		B
#BHH: .9 	9  ;;'   9C %4/	s   C C>,C>=C>c                 s    R p R pV ! \         P                  4      pV! V4      pV ! \         P                  ! 4       4      pV! V4      pW#8X  g   Q RVP                  V4       24       hR# )z|
Checks if `dir(np)` and `np.__all__` are consistent and return
the same content, excluding exceptions and private members.
c                 s`    V  Uu0 uF  qP                  R 4      '       d   K  VkK  	  up# u upi )r7   )r>   )
member_setZmrN   r   _remove_private_membersZFtest_main_namespace_all_dir_coherence.<locals>._remove_private_members  s%    %?:a\\#->:???s   ++c                 s&    V P                  R 04      # Zbool)Z
difference)rQ   r1   r   _remove_exceptionsZAtest_main_namespace_all_dir_coherence.<locals>._remove_exceptions  s    $$&
  	r   zMembers that break symmetry: N)r   r;   Z__dir__Zsymmetric_difference)rR   rT   Zall_membersZdir_membersr9   r   %test_main_namespace_all_dir_coherencerU     sm    
@
 *"**5K$[1K)"**,7K$[1K% '++K8
9	;%r   z:ignore:numpy.core(\.\w+)? is deprecated:DeprecationWarningc                 sP   ^ RI Hp  \        \        P                  4       EF  pVP                  R4      '       g   VR9   g   RV 2\        9   d   K2  \        \        P                  V4      p\        P                  ! V4      '       d   VP                  '       dw   VP                  P                  e_   TpTp\        V4       FI  pVP                  R4      '       d   K  \        W54      p\        RV 2V.R7      pV\        Wu4      J d   KI  Q h	  K  V\        W4      J d   EK  Q h	  R# )zd
Check that all "semi-public" members of `numpy._core` are also accessible
from `numpy.core` shims.
Nr7   r,   Z__znumpy.core.)Zfromlist)testsr*   )Z
numpy.corer   r   r   r$   r>   r.   r   inspectismoduleZ__spec__ZoriginZ
__import__)r   member_namememberZ	submoduleZsubmodule_nameZsubmodule_member_nameZsubmodule_memberZcore_submodules           r   test_core_shims_coherencer[     s
    288} ""3''22}%)??;/ V$$FOO$:$:$FI(N),Y%(33D99#*9#L !+!.!1234"
 (7",    *8  WT7777O %r   c                 sv   ^ RI Hp  ^ RIHp ^ RIHp \        0p\        4       p/ p. p\        .p\        V4      ^ 8  Ed   VP                  4       p\        V4       EF  p	\        W4      p
\        P                  ! V
4      '       dk   RV
P                  9   dZ   V	P                  R4      '       gC   RV
P                  9  d2   V	R9  d+   W9  d%   VP!                  V
4       VP#                  V
4       K  \        P$                  ! V
4      '       g$   \'        W\        P(                  34      '       g   K  W9   d   V
P                  R9   d   VP                  R8X  d   K  V
P                  R8X  d%   VP                  P                  R4      '       d   EK3  V
P                  R9   d   VP                  R	8X  d   EKX  VP                  R
8X  d   EKl  VP!                  V
P                  VP                  WZ,          34       EK  VP#                  V
4       VP                  WZ&   EK  	  EK  ???\        V4      ^ 8X  g   Q V4       hR# )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.
)Callable)Any)_ArrayFunctionDispatcherrD   r7   numpy._coreZtrimcoefznumpy.polynomialnumpy.strings
numpy.charN)r'   r(   r   rV   )ZabsoluteZarccosZarccoshZarcsinZarcsinhZarctanZarctan2ZarctanhZ
left_shiftZright_shiftZ	conjugateZinvertZ	remainderZdivideZconcatenateZpowerZ	transposeaddZequalZ	not_equalZgreaterZgreater_equalZlessZ
less_equal)Zcollections.abcr\   r+   r]   Znumpy._core._multiarray_umathr^   r   r   r   popr   r   rW   rX   r   r>   r5   rc   Z
isfunctionr?   Zufunc)r\   r]   Zdispatched_functionvisited_modulesvisited_functionsZfunctions_original_pathsZduplicated_functionsmodules_queuer	   rY   rZ   s              r   test_functions_single_locationrh   +  s    ) /1TO14 ?A )+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 'd 	?,D#$)?+??)r   c            	      s   \         .p \         0p\        4       p. p\        V 4      ^ 8  Ed    V P                  4       p\	        V4       EF  p\        WE4      p\        P                  ! V4      '       dk   RVP                  9   dZ   VP                  R4      '       gC   RVP                  9  d2   VR9  d+   Wa9  d%   V P                  V4       VP                  V4       K  \        P                  ! V4      '       d   K  \        VR4      '       g   K  VP                  P                  R4      '       d   K  VP                  VP                  8w  g   EK  Wb9  g   EK  VP                  R9   d   VP                  R8X  d   EK6  VP                  R8X  d   VP                  R8X  g#   VP                  R8X  d   VP                  R8X  d   EK}  VP                  R9   d   VP                  R	8X  d   EK  VP                  R9   d   EK  VP                  R
VP                  RVP                  RVP                  /4       VP                  V4       EK  	  EK0  V'       d   \        V4      ^ 8X  g   Q V4       hR# R# )r    rD   r7   r_   r   r`   r   rI   	numpy.recznumpy.ctypeslibZFuncZactualZexpectedN)Zcharr   r'   r(   Zlapack_liteZmrecordsr   rV   r)   r+   ZmtrandZbit_generatorrb   )Zc_longZ
c_longlong)	ZBitGeneratorZ	GeneratorZMT19937ZPCG64Z	PCG64DXSMZPhiloxZRandomStateZSFC64ZSeedSequence)r   r   r   rd   r   r   rW   rX   r   r>   r5   rc   r   r   rg   re   rf   Zincorrect_entriesr	   rY   rZ             r   test___module___attributerl     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 OO'??OO'88 ?? '  !(( &"3"3"FOO "%%f-y '| $%*=,==* r   c                s$    V ^8  d   QhR\         /# )i   ZreturnrS   )Zformats   "r   __annotate__rm     s      t r   c                 s   V P                   pV P                  pV P                  pW!P                  R 4      R,          8X  g   Q h\        P
                  V,          p\        P                  ! \        VP                  R 4      V4      pWPJ ;'       gY    \        VR4      ;'       dE    \        V R4      ;'       d1    VP                  V P                  8H  ;'       d    VP                   V8H  # )r   Z__get__Z__self__i)
__qualname__r   r   Zsplitr   Zmodules	functoolsZreducer   r   )ZobjZqualnamer   r
   r	   Z
actual_objrB   r   "_check_correct_qualname_and_modulerp     s    H<<D..K>>#&r****[[%F!!'8>>#+>GJ 	
 	
 J	* 0 0wsJ/G 0 0!!S^^30 0##x/r   c            	      s   \         .p \         0p\        4       p. p\        V 4      ^ 8  Ed   V P                  4       p\	        V4       EFo  p\        WE4      p\        P                  ! V4      '       dk   RVP                  9   dZ   VP                  R4      '       gC   VR	9  d<   RVP                  9  d+   Wa9  d%   V P                  V4       VP                  V4       K  \        P                  ! V4      '       d   K  \        VR4      '       g   K  VP                  P                  R4      '       d   K  VP                  R4      '       d   EK  \        V4      '       d   EK  Wb9  g   EK!  VP                  RVP                   RV 2RVP                   RVP                   2/4       VP                  V4       EKr  	  EK  V'       d   \        V4      ^ 8X  g   Q V4       hR# R# )
r    rD   r7   r_   r   Zfound_atZ:Z
advertisesN>   rV   r+   )r   r   r   rd   r   r   rW   rX   r   r>   r5   rc   r   rp   r   rn   rj   rk   r   *test___qualname___and___module___attributerq     s    DMdO
m
q
 ""$v;KV1F   ((6??***3//#66V__4-$$V,##F+$$V,,
++OO..s33**3//6v>>/!(("v&7q$F$):):(;1V=P=P<Q&R "%%f-7 ': $%*=,==* r   r   )i   i   )Z	distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilzdistutils.logzdistutils.system_info)ra   znumpy.emathri   )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.warnings)Nr    Z0).ro   r<   rW   r3   r   r   rO   r@   rJ   ZpytestrD   r   Znumpy.testingr   r#   rF   r   r   ZmarkZskipifZparametrizer   r   r    r"   r&   r-   Zversion_infor.   r/   r2   r4   r:   rA   rE   rL   ZxfailZget_config_varrP   rU   rK   r[   rh   rl   rp   rq   )Zss   0r   <module>rr      s        
       !
$ G$<=)- . >*-

 FdN@  B5B5(!)!)!) !) 	!)
 
!) 
!) !) !) !) !) !) !) !) !) !)  	!!)" #!)$ %!)& '!)( )!)* +!), -!). /!)0 1!)2 3!)4 5!)6 7!)8 9!): ;!)< =!)> ?!)@ A!) ! !)1(Q,, !) !D g
	
1 
	 	N *6*6
*6 *6 	*6
 *6 *6 *6 *6 *6 *6 *6 *6 *6 *6 *6  !*6" #*6$ %*6& '*6( )*6* +*6, -*6. /*60 1*62 3*64 5*66 7*68 9*6: ;*6< =*6> ?*6@ A*6B C*6D E*6F G*6H I*6J K*6L M*6N O*6P Q*6R $S*6 * *6x!|| *6 * V g8
$8
(8
 "8
 &	8

  8
 )8
 *8
 &8
 +8
 *8
 )8
 .8
 *8
 '8
 08
  (!8
" )#8
$ (%8
& -'8
( -)8
* 0+8
, &-8
. &/8
0 18
2 "38
4 "58
6 )78
8 &98
: );8
< .=8
> &?8
@ &A8
B 'C8
D &E8
F (G8
H (I8
J 'K8
L &M8
N 'O8
P *Q8
R %S8
T %U8
V &W8
X 'Y8
Z *[8
\ &]8
^ '_8
`  a8
b %c8
d )e8
f %g8
h 'i8
j +k8
l &m8
n &o8
:$8
1 8
:$ :z wI01IF, g  K1?h-0` Z(>	8  ''T2 A.8.8br@jG>T&)>U  Fv!F	&*X:$s)   K; 9L$LL2L;	LL