
    gi                        d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl	m
Z
 g dZej        Zej        Zi Zg ZdZd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d  Z)d! Z*d" Z+d# Z,d$ Z-d% Z.d& Z/d' Z0d( Z1d) Z2d* Z3d+ Z4d, Z5d- Z6d. Z7d/ Z8d0 Z9d1 Z:d2 Z;d3 Z<d4 Z=d5 Z>d6 Z?d7 Z@d8 ZAd9 ZBd: ZCd; ZDd< ZEd= ZFd> ZGd? ZHd@ ZIdA ZJdB ZKdC ZLdD ZMdE ZNdF ZOdG ZPdH ZQdI ZRdJ ZSdK ZTdL ZUdM ZVdN ZWdO ZXdP ZYdQ ZZdR Z[dS Z\dT Z]dU Z^dV Z_eQdWeRdXeSdYeTdZeWd[eVd\eLd]e[d^e]d_e^d`e_daiZ`db Zadc Zbdd Zcde Zddf Zedg Zfdh Zgdi Zhdj Zidk Zjdl Zkdm Zldn Zm G do dpen          Zo G dq dr          Zpds Zqdt Zrdu Zsdv Ztdw ZuddxZvdy Zwi fdzZxd{ Zyd| Zzd} Z{d~ Z|d Z}d Z~d Zd Zd ZddZd Zi fdZ ej        dej                  j        Z ej        dej                  j        Zd Zd ZddZdS )a9  
Auxiliary functions for f2py2e.

Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
Copyright 2011 -- present NumPy Developers.
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) LICENSE.

NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
    N)reduce   )__version__)cfuncs)errmess)_
applyrules	debugcapi
dictappendr   gentitlegetargs2getcallprotoargumentgetcallstatementgetfortrannamegetpymethoddef
getrestdocgetusercodegetusercode1getdimensionhasbodyhascallstatement	hascommonhasexternalshasinitvaluehasnotehasresultnoteisallocatableisarrayisarrayofstringsischaracterischaracterarrayischaracter_or_characterarray	iscomplexiscstyledirectiveiscomplexarrayiscomplexfunctioniscomplexfunction_warnisdoubleisdummyroutine
isexternal
isfunctionisfunction_wrapisint1isint1array	isintegerisintent_aux
isintent_cisintent_callbackisintent_copyisintent_dictisintent_hideisintent_inisintent_inoutisintent_inplaceisintent_nothideisintent_outisintent_overwrite	islogicalislogicalfunctionislong_complexislong_doubleislong_doublefunctionislong_longislong_longfunctionismoduleismoduleroutine
isoptional	isprivate
isvariable
isrequired	isroutineisscalarissigned_long_longarrayisstringisstringarrayisstring_or_stringarrayisstringfunctionissubroutineget_f2py_modulenameissubroutine_wrapisthreadsafe
isunsignedisunsigned_charisunsigned_chararrayisunsigned_long_longisunsigned_long_longarrayisunsigned_shortisunsigned_shortarrayl_andl_notl_oroutmessreplaceshow
stripcommathrow_errorisattr_valuegetuseblocksprocess_f2cmap_dictcontainscommonc                 ~    t                               dd          r!t          j                            |            d S d S )Nverboser   )optionsgetsysstdoutwrite)ts    _/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/numpy/f2py/auxfuncs.pyr]   r]   <   s>    {{9a   
     c                     dt           v S )Ncapi)debugoptionsvars    rn   r	   r	   A   s    \!!ro   c                 B    d| v o| d         dk    ot          |            S Ntypespec	characterr)   rs   s    rn   _ischaracterrz   E   0     ZK!? #ro   c                 B    d| v o| d         dk    ot          |            S rv   ry   rs   s    rn   	_isstringr}   J   r{   ro   c                 (    t          |           od| vS Ncharselectorrz   rs   s    rn   r!   r!   O   s    :s!::ro   c                 @    t          |           ot          |            S Nr!   r   rs   s    rn   r   r   S   s    (--Bgcll2BBro   c                 >    t          |           ot          |           S r   r   rs   s    rn   r    r    W   s    (-->'#,,>ro   c                 (    t          |           od| v S r   r   rs   s    rn   rM   rM   [   s    63!66ro   c                 @    t          |           ot          |            S r   rM   r   rs   s    rn   rK   rK   _   s    "3''<,<<ro   c                 >    t          |           ot          |           S r   r   rs   s    rn   rL   rL   c   s    "3''8GCLL8ro   c                 D    t          |           o| d         d         dk    S )N	dimensionz(*))rL   rs   s    rn   r   r   g   s&     ?#k"22"6%"??ro   c                 *    d| v ot          |            S Nr   ry   rs   s    rn   r   r   m   s    #5joo"55ro   c                 ^    t          |           pt          |           pt          |            S r   )r   rK   r)   rs   s    rn   rI   rI   q   s'    @@CAAro   c                 N    t          |           o|                     d          dv S Nrw   )complexzdouble complexrI   ri   rs   s    rn   r"   r"   u   s,    C== @77:"??@ro   c                 R    t          |           o|                     d          dk    S )Nrw   logicalr   rs   s    rn   r;   r;   z   $    C===SWWZ00I==ro   c                 R    t          |           o|                     d          dk    S )Nrw   integerr   rs   s    rn   r.   r.   ~   r   ro   c                 R    t          |           o|                     d          dk    S )Nrw   realr   rs   s    rn   isrealr      s$    C==:SWWZ00F::ro   c                     	 | d         d         S # t           $ r$ 	 | d         d         cY S # t           $ r Y Y d S w xY ww xY w)Nkindselector*kindKeyErrorrs   s    rn   get_kindr      sq    >"3''   	~&v.... 	 	 	DDD	s     
