+
    ʇi@                        ^ 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
HtHt ^RIHt  ! R R]P                  4      t ! R R4      t ! R	 R
4      t ! R R]P                  4      t ! R R]P                  4      t ! R R4      t ! R R]P                  4      t ! R R4      t ! R R]P                  4      t ! R R]P                  4      t]P4                  P6                   ! R R]P                  4      4       t ! R R4      t ! R R]P                  4      t ! R R ]P                  4      t ! R! R"4      t  ! R# R$4      t!]P4                  P6                   ! R% R&]P                  4      4       t"R# )'    N)crackfortran)markinnerspacesnameargspattern)utilc                   R   a  ] tR t^t o ]P
                  ! RRRR4      .tR tRtV t	R# )TestNoSpacetestssrcr   z	gh15035.fc                   \         P                  ! . RO\         P                  R7      p\         P                  ! . RO\         P                  R7      pV P                  P	                  V4       \         P
                  ! W^,           4      '       g   Q hV P                  P                  W!.4       \         P
                  ! W^,           4      '       g   Q hV P                  P                  R4      R8X  g   Q hR# )   )dtype23   2N)r         )nparrayfloat64modulesubballclosesubct0)selfkws   &  w/Users/max/.openclaw/workspace/postharvest/merge_env/lib/python3.14/site-packages/numpy/f2py/tests/test_crackfortran.pytest_moduleTestNoSpace.test_module   s    HHYbjj1HHYbjj1{{1!e$$$$! {{1!e$$$${{~~d#t+++     N)
