Current File : //usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyo
�
E�`Qc@s�dZddgZddlZddlZddlZejdej�Zejdej�Zejdej�Z	d�Z
ejd	�Zejd
�Zejd�Z
d�Zejd
�Zd�Zd�Zejd�Zd�Zd�Zejdej�Zd�Zd�Zed�Zedkr�yejdZWn#ek
rkejZejZ n=Xe!ed�Zej"j#e�\Z$Z%e$Z&e!e&d�Z ej'�Z(ee(�Z)e j*e)�ndS(s�

process_file(filename)

  takes templated file .xxx.src and produces .xxx file where .xxx
  is .pyf .f90 or .f using the following template rules:

  '<..>' denotes a template.

  All function and subroutine blocks in a source file with names that
  contain '<..>' will be replicated according to the rules in '<..>'.

  The number of comma-separeted words in '<..>' will determine the number of
  replicates.

  '<..>' may have two different forms, named and short. For example,

  named:
   <p=d,s,z,c> where anywhere inside a block '<p>' will be replaced with
   'd', 's', 'z', and 'c' for each replicate of the block.

   <_c>  is already defined: <_c=s,d,c,z>
   <_t>  is already defined: <_t=real,double precision,complex,double complex>

  short:
   <s,d,c,z>, a short form of the named, useful when no <p> appears inside
   a block.

  In general, '<..>' contains a comma separated list of arbitrary
  expressions. If these expression must contain a comma|leftarrow|rightarrow,
  then prepend the comma|leftarrow|rightarrow with a backslash.

  If an expression matches '\<index>' then it will be replaced
  by <index>-th expression.

  Note that all '<..>' forms in a block must have the same number of
  comma-separated entries.

 Predefined named template rules:
  <prefix=s,d,c,z>
  <ftype=real,double precision,complex,double complex>
  <ftypereal=real,double precision,\0,\1>
  <ctype=float,double,complex_float,complex_double>
  <ctypereal=float,double,\0,\1>

tprocess_strtprocess_filei����Ns2(\n|\A)((     (\$|\*))|)\s*(subroutine|function)\bs+\n\s*end\s*(subroutine|function)\b.*(\n|\Z)s\n     (\$|\*)\s*function\bcCs	g}d}x�tj||�}|dkr1Pn|j�}tj|||j��r�xL|jd||�}|dkr�Pn|}|||d!dkr[Pq[q[n|d7}tj||j��}|r�|j�dp�t	|�}}|j
||f�q|S(s� Return a list of tuples for each function or subroutine each
    tuple is the start and end of a subroutine or function to be
    expanded.
    is
i����is
     $iN(troutine_start_retsearchtNonetstarttfunction_start_retmatchtendtrfindtroutine_end_retlentappend(tastrtspanlisttindtmRtiR((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pytparse_structure;s(

&s<\s*(\w[\w\d]*)\s*>s<\s*(\w[\w\d]*)\s*=\s*(.*?)\s*>s<\s*((.*?))\s*>cCsrtj|�}i}xV|D]N}|dj�p;t|�}|djdd�}t|�}|||<qW|S(Niis\,s@comma@(tnamed_retfindalltstript
unique_keytreplacetconv(R
trepstnamestreptnametrepltthelist((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pytfind_repl_patternsZs
s\A\\(?P<index>\d+)\ZcCs�|jd�}g|D]}|j�^q}xYtt|��D]E}tj||�}|rAt|jd��}||||<qAqAWdj|�S(Nt,tindex(	tsplitRtrangeRtitem_reRtinttgrouptjoin(R
tbtxtlRRtj((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyRescCsR|j�}t}d}x3|sMd|}||krD|d7}qt}qW|S(s( Obtain a unique key given a dictionary.is__l%s(tkeystFalsetTrue(tadicttallkeystdonetntnewkey((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyRos	


s\A\s*(\w[\w\d]*)\s*\Zcs|jdd�}|jdd�}t|��tjd|�}�fd�}tj||�}d}d}i�x&tj|�D]}|�kr��j||j|d��}|dkr�t	d|��n||kr�|j
d�r�|||<ng|jd	�D]}|jd
d	�^q
}t|�}	|dkr\|	}|�|<|}q�|	|kru|�|<q�d|d	j
�|�||fGHq�q�W�s�|S��fd�}
d
}x.t|�D] �|tj|
|�d7}q�W|jdd�}|jdd�}|S(Ns\>s@rightarrow@s\<s@leftarrow@s<\1>cs�t|jd�jdd��}tj|�r8d|Sd}x-�j�D]}�||krK|}qKqKW|dkr�t��}|�|<nd|S(Nis\,s@comma@s<%s>(RR&Rttemplate_name_reRRR,R(tmobjRRtkey(tlnames(sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pytlistrepl�s!

sNo replicates found for <%s>t_R s@comma@sHMismatch in number of replacements (base <%s=%s>) for <%s=%s>. Ignoring.cs.|jd�}�j|�d|g��S(Ni(R&tget(R5R(tktrules(sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pytnamerepl�sts

t>t<(RRRtsubtlist_reRttemplate_reRR:t
ValueErrort
startswithR"RR'R#(tsubstrRR8tnumsubst	base_ruletrRRtruletnumR=tnewstr((R;R7R<sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyt
expand_sub~sJ

.
	
cCs�|}d}t|�}d}i}|jt�xm|D]e}||||d!7}|jt|||d!��|t||d|d!|�7}|d}q8W|||7}|S(NR>ii(Rtupdatet_special_namesRRM(tallstrRLtwritestrtstructtoldendRRA((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyR�s

"s9(\n|\A)\s*include\s*['\"](?P<name>[\w\d./\\]+[.]src)['\"]cCs�tjj|�}t|�}g}x�|j�D]�}tj|�}|r�|jd�}tjj|�s�tjj	||�}ntjj
|�r�d|fGH|jt|��q�|j
|�q1|j
|�q1W|j�|S(NRsIncluding file(tostpathtdirnametopent	readlinestinclude_src_reRR&tisabsR'tisfiletextendtresolve_includesRtclose(tsourcetdtfidtlinestlineRtfn((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyR]�s 
cCst|�}tdj|��S(NR>(R]RR'(R_Rb((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyR�ss�
<_c=s,d,c,z>
<_t=real,double precision,complex,double complex>
<prefix=s,d,c,z>
<ftype=real,double precision,complex,double complex>
<ctype=float,double,complex_float,complex_double>
<ftypereal=real,double precision,\0,\1>
<ctypereal=float,double,\0,\1>
t__main__iRItw(+t__doc__t__all__RTtsystretcompiletIRR
RRRCRRBRR$RRR4RMRRYR]RROt__name__targvtfilet
IndexErrortstdinRatstdouttoutfileRWRUtsplitexttbasetexttnewnametreadRPRQtwrite(((sC/usr/lib64/python2.7/site-packages/numpy/distutils/from_template.pyt<module>/sH		
	
		=