>+>
:>:>c                 z    |                      d          dk    o"t          |           dk    ot          |            S Nrw   r   1)ri   r   r   rs   s    rn   r,   r,      s?    77:)+ 6SMMS 6)0%56ro   c                 |    t          |           sdS |                     d          dvrdS t          |           dk    S )Nr   rw   r   r   8rI   ri   r   rs   s    rn   r@   r@      sC    C== q
wwz"888qC==Cro   c                     t          |           sdS |                     d          dk    rdS t          |           dk    S )Nr   rw   r   -1r   rs   s    rn   rT   rT      B    C== q
wwzi''qC==D  ro   c                     t          |           sdS |                     d          dk    rdS t          |           dk    S )Nr   rw   r   -2r   rs   s    rn   rX   rX      r   ro   c                     t          |           sdS |                     d          dk    rdS t          |           dk    S )Nr   rw   r   -4r   rs   s    rn   rS   rS      r   ro   c                     t          |           sdS |                     d          dk    rdS t          |           dk    S )Nr   rw   r   -8r   rs   s    rn   rV   rV      r   ro   c                     t          |           sdS |                     d          dk    sdS t          |           dk    S )Nr   rw   r   r   r   rs   s    rn   r'   r'      sB    C== q77:&((qC==Cro   c                     t          |           sdS |                     d          dk    sdS t          |           dk    S )Nr   rw   r   16r   rs   s    rn   r>   r>      sB    C== q77:&((qC==D  ro   c                 J    t          |           sdS t          |           dk    S )Nr   32)r"   r   rs   s    rn   r=   r=      s&    S>> qC==D  ro   c                 N    t          |           o|                     d          dv S r   )r   ri   rs   s    rn   r$   r$      s,    3<< @77:"??@ro   c                 x    t          |           o+|                     d          dk    ot          |           dk    S r   r   ri   r   rs   s    rn   r-   r-      s;    3<< !CGGJ//9< !SMMS !ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   rU   rU      <    3<< "CGGJ//3II "SMMT!"ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   rY   rY      r   ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   isunsignedarrayr      r   ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   rW   rW      r   ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   issigned_chararrayr      <    3<< !CGGJ//3II !SMMS !ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   2r   rs   s    rn   issigned_shortarrayr      r   ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   4r   rs   s    rn   issigned_arrayr      r   ro   c                 t    t          |           o)|                     d          dv ot          |           dk    S )Nrw   r   r   r   rs   s    rn   rJ   rJ      r   ro   c                     d| v o	d| d         v S )Nattrspecallocatable rs   s    rn   r   r     s    A#j/!AAro   c                 *    d| vpt          |            S r   )rK   rs   s    rn   	ismutabler   	  s    3&7(3--88ro   c                 
    d| v S )N