__name__
__module____qualname____firstlineno__r   getpathsourcesr   __static_attributes____classdictcell____classdict__s   @r   r   r      s(      ||GUNKHIG, ,r    r   c                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )TestPublicPrivatec                   \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          pRVR,          R,          R,          9   g   Q hRVR,          R,          R,          9  g   Q hRVR,          R	,          R,          9   g   Q hRVR,          R	,          R,          9  g   Q hRVR,          R
,          R,          9  g   Q hRVR,          R
,          R,          9   g   Q hR# )r	   r
   r   zprivatemod.f90privatevarsaattrspecpublicbsetaNr   r&   r   strlen)r   fpathmods   &  r   test_defaultPrivate%TestPublicPrivate.test_defaultPrivate    s    We^=MN''U53x1}}!fCK,Z8888s6{3/
;;;;CK,Z8888s6{3/
;;;;FF 3J ????3v;v.z::::r    c                   \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          pRVR,          R,          R,          9   g   Q hRVR,          R,          R,          9  g   Q hRVR,          R	,          R,          9  g   Q hRVR,          R	,          R,          9   g   Q hR
# )r	   r
   r   zpublicmod.f90r/   r0   r1   r2   r3   r5   Nr6   r   tmp_pathr9   r:   s   &&  r   test_defaultPublic$TestPublicPrivate.test_defaultPublic,   s    We^_M''U53x1}}!fCK,Z8888s6{3/
;;;;FF 3J ????3v;v.z::::r    c                   \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          R,          p\        VR,          R,          4      RR08X  g   Q h\        VR	,          R,          4      R
R08X  g   Q h\        VR,          R,          4      R
08X  g   Q hR# )r	   r
   r   zaccesstype.f90r0   r1   r2   r/   zbind(c)b_r3   cN)r   r&   r   r7   r8   set)r   r?   r9   r:   tts   &&   r   test_access_type"TestPublicPrivate.test_access_type6   s    We^=MN''U53x1}}VF^2c7:&'Iy+AAAA2d8J'(Xy,AAAA2c7:&'H:555r    c                    \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q h\        P
                  ! V4      pRV9  g   Q hR# )r	   r
   r   zgh23879.f90barN)r   r&   r   r7   r8   crack2fortran)r   r?   r9   r:   pyfs   &&   r   test_nowrap_private_proceedures1TestPublicPrivate.test_nowrap_private_proceedures?   sZ    We^]K''U53x1}}((-Cr    r!   N)
r"   r#   r$   r%   r;   r@   rG   rM   r(   r)   r*   s   @r   r-   r-      s     
;;6   r    r-   c                   ,   a  ] tR t^Ft o R tR tRtV tR# )TestModuleProcedurec                   \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          pRV9   d   \	        VR,          4      ^	8X  g   Q hVR,          ^,          R,          R8X  g   Q hRVR,          ^,          9   g   Q hVR,          ^,          R,          RR	.8X  g   Q hVR,          ^,          R,          R
8X  g   Q hRVR,          ^,          9   g   Q hVR,          ^,          R,          R.8X  g   Q hVR,          ^,          R,          R8X  g   Q hRVR,          ^,          9   g   Q hVR,          ^,          R,          RR.8X  g   Q hR# )r	   r
   r   zoperators.f90bodynamezoperator(.item.)implementedbyitem_int	item_realzoperator(==)items_are_equalzassignment(=)get_intget_realNr6   r>   s   &&  r   test_moduleOperators(TestModuleProcedure.test_moduleOperatorsG   sc   We^_M''U53x1}}!f}S[!1Q!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.3D2EEEE6{1~f%888#f+a.0006{1~o.
#$ 	$ $r    c                h   \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          pVR,          R,          R,          R.8X  g   Q hVR,          R,          R,          R	.8X  g   Q hVR,          R
,          R,          R	.8X  g   Q hR# )r	   r
   r   zpubprivmod.f90r0   r1   r2   r/   r4   r3   r5   Nr6   r>   s   &&  r   test_notPublicPrivate)TestModuleProcedure.test_notPublicPrivateY   s    We^=MN''U53x1}}!f6{3
+	}<<<6{3
+|;;;6{6":.8,>>>r    r!   N)r"   r#   r$   r%   rZ   r]   r(   r)   r*   s   @r   rP   rP   F   s     $$? ?r    rP   c                   X   a  ] tR t^ct o ]P
                  ! RRRR4      .tR tR tRt	V t
R# )	TestExternalr	   r
   r   z	gh17859.fc                T    R  pV P                   P                  V4      pV^{8X  g   Q hR# )c                     V ^{,           # {   r!   xs   &r   incr5TestExternal.test_external_as_statement.<locals>.incrh       s7Nr    N)r   external_as_statementr   rg   rs   &  r   test_external_as_statement'TestExternal.test_external_as_statementg   (    	 KK--d3Cxxr    c                T    R  pV P                   P                  V4      pV^{8X  g   Q hR# )c                     V ^{,           # rc   r!   re   s   &r   rg   5TestExternal.test_external_as_attribute.<locals>.incro   ri   r    N)r   external_as_attributerk   s   &  r   test_external_as_attribute'TestExternal.test_external_as_attributen   ro   r    r!   N)r"   r#   r$   r%   r   r&   r'   rm   rt   r(   r)   r*   s   @r   r`   r`   c   s+     ||GUNKHIG r    r`   c                      a  ] tR t^vt o ]P
                  ! RRRR4      ]P
                  ! RRRR4      .tR tR tRt	V t
R	# )
TestCrackFortranr	   r
   r   z
gh2848.f90zcommon_with_division.fc                P    V P                   P                  ^^4      pVR8X  g   Q hR# )r   N)r   r   )r   gh2848)r   rl   s   & r   test_gh2848TestCrackFortran.test_gh2848|   s$    KKq!$F{{r    c                f    \        V P                  P                  P                  4      ^8X  g   Q hR# )   N)r8   r   mortmpctmpr   s   &r   test_common_with_division*TestCrackFortran.test_common_with_division   s%    4;;%%**+r111r    r!   N)r"   r#   r$   r%   r   r&   r'   rz   r   r(   r)   r*   s   @r   rw   rw   v   s@     ||GUNLI||GUN<TUG2 2r    rw   c                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )TestMarkinnerspacesc                D    . ROpV F  p\        V4      V8X  d   K  Q h	  R# )a N)r   z aza b cz'abcdefghij'r   )r   	test_listis   &  r   test_do_not_touch_normal_spaces3TestMarkinnerspaces.test_do_not_touch_normal_spaces   s$    9	A"1%*** r    c                N    \        R 4      R8X  g   Q h\        R4      R8X  g   Q hR# )za 'b c' \' \'za 'b@_@c' \' \'za "b c" \" \"za "b@_@c" \" \"Nr   r   s   &r   test_one_relevant_space+TestMarkinnerspaces.test_one_relevant_space   s,    015HHHH/04FFFFr    c                N    \        R 4      R8X  g   Q h\        R4      R8X  g   Q hR# )za 'b c" " d' eza 'b@_@c"@_@"@_@d' eza "b c' ' d" eza "b@_@c'@_@'@_@d" eNr   r   s   &r   test_ignore_inner_quotes,TestMarkinnerspaces.test_ignore_inner_quotes   s,    126NNNN126NNNNr    c                N    \        R 4      R8X  g   Q h\        R4      R8X  g   Q hR# )za 'b c' 'd e'za 'b@_@c' 'd@_@e'za "b c" "d e"za "b@_@c" "d@_@e"Nr   r   s   &r   test_multiple_relevant_spaces1TestMarkinnerspaces.test_multiple_relevant_spaces   s+    /3FFFF/04HHHHr    r!   N)
r"   r#   r$   r%   r   r   r   r   r(   r)   r*   s   @r   r   r      s"     +
GOI Ir    r   c            	       ,  a ] tR t^t oRtRt]P                  ! R4      t. ROt	R.t
]	]
,           tRt]! ]4       Fp  w  tt]P!                  R4       U u. uF$  p RV 9   d   V P!                  R4      ^ ,          MRNK&  	  up t]]P%                  ]]R	P'                  ]4      R
7      ,          tKr  	  ]P*                  P-                  R]4      ]P*                  P.                  R 4       4       t]P*                  P-                  R]4      R 4       tRtVtR# u up i )TestDimSpecan  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
    z2*n:3*n*n+2*n ,:1z, )countdimspecfirstr   c                    V P                   P                  V4      p\        V P                  R V 24      pR F   pV! V4      w  rVVP                  V8X  d   K   Q h	  R# )get_arr_size_Nr   r   r         )all_dimspecsindexgetattrr   size)r   r   r   get_arr_sizenszr1   s   &&     r   test_array_sizeTestDimSpec.test_array_size   sV     !!''0t{{mE7,CD A OEB66R<< !r    c                :   V P                   P                  V4      p\        V P                  R V 24      p\        V P                  RV 24      pR FG  pV! V4      w  rgWP                  9   d
   V! Wu4      pMV! V4      pV! V4      w  rWi8X  d   K@  Q WXWi34       h	  R# )r   get_inv_arr_size_Nr   )r   r   r   r   nonlinear_dimspecs)r   r   r   r   get_inv_arr_sizer   r   r1   n1sz1_s   &&         r   test_inv_array_sizeTestDimSpec.test_inv_array_size   s     !!''0t{{mE7,CD"4;;2CE70KL A OEB111 &a+ &a( ""%FC9.qb..9 !r    r!   N)r   z2*nz2:nzn/2z5 - n/2z3*n:20zn*(n+1):n*(n+5)z2*n, n)r"   r#   r$   r%   __doc__suffixtextwrapdedentcode_templatelinear_dimspecsr   r   code	enumerater   r   splitlstformatjoinpytestmarkparametrizeslowr   r   r(   r)   )dr+   s   0@r   r   r      s    < FOO % 	M&O **"%77LD#L1w?F}}S?QR?Q!3!8Q4?QR$$))C. % 
 	
 2 [[Y5[[   6  [[Y5/ 6/' Ss   *Dr   c                   &   a  ] tR t^t o R tRtV tR# )TestModuleDeclarationc                    \         P                  ! R RRR4      p\        P                  ! \        V4      .4      p\	        V4      ^8X  g   Q hV^ ,          R,          R,          R,          R8X  g   Q hR# )	r	   r
   r   zfoo_deps.f90r0   abar=zbar('abar')Nr6   r>   s   &&  r   test_dependencies'TestModuleDeclaration.test_dependencies   s\    We^^L''U53x1}}1vf~f%c*m;;;r    r!   N)r"   r#   r$   r%   r   r(   r)   r*   s   @r   r   r      s     < <r    r   c                   &   a  ] tR tRt o R tRtV tR# )TestEvali  c                    \         P                  pV! R / 4      R 8X  g   Q hV! R/ 4      R8X  g   Q hV! RR^R^/4      R8X  g   Q hV! R/ 4      R8X  g   Q hR	# )
123z12 + 315za + br1   r4   3z"123"z'123'N)r   _eval_scalar)r   eval_scalars   & r   test_eval_scalarTestEval.test_eval_scalar  sj    "//5"%...8R(D0007S!S!$45<<<7B'7222r    r!   N)r"   r#   r$   r%   r   r(   r)   r*   s   @r   r   r     s     3 3r    r   c                   h   a  ] tR tRt o ]P
                  P                  R. RO4      R 4       tRtV t	R# )TestFortranReaderi  encodingc                   VR V R2,          pVP                  RVR7      ;_uu_ 4       pVP                  R4       RRR4       \        P                  ! \        V4      .4      pV^ ,          R,          R8X  g   Q hR#   + '       g   i     LI; i)input_with_z_encoding.f90r   )r   zd
                     subroutine foo()
                     end subroutine foo
                     NrS   foo)openwriter   r7   )r   r?   r   f_pathffr:   s   &&&   r   test_input_encoding%TestFortranReader.test_input_encoding  sy     k(=AA[[x[00BHH   1
 ''V61vf~&&& 10s   A<<B	r!   N)asciizutf-8zutf-16zutf-32)
r"   r#   r$   r%   r   r   r   r   r(   r)   r*   s   @r   r   r     s-     [[ZCE	'E	'r    r   c                      a  ] tR tRt o ]P
                  ! RRRR4      .t]P                  P                  ]
P                  P                  R4      RJ RR	7      R
 4       tRtV tR# )TestUnicodeCommenti   r	   r
   r   zunicode_comment.f90charset_normalizerNz7test requires charset_normalizer which is not installed)reasonc                <    V P                   P                  ^4       R# r   N)r   r   r   s   &r   test_encoding_comment(TestUnicodeComment.test_encoding_comment$  s    
 	r    r!   )r"   r#   r$   r%   r   r&   r'   r   r   skipif	importlib	find_specr   r(   r)   r*   s   @r   r   r      s^     ||GUN<QRSG[[		!	!"6	74	?H  	r    r   c                   j   a  ] tR tRt o ]P
                  P                  R.. RO4      R 4       tRtV t	R# )TestNameArgsPatternBacktrackingi,  	adversaryc                   ^p^p^^rT\        WE4       F  pW,          p\        V4       F  p. p	\        V4       FY  p\        P                  ! 4       p
