AlkantarClanX12

Your IP : 18.227.0.255


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/pipes.cpython-310.opt-2.pyc

o

6��f�"�@sn	ddlZddlZddlZddlmZdgZdZdZdZdZ	dZ
d	Zeeee	e
egZGd
d�d�Z
dd�ZdS)
�N)�quote�TemplateZffz-fzf-�--z.-z-.c@sneZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCs	d|_|��dS)Nr)�	debugging�reset��self�r	�,/opt/alt/python310/lib64/python3.10/pipes.py�__init__UszTemplate.__init__cCs	d|jfS)Nz<Template instance, steps=%r>��stepsrr	r	r
�__repr__ZszTemplate.__repr__cCs	g|_dS�Nrrr	r	r
r^�
zTemplate.resetcCs$	t�}|jdd�|_|j|_|Sr)rr
r)r�tr	r	r
�clonebs
zTemplate.clonecCs	||_dSr)r)r�flagr	r	r
�debugjrzTemplate.debugcCs�	t|t�s
td��|tvrtd|f��|tkrtd��|jr-|jddtkr-td��|ddkr=t�	d	|�s=td
��|ddkrMt�	d|�sMtd��|j�
||f�dS)
Nz%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)�
isinstance�str�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append�r�cmd�kindr	r	r
r#ns
zTemplate.appendcCs�	t|t�s
td��|tvrtd|f��|tkrtd��|jr-|jddtkr-td��|ddkr=t�	d|�s=td	��|ddkrMt�	d
|�sMtd��|j�
d||f�dS)Nz&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 r
rr!r"�insertr$r	r	r
�prepend~s
zTemplate.prependcCs4	|dkr
|�|�S|dkr|�|�Std|f��)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.opencCsD	|js	t|d�S|jddtkrtd��|�|d�}t�|d�S)Nr)rrz)Template.open_r: pipeline ends width SINK�)r
r.r r�makepipeline�os�popen�rr-r%r	r	r
r+�s
zTemplate.open_rcCsB|jst|d�S|jddtkrtd��|�d|�}t�|d�S)Nr*rrz,Template.open_w: pipeline begins with SOURCEr/)r
r.rrr0r1r2r3r	r	r
r,�s
zTemplate.open_wcCst�|�||��Sr)r1�systemr0)r�infile�outfiler	r	r
�copy�sz
Template.copycCs(t||j|�}|jrt|�d|}|S)Nzset -x; )r0r
r�print)rr5r6r%r	r	r
r0�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__rrrrrr#r(r.r+r,r7r0r	r	r	r
rRs

cCs�g}|D]
\}}|�d||dg�q|s|�gd��|ddd�\}}|ddkr5|s5|�dgd��||dd<|ddd�\}}|ddkrT|sT|�gd��||dd<g}tdt|��D]:}||dd}||d}	|ddks|	ddkr�t��\}
}t�|
�|�|�|||dd<||d<qc|D]L}|\}
}}}|ddkr�d	t|�d
|}|ddkr�dt|
�d
|}|ddkr�|
r�|d
t|
�}|ddkr�|r�|dt|�}||d<q�|dd}|dd�D])}|dd�\}}|ddk�rd|v�rd|d}|d|}q�|d|}q�|�rJd}|D]}|dt|�}�q*dt|d�d}|d|d|}|S)Nr/)r/�catrr/rr�rr�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15)	r#r'�range�len�tempfileZmkstempr1�closer)r5r
r6�listr%r&Zgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr-Ztrapcmdr	r	r
r0�sb

�

r0)r!r1rDZshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrr rrr0r	r	r	r
�<module>s";�c