modulenamer   routs    rn   rC   rC     s    4ro   c                 "    d| v od| d         k    S )Nblockmoduler   r   s    rn   rB   rB     s    d?8x4=88ro   c                 "    d| v od| d         k    S )Nr   functionr   r   s    rn   r*   r*     s    d?:zT']::ro   c                 p    t          |           rdS t          ot          |           ot          |            S Nr   )r0   	wrapfuncsr*   r)   r   s    rn   r+   r+     s:    $ qDD))D:d3C3C/CDro   c                 "    d| v od| d         k    S )Nr   
subroutiner   r   s    rn   rO   rO     s    d?<|tG}<<ro   c                 `    t          |           rdS t          |           ot          |           S r   )r0   rO   hasassumedshaper   s    rn   rQ   rQ   #  s2    $ q7/$"7"77ro   c                 2    d|                      dg           v S )Nvaluer   ri   rs   s    rn   rb   rb   (  s    cggj"----ro   c                     |                      d          rdS | d         D ]D}| d                              |i                                dg           D ]}|dk    r	d| d<     dS EdS )Nr   Targsvarsr   :Fr   )r   ads      rn   r   r   ,  s    xx!"" t&\  f!!!R((,,["== 	 	ACxx*.&'ttt 	 5ro   c                 >    t          |           pt          |           S r   )rC   r   r   s    rn   requiresf90wrapperr   7  s    4  9OD$9$99ro   c                 >    t          |           pt          |           S r   )r*   rO   r   s    rn   rH   rH   ;  s    d1|D111ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS Nr   resultnamer   )r*   r;   r   r   s     rn   r<   r<   ?  `    d q4NLDLfa)))1ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS r   )r*   r@   r   s     rn   rA   rA   K  s`    d q4NLDL4<?+++1ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS r   )r*   r>   r   s     rn   r?   r?   W  s`    d q4NLDLT&\!_---1ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS r   )r*   r"   r   s     rn   r%   r%   c  r   ro   c                 F    t          |           rt          d           dS dS )Na      **************************************************************
        Warning: code with a function returning complex value
        may not work correctly with your Fortran compiler.
        When using GNU gcc/g77 compilers, codes should work
        correctly for callbacks with:
        f2py -c -DF2PY_CB_RETURNCOMPLEX
    **************************************************************