\        P                  ! V4      pV	P                  \        P                  ! 4       V
,
          4       K[  	  \        P                  ! V	4      R8  d   K  Q h	  X'       d   Q hVR,           p\        P                  ! V4      '       d   K  Q h	  R# )zHaddress ReDOS vulnerability:
https://github.com/numpy/numpy/issues/23338g?z@)@N)rangetimeperf_counterr   searchappendr   median)r   r   trials_per_batchbatches_per_regex
start_repsend_repsiirepeated_adversaryr   timesr   mtchgood_version_of_adversarys   &&           r   !test_nameargspattern_backtrackingATestNameArgsPatternBacktracking.test_nameargspattern_backtracking-  s     !2H
-B!* ,-/0A**,B*112DEDLL!2!2!4r!9: 1 yy'#--- . O8 );U(B%"))*CDDDD' .r    r!   N))z
@)@bind@(@)z#@)@bind                         @(@)z@)@bind foo bar baz@(@)
r"   r#   r$   r%   r   r   r   r  r(   r)   r*   s   @r   r   r   ,  s2     [[		
EEr    r   c                      a  ] tR tRt o ]P
                  ! RRRR4      .t]P                  P                  R 4       t
RtV tR# )	TestFunctionReturniP  r	   r
   r   zgh23598.f90c                L    V P                   P                  ^^4      ^8X  g   Q hR# r   )r   
