Your IP : 3.146.107.152


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/pipes.cpython-39.opt-2.pyc

a

R�f�"�@slddlZddlZddlZddlmZdgZdZdZdZdZ	dZ
d	Zeeee	e
egZGd
d�d�Z
dd�ZdS)
�N)�quote�TemplateZffz-fzf-�--z.-z-.c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCsd|_|��dS)Nr)�	debugging�reset��self�r	�*/opt/alt/python39/lib64/python3.9/pipes.py�__init__UszTemplate.__init__cCsd|jfS)Nz<Template instance, steps=%r>��stepsrr	r	r
�__repr__ZszTemplate.__repr__cCs
g|_dS�Nrrr	r	r
r^szTemplate.resetcCs"t�}|jdd�|_|j|_|Sr)rr
r)r�tr	r	r
�clonebszTemplate.clonecCs
||_dSr)r)r�flagr	r	r
�debugjszTemplate.debugcCs�t|�td�urtd��|tvr.td|f��|tkr>td��|jr^|jddtkr^td��|dd	kr~t�d
|�s~td��|dd	kr�t�d|�s�td
��|j�	||f�dS)N�z%Template.append: cmd must be a stringzTemplate.append: bad kind %rz-Template.append: SOURCE can only be prepended����z'Template.append: already ends with SINKr�f�\$IN\bz#Template.append: missing $IN in cmd�\$OUT\bz$Template.append: missing $OUT in cmd)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append�r�cmd�kindr	r	r
r"nszTemplate.appendcCs�t|�td�urtd��|tvr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr~t�d	|�s~td
��|ddkr�t�d|�s�td��|j�	d||f�dS)
Nrz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind %rz+Template.prepend: SINK can only be appendedrrz,Template.prepend: already begins with SOURCErrz$Template.prepend: missing $IN in cmdrz%Template.prepend: missing $OUT in cmd)
rrrrrr
rr r!�insertr#r	r	r
�prepend~szTemplate.prependcCs6|dkr|�|�S|dkr$|�|�Std|f��dS)N�r�wz,Template.open: rw must be 'r' or 'w', not %r)�open_r�open_wr)r�fileZrwr	r	r
�open�s

�z
Template.opencCsB|jst|d�S|jddtkr*td��|�|d�}t�|d�S)Nr(rrz)Template.open_r: pipeline ends width SINKr)r
r-rr�makepipeline�os�popen�rr,r$r	r	r
r*�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|�d|�}t�|d�S)Nr)rrz,Template.open_w: pipeline begins with SOURCEr)r
r-rrr.r/r0r1r	r	r
r+�s
zTemplate.open_wcCst�|�||��Sr)r/�systemr.)r�infile�outfiler	r	r
�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r.r
r�print)rr3r4r$r	r	r
r.�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__rrrrrr"r'r-r*r+r5r.r	r	r	r
rRs

cCs�g}|D]\}}|�d||dg�q|s6|�gd��|ddd�\}}|ddkrj|sj|�dgd��||dd<|ddd�\}}|ddkr�|s�|�gd��||dd<g}tdt|��D]v}||dd}||d}	|ddk�s|	ddkr�t��\}
}t�|
�|�|�|||dd<||d<q�|D]�}|\}
}}}|ddk�rtd	t|�d
|}|ddk�r�dt|
�d
|}|ddk�r�|
�r�|d
t|
�}|ddk�r�|�r�|dt|�}||d<�qB|dd}|dd�D]T}|dd�\}}|ddk�rHd|v�r:d|d}|d|}n|d|}�q|�r�d}|D]}|dt|�}�qfdt|d�d}|d|d|}|S)Nr)r�catrrrr�rr�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15)	r"r&�range�len�tempfileZmkstempr/�closer)r3r
r4�listr$r%Zgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr,Ztrapcmdr	r	r
r.�s`


r.)r r/rBZshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr.r	r	r	r
�<module><s�c

?>