r   r   )r%   r]   r   s    rn   r&   r&   o  s9     	 H 	I 	I 	I q1ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS r   )r*   rK   r   s     rn   rN   rN   }  s`    d q4NLDLVQ(((1ro   c                     d| v o| d         S )N	externalsr   r   s    rn   r   r     s    $44#44ro   c                     d| v o	d| d         v S )Nf2pyenhancements
threadsafer   r   s    rn   rR   rR     s"    % 44 2334ro   c                     d| v o| d         S )Nr   r   r   s    rn   hasvariablesr     s    T>*d6l*ro   c                 P    d| v o"d| d         v od| d         vot          |           S )Nr   optionalrequired)r8   rs   s    rn   rD   rD     sB    # .*J"? .c*o-I3CC3H3HIro   c                     d| v o	d| d         v S )Nr   externalr   rs   s    rn   r)   r)     s    >s:!>>ro   c                     dd|                                  v r9t          d | d         D                       rfd| d         D             d         S d S d S )Nz	\((.*?)\)r   c              3      K   | ]}d |v V  	dS )r   Nr   ).0ss     rn   	<genexpr>zgetdimension.<locals>.<genexpr>  s'      99A{a999999ro   c                 :    g | ]}t          j        |          S r   )refindall)r  v
dimpatterns     rn   
<listcomp>z getdimension.<locals>.<listcomp>  s%    GGG!BJz1--GGGro   r   )keysany)rt   r  s    @rn   r   r     sv    JSXXZZ99Z99999 	KGGGGs:GGGJJ  	K 	Kro   c                 @    t          |            ot          |           S r   )rD   r8   rs   s    rn   rG   rG     s    #8#3C#8#88ro   c                 B     h d}t           fd|D                       S )N>   pymethoddefcallstatementcallprotoargumentc              3   D   K   | ]}|                                 v V  d S r   lower)r  	directive	f2py_lines     rn   r  z$iscstyledirective.<locals>.<genexpr>  s2      JJ)yIOO---JJJJJJro   )r  )r  
directivess   ` rn   r#   r#     s1    FFFJJJJJzJJJJJJro   c                     d| vrdS d| d         v rdS d| d         v rdS d| d         v rdS d| d         v rdS d| d         v rdS d	| d         v rdS dS )
Nintentr   hider   inplaceinoutinoutoutinr   rs   s    rn   r5   r5     s    sqXqCM!!qs8}qHq#h-q#h-q1ro   c                 n    d| v o1d| d         v s
d| d         v od| d         vod| d         vo	d| d         vS )Nr  r"  r#  r   r  r  r   rs   s    rn   r6   r6     sg    O KCM!9 "%s8}$K*.c(m*CK#h-'K,5S],JLro   c                 2    d|                      dg           v S )Nr!  r  r   rs   s    rn   r9   r9         CGGHb))))ro   c                     d| v oAd| d         v p7d| d         v o-d| d         vo# t          t          t                    |            S )Nr  r  r!  r   )r\   r6   r7   rs   s    rn   r4   r4     sd    O D3x=!8 "Cc(m# BCM(A B;T.*:;;C@@@Ero   c                 "    t          |            S r   )r4   rs   s    rn   r8   r8     s    S!!!!ro   c                 2    d|                      dg           v S )Ncr  r   rs   s    rn   r0   r0     s    #''(B''''ro   c                 2    d|                      dg           v S )Ncacher  r   rs   s    rn   isintent_cacher-    s    cggh++++ro   c                 2    d|                      dg           v S )Ncopyr  r   rs   s    rn   r2   r2     s    SWWXr****ro   c                 2    d|                      dg           v S )N	overwriter  r   rs   s    rn   r:   r:         #''(B////ro   c                 2    d|                      dg           v S )Ncallbackr  r   rs   s    rn   r1   r1         2....ro   c                 2    d|                      dg           v S )Nr  r  r   rs   s    rn   r7   r7     s    "----ro   c                 2    d|                      dg           v S )Nauxr  r   rs   s    rn   r/   r/     r&  ro   c                 2    d|                      dg           v S )Naligned4r  r   rs   s    rn   isintent_aligned4r;    r5  ro   c                 2    d|                      dg           v S )Naligned8r  r   rs   s    rn   isintent_aligned8r>    r5  ro   c                 2    d|                      dg           v S )N	aligned16r  r   rs   s    rn   isintent_aligned16rA    r2  ro   	INTENT_ININTENT_INOUT
INTENT_OUTINTENT_HIDEINTENT_CACHEINTENT_COPTIONALINTENT_INPLACEINTENT_ALIGNED4INTENT_ALIGNED8INTENT_ALIGNED16c                     d| v o	d| d         v S )Nr   privater   rs   s    rn   rE   rE     s    =c*o!==ro   c                 ^    t          |           dk    rd| v r| d         d         dv rd}nd}|S )Nr   r   r   )publicrN  FTlen)rt   is_vars     rn   rF   rF     sA    
3xx1}}s**
OA"777Mro   c                 
    d| v S )N=r   rs   s    rn   r   r     s    #:ro   c                 D    t          |           sdS | d         d         dv S )Nr   rU  )"')r   rs   s    rn   hasinitvalueasstringrY    s*     qs8A;*$$ro   c                 
    d| v S )Nnoter   rs   s    rn   r   r     s    S=ro   c                     t          |           sdS d| v r	| d         }n| d         }|| d         v rt          | d         |                   S dS r   )r*   r   r   s     rn   r   r   #  s`    d q4NLDLtF|A'''1ro   c                 
    d| v S )Ncommonr   r   s    rn   r   r   /  s    tro   c                     t          |           rdS t          |           r| d         D ]}t          |          r dS dS )Nr   bodyr   )r   r   re   )r   bs     rn   re   re   3  sW     qt}} f 	 	Aa   qq1ro   c                     t          |           rdS t          |           sdS | d         D ]}t          |          r dS dS )Nr   r   r`  )rB   r   containsmodule)r   ra  s     rn   rc  rc  =  s\     q5>> q6]  ! 	11	1ro   c                 
    d| v S )Nr`  r   r   s    rn   r   r   H  s    T>ro   c                 $    t          |           d uS r   )r   r   s    rn   r   r   L  s    D!!--ro   c                     dS )Nr   r   rs   s    rn   istruerg  P      1ro   c                     dS r   r   rs   s    rn   isfalserj  T  rh  ro   c                       e Zd ZdS )	F2PYErrorN)__name__
