1j~ddlZddlZddlZddlmZmZmZmZddlZdZdZ d dZ dZ dZ e d kr e dSdS) N)TypeApi GlobalVarApi FunctionApi BoolValuesApia #if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE) typedef struct { PyObject_HEAD npy_bool obval; } PyBoolScalarObject; extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type; extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type; extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2]; %s #else #if defined(PY_ARRAY_UNIQUE_SYMBOL) #define PyArray_API PY_ARRAY_UNIQUE_SYMBOL #endif #if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY) extern void **PyArray_API; #else #if defined(PY_ARRAY_UNIQUE_SYMBOL) void **PyArray_API; #else static void **PyArray_API=NULL; #endif #endif %s #if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT) static int _import_array(void) { int st; PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath"); PyObject *c_api = NULL; if (numpy == NULL) { return -1; } c_api = PyObject_GetAttrString(numpy, "_ARRAY_API"); Py_DECREF(numpy); if (c_api == NULL) { PyErr_SetString(PyExc_AttributeError, "_ARRAY_API not found"); return -1; } if (!PyCapsule_CheckExact(c_api)) { PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object"); Py_DECREF(c_api); return -1; } PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL); Py_DECREF(c_api); if (PyArray_API == NULL) { PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is NULL pointer"); return -1; } /* Perform runtime check of C API version */ if (NPY_VERSION != PyArray_GetNDArrayCVersion()) { PyErr_Format(PyExc_RuntimeError, "module compiled against "\ "ABI version 0x%%x but this version of numpy is 0x%%x", \ (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion()); return -1; } if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) { PyErr_Format(PyExc_RuntimeError, "module compiled against "\ "API version 0x%%x but this version of numpy is 0x%%x . "\ "Check the section C-API incompatibility at the "\ "Troubleshooting ImportError section at "\ "https://numpy.org/devdocs/user/troubleshooting-importerror.html"\ "#c-api-incompatibility "\ "for indications on how to solve this problem .", \ (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion()); return -1; } /* * Perform runtime check of endianness and check it matches the one set by * the headers (npy_endian.h) as a safeguard */ st = PyArray_GetEndianness(); if (st == NPY_CPU_UNKNOWN_ENDIAN) { PyErr_SetString(PyExc_RuntimeError, "FATAL: module compiled as unknown endian"); return -1; } #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN if (st != NPY_CPU_BIG) { PyErr_SetString(PyExc_RuntimeError, "FATAL: module compiled as big endian, but " "detected different endianness at runtime"); return -1; } #elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN if (st != NPY_CPU_LITTLE) { PyErr_SetString(PyExc_RuntimeError, "FATAL: module compiled as little endian, but " "detected different endianness at runtime"); return -1; } #endif return 0; } #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } } #define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } } #define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } } #endif #endif z{ /* These pointers will be stored in the C-object for use in other extension modules */ void *PyArray_API[] = { %s }; Fc*d}tj|d|z}tj|d|z}||f}tj}|s(t j|tjtgs|St|||S)Nmultiarray_apiz__%s.hz__%s.c) ospathjoin numpy_apirgenapishould_rebuild__file__do_generate_api) output_dirforcebasenameh_filec_filetargetssourcess q/builddir/build/BUILD/cloudlinux-venv-1.0.11/venv/lib64/python3.11/site-packages/numpy/core/generate_numpy_api.py generate_apirsH W\\*h&9 : :F W\\*h&9 : :FvG&G *&/):Lh9WXX*))) Nc j|d}|d}|d}|d}|d}|d}|dd}g} g} g} tj|} tj| tjd|} d}i}| D]R}|j}||d}||dd}t |j|||j|j|||j<S|D]\}}|\}}t||||||< |D]!\}}|d}t|||||<"|D]@\}}|d}t|dkrdn|d}t||d||||<At|t| krkt|}t| }td||z ||z g} tj| D]\}}||}| || || |t,d | d | fz}tj||t2d | z}tj|||S) Nr NUMPY_API PyArray_API PyTypeObjectzNMultiarray API size mismatch - index has extra keys {}, dict has extra keys {} z, )r merge_api_dictscheck_api_dictget_api_functionsnamer return_typeargsitemsrrlenrsetkeysAssertionErrorformat order_dictappenddefine_from_array_api_stringarray_api_defineinternal_define h_templater write_file c_template)rr header_filer global_varsscalar_bool_values types_apimultiarray_funcsr module_listextension_list init_listmultiarray_api_index numpyapi_listapi_namemultiarray_api_dictfr&index annotationsvaltype internal_type keys_dict keys_indexapi_itemss rrrs!*K QZF!*K  IqzQQQZNKNI"1.AA .///,[-=??MH DDv &q)&t,QRR0 &1!&%23-23&('D'DAF##!&&((NN c t$0udH$M$MD!!'--//II cA$1$x$H$HD!!__&&BB cA!$SQCF $+ %=%B%BD!! 3';#<#<<<+002233 -224455  > VJ*I ,B C C   N()=>>77 e&t,hCCEEFFF2244555833556666 dii ,,dii.G.GHHA k1%%% UZZ ***A fa   NrcVtj}|ddtd|ddtd|}t jt j|j }t|dS)Nz-oz--outdirzPath to the output directory)rGhelpz-iz--ignorezKAn ignored input - may be useful to add a dependency between custom targets) argparseArgumentParser add_argumentstr parse_argsr r r getcwdoutdirr)parserr( outdir_abss rmainrXs  $ & &F    +     1      Dbikk4;77Jr__main__)F)r rOr rrrrr r4r6rrrX__name__rrr\s  ::::::::::::w t  GGGT, zDFFFFFr