B
    .v`
                 @   s^   d dl Z d dlZd dlZdddddddgZddd	d
dddddddddddddgZdddZdS )    N	load_datamodify_networkinvert_networkderampvelocitygeocodegoogle_earthreference_pointquick_overviewcorrect_unwrap_errorcorrect_LODcorrect_SETcorrect_tropospherecorrect_topographyresidual_RMSreference_datehdfeos5   Tc       	         s  | t krtd| t |dkr8tjtjtjd}t	|d
 dd D d|  fddD }t|d	kr|d	 d
 }ntd|d}x.t|d
 tD ]}| dr|}P qW d fdd|| D }| }|rd| d }|S )a  Grab the related template content for each step
    To avoid duplication in each utility script.
    
    Parameters: step_name     - str, step name
                template_file - str, path of the template file
    Returns:    step_content  - str, comments and options of the step
    z,input step name "{}" not found! STEP_LIST={}Nzdefaults/smallbaselineApp.cfgrc             S   s   g | ]}| d qS ) )strip).0line r   N/home/centos/operations/rsmas_insar/sources/MintPy/mintpy/defaults/template.py
<listcomp>?   s    z(get_template_content.<locals>.<listcomp>z!^##########[ ]?\d{0,2}\.*\d{0,2} c                s"   g | ]}t |r |qS r   )rematchindex)r   r   )linespatternr   r   r   C   s    r      z&pattern "{}" is not found in file: {}!z##########  c             3   s   | ]}d   | V  qdS )r   Nr   )r   r   )indentationr   r   	<genexpr>Q   s    z'get_template_content.<locals>.<genexpr>ztemplate options:

)	STEP_LIST
ValueErrorformatospathjoindirnamemintpy__file__open	readlineslenrange
startswithrstrip)		step_nametemplate_filer$   Zheader_footerindsind0ind1iZstep_contentr   )r$   r   r    r   get_template_content/   s*    	 r<   )Nr   T)r*   r   r.   ZSTEP_LIST4OFFSETr'   r<   r   r   r   r   <module>   s6   