__module____qualname__r   ro   rn   rl  rl  X  s        Dro   rl  c                       e Zd Zd Zd ZdS )ra   c                     || _         d S r   )mess)selfrr  s     rn   __init__zthrow_error.__init__^  s    			ro   c                 <    d|d| j         d}t          |          )Nz


  var = z
  Message: 
)rr  rl  )rs  rt   rr  s      rn   __call__zthrow_error.__call__a  s$     47CCCooro   N)rm  rn  ro  rt  rw  r   ro   rn   ra   ra   \  s2              ro   ra   c                      dg }}t          t          |                     D ]"}d|||fz  }|                    d|z             #t          |dd                    |                    S )Nlambda v%s,f%d=f[%d]f%d(v)r   z and rangerR  appendevaljoinfl1l2is       rn   rZ   rZ   f  su    B3q66]] " "r1aj(
		(a.!!!!222w||B///0111ro   c                      dg }}t          t          |                     D ]"}d|||fz  }|                    d|z             #t          |dd                    |                    S )Nry  rz  r{  r   z or r|  r  s       rn   r\   r\   n  sr    B3q66]] " "r1aj(
		(a.!!!!222v{{2/000ro   c                      t          d          S )Nzlambda v,f=f:not f(v))r  )r  s    rn   r[   r[   v  s    '(((ro   c                 J    	 | d         d         dk    S # t           $ r Y dS w xY w)Nr   fortranname r   r   r   s    rn   r(   r(   z  s?    &'6"<<   qqs    
""c                     	 | d         d         }|dk    rt           |st          d| d         z             t           n# t           $ r | d         }Y nw xY w|S )Nr   r  r  z"Failed to use fortranname from %s
r   )r   r   )r   r   s     rn   r   r     s    	&'62::N 	9,-/ 0 0 0N	    F|Ks   <? AAc                 F   	 | d                              |          }n# t          $ r Y d S w xY w|sd S |dk    rt          |t                    rd S t          |t                    r|t          |          k    rd S ||         }|d d         dk    r|r'd|z   dz   t          |          z   dz   |dd          z   }n
|dd          }|dd          dk    r.|r!|d d         d	z   t          |          z   d
z   }n-|d d         }n"t          |dt          |          d           |S )Nr   r      z'''z
	/* start z multiline (z) */
z
	/* end multiline (z)*/z( multiline block should end with `'''`: rv  )ri   r   
isinstancestrlistrR  reprr   )r   	blocknamecommentcounterrs        rn   getmultilineblockr    s}   #$((33    {{z!S)){!T c!ffFgJ!u~~ 		)!%g/19:<=abbEBAA !""ARSS6U?? crcF55WEMcrcF yy$q''''+ , , ,Hs    
,,c                 "    t          | d          S )Nr  r  r   s    rn   r   r     s    T?333ro   c           	      8   t          | dd          }|r|S t          |           rt          d           d S ddlm} g g }} t          t          t          t                              |           r|	                    ddg           | d	         D ]}| d
         |         }t          |          r ||v r||         dz   }n ||          } t          t          t          t          t                              |          rn$t          |          rnt!          |          s|dz   }t          |          st#          |          st%          |          r|                    d           |                    |           d                    ||z             }	|	sd}	|	S )Nr  r   )r  z<warning: callstatement is defined without callprotoargument
