%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/distutils/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/distutils/__pycache__/from_template.cpython-39.opt-1.pyc

a

z[yc��@s�dZddgZddlZddlZddlZe�dej�Ze�dej�Ze�dej�Z	dd	�Z
e�d
�Ze�d�Ze�d�Z
d
d�Zdd�Ze�d�Zdd�Zdd�Ze�d�Zdd�Zdd�Ze�dej�Zdd�Zdd�Zed�Zdd �Zed!kr�e�dS)"a�

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-separated 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>

�process_str�process_file�Nz2(\n|\A)((     (\$|\*))|)\s*(subroutine|function)\bz+\n\s*end\s*(subroutine|function)\b.*(\n|\Z)z\n     (\$|\*)\s*function\bcCs�g}d}t�||�}|durq�|��}t�|||���rl|�d||�}|dkrPql|}|||d�dkr8qlq8|d7}t�||���}|r�|��dp�t|�}}|�	||f�q|S)z� 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.
    rN�
����z
     $�)
�routine_start_re�search�start�function_start_re�match�end�rfind�routine_end_re�len�append)�astrZspanlistZind�mr
�ir
�r�C/usr/lib64/python3.9/site-packages/numpy/distutils/from_template.py�parse_structure:s$rz<\s*(\w[\w\d]*)\s*>z<\s*(\w[\w\d]*)\s*=\s*(.*?)\s*>z<\s*((.*?))\s*>cCsPt�|�}i}|D]8}|d��p(t|�}|d�dd�}t|�}|||<q|S)Nrr�\,�@comma@)�named_re�findall�strip�
unique_key�replace�conv)rZreps�namesZrep�name�repl�thelistrrr�find_repl_patternsYs

r$cCs"t|�}t�td|�d}||fS)N�r)r$�re�subnr)rr rrr�find_and_remove_repl_patternscsr(z\A\\(?P<index>\d+)\ZcCs`|�d�}dd�|D�}tt|��D]0}t�||�}|r$t|�d��}||||<q$d�|�S)N�,cSsg|]}|���qSr)r)�.0�xrrr�
<listcomp>k�zconv.<locals>.<listcomp>�index)�split�ranger�item_rer�int�group�join)r�b�lrr�jrrrris
rcCs<t|���}d}d}|s8d|}||vr2|d7}qd}q|S)z( Obtain a unique key given a dictionary.Frz__l%sT)�list�keys)ZadictZallkeysZdone�nZnewkeyrrrrss
rz\A\s*(\w[\w\d]*)\s*\Zcsl|�dd�}|�dd�}t|��t�d|�}�fdd�}t�||�}d}d}i�t�|�D]�}|�vrZ��||�|d��}|dur�td|��||vr�|�	d	�s�|||<d
d�|�
d�D�}t|�}|dur�|}|�|<|}qZ||kr�|�|<qZtd
|d�
�|�||f�qZ��s|S��fdd�}	d}
t|�D]�|
t�|	|�d7}
�q4|
�dd�}
|
�dd�}
|
S)Nz\>z@rightarrow@z\<z@leftarrow@z<\1>csjt|�d��dd��}t�|�r(d|Sd}���D]}�||kr4|}q4|durbt��}|�|<d|S)Nrrrz<%s>)rr3r�template_name_rerr9r)�mobjr#r!�key)�lnamesrr�listrepl�s
zexpand_sub.<locals>.listreplzNo replicates found for <%s>�_cSsg|]}|�dd��qS)rr))r)r*rrrrr,�r-zexpand_sub.<locals>.<listcomp>r)zHMismatch in number of replacements (base <%s=%s>) for <%s=%s>. Ignoring.cs$|�d�}��|�d|g��S)Nr)r3�get)r<r!)�k�rulesrr�namerepl�s
zexpand_sub.<locals>.namereplr%z

�>�<)rr$r�sub�list_re�template_rerrA�
ValueError�
startswithr/r�printr4r0)Zsubstrr r?ZnumsubsZ	base_rule�rr#ZruleZnumrD�newstrr)rBr>rCr�
expand_sub�sH

�rOc	Cs�|}d}t|�}d}i}|�t�|D]T}t|||d��\}}||7}|�|�|t||d|d�|�7}|d}q&|||d�7}|S)Nr%rr)r�update�_special_namesr(rO)	�allstrrN�writestr�structZoldendr rGZ
cleanedstrZdefsrrrr�s


z8(\n|\A)\s*include\s*['\"](?P<name>[\w\d./\\]+\.src)['\"]cCs�tj�|�}t|���}g}|D]h}t�|�}|r||�d�}tj�|�sTtj�||�}tj�	|�rp|�
t|��q�|�|�q|�|�qWd�n1s�0Y|S)Nr!)
�os�path�dirname�open�include_src_rerr3�isabsr4�isfile�extend�resolve_includesr)�source�d�fid�lines�liner�fnrrrr]�s


*r]cCst|�}td�|��S)Nr%)r]rr4)r^rarrrr�sz�
<_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>
cCstztjd}Wnty,tj}tj}Yn*0t|d�}tj�|�\}}|}t|d�}|�	�}t
|�}|�|�dS)NrrM�w)�sys�argv�
IndexError�stdin�stdoutrXrUrV�splitext�readr�write)�filer`Zoutfile�base�extZnewnamerRrSrrr�main�s

rp�__main__)�__doc__�__all__rUrer&�compile�IrrrrrIrrHr$r(r1rrr;rOrrYr]rrQrp�__name__rrrr�<module>s4.






<


Zerion Mini Shell 1.0