bgAddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z  ddl Z n #e $rdZ YnwxYwd!dZdZe je de jddgd Zd Zd Zd Ze je dud dZddDZgdZddDZdZgdZdZgdZdZdZ e j!e"ej#dde j!ej$dduddZ%e jdgdd Z&dS)"N)IS_WASMc||j}i}t|D]R}t||}t|dr0t|dr |j|kr|jdz|jz||<S|S)zEReturns a mapping of all objects with the wrong __module__ attribute.N __module____name__.)rdirgetattrhasattrr)module module_nameresultsnameitems n/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/tests/test_public_api.py check_dirrso GF BBvt$$ D, ' ' BGD*,E,E BO{22 Oc1DMAGDM Ncidddddddddd d d d d ddddddddddddddddddd d!d"d#d$}|}tt}||ksJdS)%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_newdocadd_newdoc_ufunc byte_boundsznumpy.lib.utils.byte_boundscompare_chararraysz/numpy.core._multiarray_umath.compare_chararrays deprecateznumpy.lib.utils.deprecatedeprecate_with_docz"numpy.lib.utils.deprecate_with_docdispznumpy.lib.function_base.dispfastCopyAndTransposez1numpy.core._multiarray_umath.fastCopyAndTransposeget_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_evalset_string_functionz)numpy.core.arrayprint.set_string_function show_configznumpy.__config__.showznumpy.lib.utils.show_runtimeznumpy.lib.utils.who) show_runtimewho)rnp) undocumented allowlist bad_resultss rtest_numpy_namespacer+!s$ME ; L  4  O  0 B .  S ? 4 2 2 0 J!" .#$7$'L,IB--K ) # # # # # #rzcan't start subprocess)reasonrtestingctjdd|zf}tj|}|rJ|t t vsJdS)aMake 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')rexeresults rtest_import_lazy_importr5AsL >4!7$!> ?C  $S ) )F: 3r77??????rctttttttksJdS)zWAssert that output of dir has only one "testing/tester" attribute without duplicateN)lenrr'setrrtest_dir_testingr:Xs; s2ww<<3s3r77||,, , , , , , ,rcHttj}|iksJdSN)rr'linalgr*s rtest_numpy_linalgr?^s(BI&&K "      rcHttj}|iksJdSr<)rr'fftr>s rtest_numpy_fftrBcs(BF##K "      rz#ctypes not available in this pythonctjtjjj}t |dd}| JddS)Ntest_not_exportedzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)ctypesCDLLr'core_multiarray_tests__file__r )cdllfs rtest_NPY_NO_EXPORTrLhsC ;rw09 : :D)400A 99499999rcg|]}d|zSznumpy.r9.0ss r rR~s()))1(Q,)))r)( array_apizarray_api.linalg ctypeslib distutilszdistutils.cpuinfozdistutils.exec_commandzdistutils.misc_utilz distutils.logzdistutils.system_infodocz doc.constantsz doc.ufuncsdtypes exceptionsf2pyrAlibz lib.formatz lib.mixinszlib.recfunctionsz lib.scimathzlib.stride_tricksr=maz ma.extrasz ma.mrecordsmatlib polynomialzpolynomial.chebyshevzpolynomial.hermitezpolynomial.hermite_ezpolynomial.laguerrezpolynomial.legendrezpolynomial.polynomialrandomr-ztesting.overridestypingztyping.mypy_pluginversion)z numpy.charz numpy.emathz numpy.reccg|]}d|zSrNr9rOs rrRrRs.sssx!|sssr)rcompatz compat.py3kconftestrGzcore.arrayprintzcore.defchararrayzcore.einsumfunczcore.fromnumericzcore.function_basezcore.getlimitsz core.memmapzcore.multiarrayz core.numericzcore.numerictypeszcore.overridesz core.recordszcore.shape_basez core.umathzcore.umath_testszdistutils.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.unixccompilerz f2py.auxfuncszf2py.capi_mapsz f2py.cb_rulesz f2py.cfuncszf2py.common_ruleszf2py.crackfortranz f2py.diagnosez f2py.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_tablescdd|vsd|vsd|vrdS|tvrdS|tvrdS|tvrdSdS)z%Check if this needs to be considered.z._z.testsz.setupFT)PUBLIC_MODULESPUBLIC_ALIASED_MODULESPRIVATE_BUT_PRESENT_MODULESrs r is_unexpectedrj's[ t||x4''8t+;+;u ~u %%%u ***u 4r) 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.distutils.msvc9compilercg}tjtjtjdzdD]3\}}}t |r|t vr||4|rtd|dS)z| Test that we don't add anything that looks like a new public module by accident. Check is based on filenames. rN)pathprefixonerrorzFound unexpected modules: ) pkgutil walk_packagesr'__path__rrj SKIP_LISTappendAssertionError)modnames_modnameispkgs rtest_all_modules_are_expectedryJs H$2 :<+:K;?AAA%%7E  ! ! %gY&>&> OOG $ $ $FD(DDEEEFFr)z numpy.mathznumpy.distutils.log.sysznumpy.distutils.log.loggingznumpy.distutils.log.warningsznumpy.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.macd}|d}tD] }|||!|r"td|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) cng}tj|}t|dr|j}nt |}|D]t}|ds]|dz|z}t t||tj r-t|r|tvr| |u|S)N__all__rvr) importlib import_moduler r|r startswith isinstancer types ModuleTyperj SKIP_LIST_2rs)mod_namemembersr objnamesobjname fullobjnames rfind_unexpected_membersz@test_all_modules_are_expected_2..find_unexpected_memberss(22 69 % % #~HH6{{H 8 8G%%c** 8&nw6 gfg668HII8$[118&k99#NN;777rnumpyz5Found unexpected object(s) that look like modules: {}N)rfextendrtformat)runexpected_membersrws rtest_all_modules_are_expected_2rvs2$1099!DD!!"9"9'"B"BCCCCG++162D+E+EGG GGGrcd}g}tD]"}||s||#|r"td|tD]7} t |#t $r||Y4wxYw|r"td|tjd5}tj dttj dttD]"}||s||# dddn #1swxYwY|r"td |dS) 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). cb tj|n#ttf$rYdSwxYwdS)NFT)r}r~ ImportErrorAttributeError)r s rcheck_importablez-test_api_importable..check_importablesI   #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)recordalways)categoryNzPModules that are not really public but looked public and can not be imported: {}) rfrsrtrrgevalrwarningscatch_warningsfilterwarningsDeprecationWarning ImportWarningrh)r module_namesr ws rtest_api_importablersL%--  ,, -    , , ,B,,2F<,@,@BB B.--  -      - - -    , , , , , -?))/ )=)=?? ?   - - -13EFFFF=AAAA6 1 1K##K00 1##K000 11111111111111118""(&"6"688 888s%A..BB A!D::D>D>_built_with_mesonz:Meson does not yet support entry points via pyproject.tomlPy_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/19800ctj} |d}n&#t$r|dg}YnwxYwt |dks Jd td|D}n#t$rtddwxYw| }d|j d }|tj us J|dS) z} Entry point for Array API implementation can be found with importlib and returns the numpy.array_api namespace. rS)grouprz%No entry points for 'array_api' foundc30K|]}|jdk |VdS)rNri)rPeps r z-test_array_api_entry_point..s.<<G););"););););<rs+   !!!!!!MMMM FFF    $$$@G$<==)--.->=*---   FdN@BB55BB5()))))))Xsss6sssl&    FFF, ,1G1G1Gh-8-8-8` GBM.// IIZ((4 8&& &:"7"7"788!!88!!!s 5??