r   )getctypezchar*size_tr   r   _typedefr   ,void)r  r   r]   	capi_mapsr  rZ   rN   r[   r+   extendr1   r0   r\   rI   r"   rK   rb   r   rL   r~  r  )
r   cb_mapr  r  	arg_types
arg_types2nrt   ctype
proto_argss
             rn   r   r     s   $ 3Q???A  K	M 	M 	M######zI6uu_5566t<< .'8,---&\    6l1oS!! 	;;1I
*EEHSMME;uZh	!:!:;;C@@ (# (#C(( (!CKE ,$S)),!#&&, !!(+++)j011J 
ro   c                 "    t          | d          S )Nusercoder  r   s    rn   r   r     s    T:...ro   c                 &    t          | dd          S )Nr  r   )r  r  r   s    rn   r   r     s    T:q9999ro   c                 "    t          | d          S )Nr  r  r   s    rn   r   r     s    T=111ro   c                     g g }}d| v rW| d         }d| v rC| d         D ]}||v r|                     |           |D ]}||vr|                     |           n| d         }||fS )Nr   sortvars)r~  )r   sortargsr   r   s       rn   getargsr    s    dH~~F|*% ' '99OOA&&& ' 'H$$OOA&&&' F|H>ro   c                 <    g                       dg           c} fd d                                         D             }|z   d v rC d         D ]}|v r|                    |           D ]}||vr|                    |           n| d         z   }|fS )Nr   c                 R    g | ]#}t          d          |                   r|v!|$S )r   )r/   )r  r   r   r   s     rn   r  zgetargs2.<locals>.<listcomp>  s@     " " "Qd6l1o1N1N "D==  ==ro   r   r  )ri   r  r~  )r   r  auxvarsr   r   s   `   @rn   r   r     s    &"--NHd" " " " "$v,++-- " " "GT>DTj! 	# 	#ADyy""" 	# 	#A  """	# T&\)>ro   c                     d| vrd S d }| d         dk    r| d         | d         f}| d                              |d           S )Nf2pymultilinesr   zpython moduler   r   )r   ks     rn   r   r     sT    t##tAG}''M4<' !%%a...ro   c                 V    dt          |           z
  dz
  dz  }d|dz  d| d|dz  dS )NP         z/*r    z*/rQ  )r   lns     rn   r   r     s>    
s4yy.1
	"BB#XXXtttR#XXX66ro   c                 d    t          | t                    rt          t          fd| g           S | gS )Nc                     |  ||          z   S r   r   )xyr  s      rn   <lambda>zflatlist.<locals>.<lambda>  s    q11Q44x ro   )r  r  r   flatlist)lsts    rn   r  r    s7    #t BX777bAAA5Lro   c                 6    | r| d         dk    r
| d d         S | S )Nr   r  r   )r  s    rn   r`   r`     s(     QrUc\\"vHro   r  c           
      *    t          t                    r fdD             S t           t                    rfd D             S dt                                                    z  D ]}|dk    r	dv r|d         v rd         |         }n}t          |         t                    r@                     d|z  |                    t          |                                                             d|z  |                     S )Nc                 2    g | ]}t          |          S r   r^   )r  _m
defaultsepr  s     rn   r  zreplace.<locals>.<listcomp>!  s%    999R,,999ro   c                 2    g | ]}t          |          S r   r  )r  r  r   r  s     rn   r  zreplace.<locals>.<listcomp>#  s%    999rAz**999ro   r  separatorsforz#%s#)r  r  r  r^   r  r  )r  r   r  r  seps   ```  rn   r^   r^     s*   !T :99999q9999#t :99999S9999affhh 
2 
2aA?);$;$;O$Q'CCCadD!! 	2++flCHHXad^^,D,DEECC++flAaD11CCJro   c                 ,   t          |t                    r|D ]}t          | |          } | S |                                D ]Q}|d         dk    r|| v r1t          | |         t                    r| |         g| |<   t          | |         t                    rRt          ||         t                    r| |         ||         z   | |<   | |                             ||                    t          | |         t                    rt          ||         t                    re|dk    r@||                                         D ]#}|| |         vr||         |         | |         |<   $%t          | |         ||                   | |<   F||         | |<   S| S )Nr   _r  )r  r  r
   r  r  r~  dict)rdarr   r  k1s        rn   r
   r
   2  s   "d  	# 	#AB""BB	WWYY  Q43;;77"Q%%%  A1"Q%&& 9beT** (qEBqEMBqEEqELLA''''BqE4(( 9beT** 9O++"$Q%**,, 6 6B!A,.qE"I1b	6 !+2a5"Q% 8 81qEBqEEIro   c           	         i }t          | t                    r.| D ])}t          |||          }t          ||          }d|v r n*|S d| v r | d         |          s|S d| v r7t          d| d         i||          }d|v rt	          j        |d                    |                                 D ]}|dk    r| |         ||<   t          | |         t                    rt          | |         |          ||<   nt          | |         t                    rJg ||<   | |         D ]:}t          ||i||          }	||	v r!||         	                    |	|                    ;n|d         dk    rt          | |         t                    rLg ||<   | |                                         D ]*}
