AlkantarClanX12

Your IP : 18.117.99.192


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/pty.cpython-312.opt-1.pyc

�

�Q�f����dZddlmZddlZddlZddlZddlmZmZddlmZmZm	Z	gd�Z
dZdZdZ
dZd	�Zd
�Zd�Zd�Zd
�Zd�Zeefd�Zeefd�Zy)zPseudo terminal utilities.�)�selectN)�close�waitpid)�setraw�	tcgetattr�	tcsetattr)�openpty�fork�spawn��c��	tj�S#ttf$rYnwxYwt	�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr	�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fds   �*/opt/alt/python312/lib64/python3.12/pty.pyr	r	sL��
��z�z�|����G�$�
��
��*�,��I�z��*�%�H��h��s��(�(c��ddl}|jdtd��	tj�\}}tj
|�}tj|�||fS#ttf$rYt�SwxYw)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.rN�Use pty.openpty() instead.r
��
stacklevel)
�warnings�warn�DeprecationWarningrr	�ttynamerrrr)rrrrs    r�master_openr &s{��
��M�M�.�0B�q�M�Q�%� �j�j�l��	�8��Z�Z��)�
�
������*�$�$��
�G�$�
�����
�s�A#�#A>�=A>c���dD]C}dD]<}d|z|z}	tj|tj�}|d|z|zfccS�Etd��#t$rY�WwxYw)z1Open pty master and return (master_fd, tty_name).�pqrstuvwxyzPQRST�0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r�open�O_RDWRr)�x�y�pty_name�fds    rrr9su��
��#�A�!�A�~��)�H�
��W�W�X�r�y�y�1���
�Q���*�+�+�
$� ��&�
'�'���
��
�s�$A�	A �A c��ddl}|jdtd��tj|tj
�}	ddlm}m}	|||d�|||d�|S#t$r|cYSwxYw#t$rY|SwxYw)	z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.rNrr
r)�ioctl�I_PUSH�ptem�ldterm)rrrrr$r%�fcntlr+r,�ImportErrorr)�tty_namer�resultr+r,s     rrrEs�����M�M�.�0B�q�M�Q�
�W�W�X�r�y�y�
)�F��'�
�
�f�f�f�%�
�f�f�h�'��M�����
���
�
���M�
�s$�A!�A2�!A/�.A/�2	A?�>A?c��	tj�\}}|tk(r	tj�||fS||fS#t$rY||fSwxYw#t
tf$rYnwxYwt
�\}}tj�}|tk(r.tj|�tj|�||fStj|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)
r�forkpty�CHILD�setsidrrr	r
r�	login_tty)�pidr)rrs    rr
r
Zs�����*�*�,���R��%�<�
��	�	���B�w��s�B�w����
���B�w��
��

�G�$�
��
��"�)��I�x�
�'�'�)�C�
�e�|�
�����
���X��
�	�>��	������	�>�s �A�?�	A�
A�A#�"A#c�.�tj|d�S)zDefault read function.i)r�read)r)s r�_readr;vs��
�7�7�2�t���c��tj|�r<tj|d�	t|||��tj|d�yd}|tk7}|t
k7}d}d}	g}g}	|r#t
|�|kr|jt�|rt
|�|kr|j|�|r#t
|�dkDr|	jt
�t
|�dkDr|	j|�t||	g�\}}	}
t
|	vr 	tjt
|�}||d}||vr	||�}|sy||z
}||	vrtj||�}||d}|rt|vr|t�}|sd}n||z
}��#tj|d�wxYw#t$rd}Y�~wxYw#t$rd}Y��wxYw)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)F)�master_read�
stdin_readTNir<r)r�get_blocking�set_blocking�_copy�STDIN_FILENO�
STDOUT_FILENO�len�appendr�writer)
rr>r?�high_waterlevel�stdin_avail�stdout_avail�i_buf�o_buf�rfds�wfds�_xfds�n�datas
             rrBrBzs���

���y�!�	���	�5�)�	-��)���L�
�O�O�I�t�,���O��|�+�K��
�-�L��E��E�
������3�u�:��7��K�K��%��C��J��8��K�K�	�"��C��J��N��K�K�
�&��u�:��>��K�K�	�"�"�4��r�2���d�E��D� �
%��H�H�]�E�2���a�b�	�����
�"�9�-�����T�M�E��������E�*�A��!�"�I�E��<�4�/��l�+�D��#����
��U��
�O�O�I�t�,��2�
%�$��
%���
���
�s/�F�F#�7F4�F �#F1�0F1�4G�Gc��t|t�r|f}tjd|�t	�\}}|t
k(rt
j|dg|���	tt�}tt�d}	t|||�|r tttj�	t!|�t#|d�dS#tj$rd}Y�awxYw#|r tttj�wwxYw)zCreate a spawned process.z	pty.spawnrTFr)�
isinstance�str�sys�auditr
r5r�execlprrCr�tty�errorrBr�	TCSAFLUSHrr)�argvr>r?r8r�mode�restores       rrr�s����$����w���I�I�k�4� ��V�N�C��
�e�|�
�	�	�$�q�'�!�D�!����&���|����9�
�i��j�1���l�C�M�M�4�8�	�)���3��?�1�����9�9��������l�C�M�M�4�8��s� C�;
C�C�C�$D)�__doc__rrrUrXrrrrr�__all__rCrD�
STDERR_FILENOr5r	r rrr
r;rBr�r<r�<module>rbsq�� ��	�
�
��,�,�
&�����
��
�	��
��&
(��*�8�"'�5�?�B"�e�r<