403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/numpy/f2py/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/numpy/f2py/tests/__pycache__/util.cpython-312.pyc
�

	�gG1��X�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
mZddlmZddlmZmZddlmZddlmZd!d�Zd	Zd
ZGd�d�Zese�Zej;�d
�Zd�Zd�Z d�Z!da"da#ejHdk(r=ee%�jLjLjLZ'e(e'jd��Z)d�Z*d�Z+d�Z,d�Z-e-gggdfd��Z.e-gggddfd��Z/Gd�de�Z0d!d�Z1Gd�d�Z2d�Z3e	jhd ��Z5y)"z�
Utility functions for

- building and importing modules on test time, using a temporary location
- detecting if compilers are present
- determining paths to tests

�N)�Path)�	asunicode)�temppath�IS_WASM)�
import_module)�MesonBackendc��tjdk(rtjdd��t	j
�}	tjj|d�}t|d�5}|jd�|jd|�d	��|rL|j|�d
|�d	��|j|�d|�d��|jd
|�d|�d|�d|�d�	�ddd�	tjgd�d|d��}jdk(tj |�S#1swY�IxYw#tj$rtjdd��Y�\wxYw#tj |�wxYw)N�win32z*No Fortran tests on Windows (Issue #25134)T)�allow_module_levelzmeson.build�wzproject('check_compilers')
zadd_languages('z')
z _compiler = meson.get_compiler('z_code = '''z'''
�_have_z
_feature =z_compiler.compiles(z_code, name: 'z feature check')
)�meson�setup�btmpF)�check�cwd�capture_outputz3meson not present, skipping compiler dependent testr)�sys�platform�pytest�skip�tempfile�mkdtemp�os�path�join�open�write�
subprocess�run�CalledProcessError�
returncode�shutil�rmtree)�lang�code_snippet�tmpdir�
meson_file�f�runmesons      �7C:\Python312\Lib\site-packages\numpy/f2py/tests/util.py�check_languager,sd��
�|�|�w�����@�UY�Z�
�
�
�
�F���W�W�\�\�&�-�8�
�
�*�c�
"�
	�a�
�G�G�2�3�
�G�G�o�d�V�4�0�1�����4�&� @���d�K�L����4�&��L�>��?�@�����T�F�*��f�/��v�6�#�f�$6�8��
	�	h�!�~�~�*���#�	�H��"�"�a�'��
�
�f��-
	�
	��$�,�,�	h��K�K�M�bf�g�	h��	�
�
�f��sI�,E%�,A5D)�!E%�*D5�E%�)D2�.E%�5*E"�E%�!E"�"E%�%E<z]
C Example Fortran 77 code
      PROGRAM HELLO
      PRINT *, 'Hello, Fortran 77!'
      END
z�
! Example Fortran 90 code
program hello90
  type :: greeting
    character(len=20) :: text
  end type greeting

  type(greeting) :: greet
  greet%text = 'hello, fortran 90!'
  print *, greet%text
end program hello90
c��eZdZd�Zd�Zy)�CompilerCheckerc�<�d|_d|_d|_d|_y)NF)�compilers_checked�has_c�has_f77�has_f90��selfs r+�__init__zCompilerChecker.__init__Ts��!&�����
�������c���|js�tjdk(s�tjj�5}|j
td�|j
tdt�|j
tdt�g}|dj�|_|dj�|_|dj�|_
ddd�d|_yyy#1swY�xYw)N�cygwin�c�fortranr��T)r0rr�
concurrent�futures�ThreadPoolExecutor�submitr,�fortran77_code�fortran90_code�resultr1r2r3)r5�executorr?s   r+�check_compilerszCompilerChecker.check_compilersZs����&�&�����1I��#�#�6�6�8�	
3�H��O�O�N�C�8��O�O�N�I�~�N��O�O�N�I�~�N���%�Q�Z�.�.�0��
�&�q�z�0�0�2���&�q�z�0�0�2���	
3�&*�D�"�2J�&�	
3�	
3�s�BC$�$C-N)�__name__�
__module__�__qualname__r6rF�r7r+r.r.Ss���
*r7r.c�"�tjS�N)�checkerr1rJr7r+�has_c_compilerrNms���=�=�r7c�"�tjSrL)rMr2rJr7r+�has_f77_compilerrPp����?�?�r7c�"�tjSrL)rMr3rJr7r+�has_f90_compilerrSsrQr7c�F�tjxrtjSrL)rMr3r2rJr7r+�has_fortran_compilerrUvs���O�O�/����0r7ir9z**/*.dllc���t�A	tjjt�	tjt�dayy#t$rY�)wxYw#t$rY�wxYwrL)�_module_dirrr�remove�
ValueErrorr#r$�OSErrorrJr7r+�_cleanupr[�sa����	��H�H�O�O�K�(�	��M�M�+�&������	��	���	��	�s"�#A	�A�		A�A�	A$�#A$c���t�gtj�atjt
�ttjvr$tjjdt�tS)Nr)	rWrr�atexit�registerr[rr�insertrJr7r+�get_module_dirr`�sF�����&�&�(������!��c�h�h�&��H�H�O�O�A�{�+��r7c�x�t�dtz}tdz
a|tjvrt	d��|S)Nz_test_ext_module_%dr<z%Temporary module name already in use.)r`�_module_numr�modules�RuntimeError)�names r+�get_temp_module_namerf�s;���� �;�.�D��1��K��s�{�{���B�C�C��Kr7c�<���i���fd�}�j|_|S)Nc���t||f�}|�vr	�|i|���|<�|}t|t�r|�|S#t$r}|�|<�d}~wwxYwrL)�repr�	Exception�
isinstance)�a�kw�key�e�ret�func�memos     ��r+�wrapperz_memoize.<locals>.wrapper�sj����A�r�7�m���d�?�
� �!�N�r�N��S�	��3�i���c�9�%��I��
��
�
���S�	���
�s�8�	A�A�A)rG)rqrsrrs` @r+�_memoizert�s ���
�D���}�}�G���Nr7c
��dtj�d�}t�}t�st	j
d�g}g}|D]�}	tjj|	�std|	z��tjj|tjj|	��}
tj|	|
�|j|
�tjj|
�\}}|dvs��|j|
���|sJ�|�
t�}g}
d|vrd|vrdg}
d	d
|g|z|
z|z}|ddgz
}|r	|d
g|zz
}|r	|dg|zz
}t
j �}	t
j"|�tj$d	|g|z}t'j(|t&j*t&j,��}|j/�\}}|j0dk7rtd|dd�dt3|�����	t
j"|�|D]}	t
j4|	��	tj6dk(rst8j;t=j<tjj|dj?|����t'j@gd�t8z�tC|�S#t
j"|�|D]}	t
j4|	��wxYw)zH
    Compile and import a f2py module, built from the given files.

    zimport sys; sys.path = z&; import numpy.f2py; numpy.f2py.main()�No Fortran compiler availablez%s is not a file)�.f90z.f95�.fz.c�.pyfNz--freethreading-compatiblez--no-freethreading-compatiblez-cz-mz	--backendrzskip:zonly:)�stdout�stderrrzRunning f2py failed: ��
r9z{:s}*)z/usr/bin/rebasez
--databasez--obliviousz	--verbose)"rrr`rUrrr�isfilerdr�basenamer#�copyfile�append�splitextrf�getcwd�chdir�
executabler�Popen�PIPE�STDOUT�communicater"r�unlinkr�_module_list�extend�glob�format�
check_callr)�source_files�optionsr�only�module_name�code�d�dst_sources�f2py_sources�fn�dst�base�ext�gil_options�	f2py_optsr�cmd�p�out�errs                    r+�build_moduler��s���%�S�X�X�L�0V�W�D���A��!����3�4��K��L��	%���w�w�~�~�b�!��1�B�6�7�7��g�g�l�l�1�b�g�g�.�.�r�2�3������C� ����3���G�G�$�$�S�)�	��c��6�6�����$�	%���<���*�,���K�#�7�2�7V�^e�7e�3�4���t�[�)�G�3�k�A�L�P�I�
�+�w�'�'�I���g�Y��%�%�	���g�Y��%�%�	�
�)�)�+�C��
������~�~�t�T�*�Y�6�����S�$.�O�O�$.�$5�$5�
7���=�=�?���S��<�<�1��� #�A�B���3�� 9�:�
:��	����
��	�B��I�I�b�M�	��|�|�x��	����I�I�b�g�g�l�l�1�g�n�n�[�&A�B�C�	
�	���I��
�	
���%�%��)	����
��	�B��I�I�b�M�	�s
�/BK�3Lc���|�d}t|��5}t|d�5}|j|�ddd�t|g||||��cddd�S#1swY�#xYw#1swYyxYw)z6
    Compile and import Fortran code using f2py.

    Nrx)�suffixr�r�rr�r�)rrrr�)�source_coder�rr�r�r�rr)s        r+�
build_coder�sv���~���	��	 �5�D�
�$��_�	!��
�G�G�K� �	!��T�F�$+�!%�!%�(3�	5�5�5�	!�	!��5�5�s!�
A�A�A�A	�A�A'c�$��eZdZ�fd�Zd�Z�xZS)�SimplifiedMesonBackendc�$��t�|�|i|��yrL)�superr6)r5�args�kwargs�	__class__s   �r+r6zSimplifiedMesonBackend.__init__0s���
���$�)�&�)r7c�p�|j|j�|j|j�yrL)�write_meson_build�	build_dir�	run_mesonr4s r+�compilezSimplifiedMesonBackend.compile3s$�����t�~�~�.����t�~�~�&r7)rGrHrIr6r��
__classcell__)r�s@r+r�r�/s
���*�'r7r�c	��t�stjd�t�}|�
t	�}tdid|�d|�d|j
dg��d|�d|j
dg��d|j
dg��d|j
dg��d	|j
d	g��d
|j
d
g��d|j
dg��d|j
dg��d
|j
d
g��d|j
dg��d|j
dg��d|j
dd��d|j
di���}|j�tjjd|�d|j���t|�S)z1
    Build a module via Meson and import it.
    rv�
modulename�sources�
extra_objectsr��include_dirs�library_dirs�	libraries�
define_macros�undef_macros�
f2py_flags�
sysinfo_flags�fc_flags�
flib_flags�setup_flags�remove_build_dirF�	extra_datr�/rJ)
rUrrr`rfr��getr�rrr_�meson_build_dirr)r�r�r�r��backends     r+�build_mesonr�8s��� �!����3�4�� �I���*�,��%�������j�j��"�5���	�
�Z�Z���3���Z�Z���3�
��*�*�[�"�-���j�j��"�5���Z�Z���3���:�:�l�B�/���j�j��"�5�����J��+���:�:�l�B�/���J�J�}�b�1�� ���$6��>�� �*�*�[�"�-�!�G�&�O�O���H�H�O�O�A�)��A�g�&=�&=�%>�?�@���%�%r7c�Z�eZdZdZdZgZgZgZdZdZ	dZ
dZdZe
d��Zed��Zd�Zy)�F2PyTestNrxc�x�t|�}d|jjdd�d�d|j�d�S)N�_�.r<����_ext_module)�typerH�rsplitrG)r5�clss  r+r�zF2PyTest.module_nameqs;���4�j���3�>�>�(�(��Q�/��3�4�A�c�l�l�^�;�O�Or7c���tjdk(rtjd�t	�t
_t�t
_t�t
_
t�t
_y)Nr
z)Fails with MinGW64 Gfortran (Issue #9673))
rrrrrNr��_has_c_compilerrP�_has_f77_compilerrS�_has_f90_compilerrU�_has_fortran_compiler)r�s r+�setup_classzF2PyTest.setup_classvsG���<�<�7�"��K�K�C�D�#1�#3�� �%5�%7��"�%5�%7��"�)=�)?��&r7c�B�|j�y|jr|jng}|jr|j|j�td�|D��}td�|D��}td�|D��}|r!|jstjd�|r!|jstjd�|r!|jstjd�|j�Rt|j|j|j|j|j|j��|_|j�Ht|j|j|j|j|j��|_yy)	Nc3�PK�|]}t|�jd���� y�w)rxN��str�endswith��.0r�s  r+�	<genexpr>z(F2PyTest.setup_method.<locals>.<genexpr>�s����?�2��B��(�(��.�?���$&c3�PK�|]}t|�jd���� y�w)rwNr�r�s  r+r�z(F2PyTest.setup_method.<locals>.<genexpr>������A�R��B��(�(��0�A�r�c3�PK�|]}t|�jd���� y�w)ryNr�r�s  r+r�z(F2PyTest.setup_method.<locals>.<genexpr>�r�r�z No Fortran 77 compiler availablez No Fortran 90 compiler availablerv)r�rr�r�r�r�)�moduler�r�r�r��anyr�rrr�r�r�r�r�r�r�)r5�codes�	needs_f77�	needs_f90�	needs_pyfs     r+�setup_methodzF2PyTest.setup_methods5���;�;�"�� $������"���9�9��L�L����%��?��?�?�	��A�5�A�A�	��A�5�A�A�	��T�3�3��K�K�:�;��T�3�3��K�K�:�;��T�7�7��K�K�7�8��9�9� �$��	�	�����Y�Y��Y�Y��{�{� �,�,�
�D�K��<�<�#�&��������Y�Y��Y�Y� �,�,��D�K�$r7)rGrHrIr�r�r�rr�r�r�r�r�r��propertyr��classmethodr�r�rJr7r+r�r�ese���D��G��G�
�D�
�D�
�F�
�F��O�����
�P��P��@��@�%r7r�c��ttjj�jj�}|j|�SrL)r�numpy�f2py�__file__�parent�resolve�joinpath)rlr�s  r+�getpathr��s5���U�Z�Z�
 �
 �!�(�(�0�0�2�A��1�:�:�q�>�r7c#��K�tj�}tj|�	d��tj|�y#tj|�wxYw�wrL)rrrr�)r�curpaths  r+�	switchdirr��s<�����h�h�j�G��H�H�T�N��
�
�����������s�*A!�A�A!�A�A!rL)6�__doc__r�rrrrr#r]r�
contextlibr��concurrent.futuresr>�pathlibr�numpy._utilsr�
numpy.testingrr�	importlibr�numpy.f2py._backends._mesonrr,rBrCr.rMrFrNrPrSrUrWrbrr�r��NUMPY_INSTALL_ROOT�listr�r[r`rfrtr�r�r�r�r�r��contextmanagerr�rJr7r+�<module>rsc����	�
���
�
�
�����"�+�#�4��>����*�*�,���G��������1������<�<�8���h��.�.�5�5�<�<���*�/�/�
�;�<�L���	��2
�')����L&�
�L&�^
������5�
�5�6'�\�'�%&�Z?�?�N������r7

Youez - 2016 - github.com/yon3zu
LinuXploit