t          |
t          j                  r |
|          r t          | |         |
         t                    rr| |         |
         D ]b}t          |t                    r"t          d|i||          }d|v r	|d         }nd	}||         	                    t          ||                     c| |         |
         }t          |t                    r!t          d|i|          }d|v r	|d         }nd	}||         	                    t          ||                     ,n%t          d
t          | |                   z             t          ||         t                    r9t          ||                   dk    r||         d         ||<   ||         g k    r||= |S )N_break_checkneedneedsr  r   r  	supertextr  zapplyrules: ignoring rule %s.
r   )r  r  r   r
   r   append_needsr  r  r^   r~  r  typesFunctionTyper   r  rR  )rulesr   rt   retr  rrresr  r  r  r  s              rn   r   r   O  s   
C%  	 	AAq#&&BS"%%C2~~ 
5/%/#"6"6
'5=11c::c>>G---ZZ\\ * *1XCFeAh$$ !	HU1Xq))CFFa$'' 	HCF1X ) )A3//77FMM"Q%((() qTS[[a$'' 	HCFAhmmoo 5 5b%"455 5""S'' 5!%(2,55 5!&q" 9 9A)!T22 +&0+q1A1c&J&J#.##5#5(+K(8AA(*AFMM'!Q--88889 "!HRL%a.. '",k1-=q"A"AC*c11$'$4$&Agamm444'5* 5U1XFGGGc!fd## 	3q6{{aQA1v||FJro   z%\s*python\s*module\s*(?P<name>[\w_]+)z4\s*python\s*module\s*(?P<name>[\w_]*?__user__[\w_]*)c                     d }t          |           5 }|D ]:}t          |          }|r't          |          r#|                    d          } n;d d d            n# 1 swxY w Y   |S )Nr   )open_f2py_module_name_match_f2py_user_module_name_matchgroup)sourcer   r  linems        rn   rP   rP     s    D	f  	 	D'--A /55 wwv	               Ks   >AA #A c                     g }| d         D ]f}|d         D ][}|                     d          rD|                    d |                     d                                          D                        \g|S )Nr`  usec                     g | ]}d |v|	S )__r   )r  r  s     rn   r  z getuseblocks.<locals>.<listcomp>  s     X X Xq$VW-----ro   )ri   r  r  )pymodall_usesinnermodblocks       rn   rc   rc     s    Hv Z Zf 	Z 	ZH||E"" Z X XHLL,?,?,D,D,F,F X X XYYY	Z Oro   Fc                    g }i }|                                 D ]:\  }}d |                                 D             }|||                                <   ;|                                 D ]\  }}|| vri | |<   |                                 D ]\  }	}
|
|v rn|	| |         v r(t          d|d|	d| |         |	         d|
d	           |
| |         |	<   |rt          d|d|	d	|
d
           |                    |
           w|r>t	          d|d|	d|
d|
dt          |                                          d           | |fS )a  
    Update the Fortran-to-C type mapping dictionary with new mappings and
    return a list of successfully mapped C types.

    This function integrates a new mapping dictionary into an existing
    Fortran-to-C type mapping dictionary. It ensures that all keys are in
    lowercase and validates new entries against a given C-to-Python mapping
    dictionary. Redefinitions and invalid entries are reported with a warning.

    Parameters
    ----------
    f2cmap_all : dict
        The existing Fortran-to-C type mapping dictionary that will be updated.
        It should be a dictionary of dictionaries where the main keys represent
        Fortran types and the nested dictionaries map Fortran type specifiers
        to corresponding C types.

    new_map : dict
        A dictionary containing new type mappings to be added to `f2cmap_all`.
        The structure should be similar to `f2cmap_all`, with keys representing
        Fortran types and values being dictionaries of type specifiers and their
        C type equivalents.

    c2py_map : dict
        A dictionary used for validating the C types in `new_map`. It maps C
        types to corresponding Python types and is used to ensure that the C
        types specified in `new_map` are valid.

    verbose : boolean
        A flag used to provide information about the types mapped

    Returns
    -------
    tuple of (dict, list)
        The updated Fortran-to-C type mapping dictionary and a list of
        successfully mapped C types.
    c                 >    i | ]\  }}|                                 |S r   r  )r  r  v1s      rn   
