AlkantarClanX12

Your IP : 3.142.171.100


Current Path : /usr/lib64/python3.6/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/__pycache__/pipes.cpython-36.opt-2.pyc

3


 \�"�@slddlZddlZddlZddlmZdgZdZdZdZdZ	dZ
d	Zeeee	e
egZGd
d�d�Z
dd�ZdS)
�N)�quote�TemplateZffz-fzf-z--z.-z-.c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCsd|_|j�dS)Nr)�	debugging�reset)�self�r�/usr/lib64/python3.6/pipes.py�__init__UszTemplate.__init__cCsd|jfS)Nz<Template instance, steps=%r>)�steps)rrrr�__repr__ZszTemplate.__repr__cCs
g|_dS)N)r
)rrrrr^szTemplate.resetcCs"t�}|jdd�|_|j|_|S)N)rr
r)r�trrr�clonebszTemplate.clonecCs
||_dS)N)r)r�flagrrr�debugjszTemplate.debugcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jd
dtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	||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�fz\$IN\bz#Template.append: missing $IN in cmdz\$OUT\bz$Template.append: missing $OUT in cmd���)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append)r�cmd�kindrrrrnszTemplate.appendcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	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 SOURCErz\$IN\bz$Template.prepend: missing $IN in cmdz\$OUT\bz%Template.prepend: missing $OUT in cmd)
rrrrrr
rrr�insert)rrrrrr�prepend~szTemplate.prependcCs6|dkr|j|�S|dkr$|j|�Std|f��dS)N�r�wz,Template.open: rw must be 'r' or 'w', not %r)�open_r�open_wr)r�fileZrwrrr�open�s

z
Template.opencCsB|jst|d�S|jddtkr*td��|j|d�}tj|d�S)Nr!rz)Template.open_r: pipeline ends width SINKrr)r
r&rr�makepipeline�os�popen)rr%rrrrr#�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|jd|�}tj|d�S)Nr"rrz,Template.open_w: pipeline begins with SOURCEr)r
r&rrr'r(r))rr%rrrrr$�s
zTemplate.open_wcCstj|j||��S)N)r(�systemr')r�infile�outfilerrr�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r'r
r�print)rr+r,rrrrr'�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__r	rrr
rrr r&r#r$r-r'rrrrrRs

cCs�g}x"|D]\}}|jd||dg�q
W|s>|jddddg�|ddd�\}}|ddkrx|rx|jdddddg�||dd<|ddd�\}}|ddkr�|r�|jddddg�||dd<g}x�tdt|��D]v}||dd}||d}	|ddk�s|	ddkr�tj�\}
}tj|
�|j|�|||dd<||d<q�Wx�|D]�}|\}
}}}|ddk�r�d	t|�d
|}|ddk�r�dt|
�d
|}|ddk�r�|
�r�|d
t|
�}|ddk�r�|�r�|dt|�}||d<�q\W|dd}xd|dd�D]T}|dd�\}}|ddk�rfd|k�rXd|d}|d|}n|d|}�q W|�r�d}x|D]}|dt|�}�q�Wdt|d�d}|d|d|}|S)Nr�catz--rr�r�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15rrrr)	rr�range�len�tempfileZmkstempr(�closer)r+r
r,�listrrZgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr%Ztrapcmdrrrr'�s`

 


r')rr(r:Zshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr'rrrr�<module><sc