intproductr   s   &r   test_function_rettype(TestFunctionReturn.test_function_rettypeS  s#     {{%%a+r111r    r!   N)r"   r#   r$   r%   r   r&   r'   r   r   r   r  r(   r)   r*   s   @r   r  r  P  s8     ||GUNMJKG[[2 2r    r  c                   &   a  ] tR tRt o R tRtV tR# )TestFortranGroupCountersiY  c                    \         P                  ! R RRR4      p \        P                  ! \        V4      .4       R#   \         d   pQ RT 24       hRp?ii ; i)r	   r
   r   z	gh23533.fz0'crackfortran.crackfortran' raised an exception N)r   r&   r   r7   	Exception)r   r9   excs   &  r   test_end_if_comment,TestFortranGroupCounters.test_end_if_commentZ  sT    We^[I	S%%s5zl3 	SRLSERR5	Ss    = A
AAr!   N)r"   r#   r$   r%   r  r(   r)   r*   s   @r   r  r  Y  s     S Sr    r  c                   &   a  ] tR tRt o R tRtV tR# )TestF77CommonBlockReaderic  c                @   \         P                  ! R RRR4      p\        P                  ! \        P
                  ! 4       4      ;_uu_ 4       p\        P                  ! \        V4      .4      pRRR4       RXP                  4       9  g   Q hR#   + '       g   i     L); i)r	   r
   r   zgh22648.pyfNMismatch)	r   r&   