<dictcomp>z'process_f2cmap_dict.<locals>.<dictcomp>  s&    <<<vr2BHHJJ<<<ro   z	Warning: redefinition of {'z':{'z':'z'->'z'}}
z
	Mapping "z(kind=z)" to "z"
z	Ignoring map {'z'}}: 'z' must be in rv  )itemsr  r]   r~  r   r  r  )
f2cmap_allnew_mapc2py_maprg   f2cmap_mappednew_map_lowerr  d1d1_lowerr  r  s              rn   rd   rd     s   L MM , ,2<<<<<#+aggii  $$&&  2JJqMhhjj 	 	FBX~~A&&G11bbb*Q-"3"3"3RRR9   %'
1b! OG111bbb"""MNNN$$R(((( G11bbb"""bbb$x}}*?*?*?*?A  	$ }$$ro   )r   r   )r  )F)__doc__pprintrj   r
  r  	functoolsr   r  r   r   r   __all__versionf2py_versionr_   rh   rr   r   r]   r	   rz   r}   r!   r   r    rM   rK   rL   r   r   rI   r"   r;   r.   r   r   r,   r@   rT   rX   rS   rV   r'   r>   r=   r$   r-   rU   rY   r   rW   r   r   r   rJ   r   r   rC   rB   r*   r+   rO   rQ   rb   r   r   rH   r<   rA   r?   r%   r&   rN   r   rR   r   rD   r)   r   rG   r#   r5   r6   r9   r4   r8   r0   r-  r2   r:   r1   r7   r/   r;  r>  rA  r3   rE   rF   r   rY  r   r   r   re   rc  r   r   rg  rj  	Exceptionrl  ra   rZ   r\   r[   r(   r   r  r   r   r   r   r   r  r   r   r   r  r`   r^   r
   r   compileImatchr  r  rP   rc   rd   r   ro   rn   <module>r     s  	 	  



 				                           : " }
	  
" " "  
  
; ; ;C C C? ? ?7 7 7= = =9 9 9@ @ @6 6 6B B B@ @ @
> > >> > >; ; ;  6 6 6
     ! ! !! ! !! ! !! ! !     ! ! !! ! !@ @ @
! ! !
" " "
" " "
" " "
" " "
! ! !
! ! !
! ! !
! ! !
B B B9 9 9     9 9 9; ; ;E E E= = =8 8 8
. . .  : : :2 2 2	 	 		 	 		 	 		 	 	  	 	 	5 5 54 4 4
+ + +I I I
? ? ?K K K9 9 9K K K
  $L L L* * *E E E" " "( ( (, , ,+ + +0 0 0/ / /. . .* * */ / // / /0 0 0 k>>|]MZZ!#3"$5"$5#%7> > >    % % %  	 	 	        . . .    	 	 	 	 		 	 	 	       2 2 21 1 1) ) )       <4 4 4 ') $ $ $ $N/ / /: : :2 2 2     "/ / /7 7 7
       &  :   ; ; ; ;z %"*%M%'T+ ++0 )rz +=>@d D  DDI 
 
 
  C% C% C% C% C% C%ro   