contextlibredirect_stdoutioStringIOr   r7   getvalue)r   r?   r9   stdout_f2pyr:   s   &&   r   test_gh22648%TestF77CommonBlockReader.test_gh22648d  sj    We^]K''66+++SZL9C 7!5!5!7777 76s   !BB	r!   N)r"   r#   r$   r%   r  r(   r)   r*   s   @r   r  r  c  s     8 8r    r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	TestParamEvalij  c                    R pR\         P                  R\         P                  R\         P                  /pR^R^^^^/R^^^^^^//pRp\         P                  ! WW4R7      pV^R	^R
/8X  g   Q hR# )z(/3.14, 4./)kindselected_int_kindselected_real_kinddpintparamarraynestedz(2)r   gQ	@g      @Nr   
_kind_func_selected_int_kind_func_selected_real_kind_func
param_evalr   vg_paramsparamsr   rets   &     r   test_param_eval_nested$TestParamEval.test_param_eval_nestedl  s    L33#\%I%I$l&K&KM ?Q1aLQ1aA.0%%a6Kq$3''''r    c                    R pR\         P                  R\         P                  R\         P                  /p/ pRp\         P                  ! WW4R7      pVR^^ ^^^/8X  g   Q hR# )z(/ 6, 3, 1 /)r   r!  r"  z(-1:1)r&  Nr'  r,  s   &     r   !test_param_eval_nonstandard_range/TestParamEval.test_param_eval_nonstandard_rangew  si    L33#\%I%I$l&K&KM %%a6Kr1aAq))))r    c           	         R pR\         P                  R\         P                  R\         P                  /p/ pRp\        P
                  ! \        \         P                  WVVR7       R# )6r   r!  r"  r   r&  Nr   r(  r)  r*  r   raises
ValueErrorr+  r   r-  r.  r/  r   s   &    r   test_param_eval_empty_range)TestParamEval.test_param_eval_empty_range  sY    L33#\%I%I$l&K&KM j,"9"91%	'r    c                    R pR\         P                  R\         P                  R\         P                  /p/ p\         P                  ! WVRR7      pVR 8X  g   Q hR# )z3.14_dpr   r!  r"  Nr&  r'  )r   r-  r.  r/  r0  s   &    r   test_param_eval_non_array_param-TestParamEval.test_param_eval_non_array_param  sY    L33#\%I%I$l&K&KM %%a64Hir    c           	         R pR\         P                  R\         P                  R\         P                  /p/ pRp\        P
                  ! \        \         P                  WVVR7       R# )z*reshape((/ (i, i=1, 250) /), (/5, 10, 5/))r   r!  r"  z(0:4, 3:12, 5)r&  Nr9  r<  s   &    r   test_param_eval_too_many_dims+TestParamEval.test_param_eval_too_many_dims  sY    8L33#\%I%I$l&K&KM "j,"9"91%	'r    r!   N)r"   r#   r$   r%   r1  r5  r=  r@  rC  r(   r)   r*   s   @r   r  r  j  s#     	(*' ' 'r    r  c                   X   a  ] tR tRt o ]P
                  ! RRRR4      .tR.tR tRt	V t
R	# )
TestLowerF2PYDirectivei  r	   r
   r   zgh27697.f90z--lowerc                    \         P                  ! \        R R7      ;_uu_ 4       pV P                  P                  P                  R 4       RRR4       R#   + '       g   i     R# ; i)zaborting directly)matchN)r   r:  r;  r   utilsmy_abort)r   r  s   & r   test_no_lower_fail)TestLowerF2PYDirective.test_no_lower_fail  s?    ]]:-@AASKK&&':; BAAAs   &AA&	r!   N)r"   r#   r$   r%   r   r&   r'   optionsrK  r(   r)   r*   s   @r   rF  rF    s-     ||GUNMJKGkG< <r    rF  )#r  r   r  r   r   r   numpyr   
numpy.f2pyr   numpy.f2py.crackfortranr   r   r   r   F2PyTestr   r-   rP   r`   rw   r   r   r   r   r   r   r   r   r   r  r  r  r  rF  r!   r    r   <module>rR     sG     	     # D ,$-- ,%  % N? ?:4== &2t}} 2I I*d/$-- d/N< <3t}} 3' '   "E "EH2 2St}} S8 82' 2'h <T]] < <r    