HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/__pycache__/subprocess.cpython-310.pyc
o

�h�*�@s�dZddlmZmZmZmZddlmZmZmZm	Z	ddl
mZddlm
Z
ddlmZer6ddlmZmZegd	fZGd
d�dee�ZGdd
�d
ee�ZGdd�dee�ZGdd	�d	ee�ZGdd�de
e�ZdS)zSSH subprocess handlers�)�
TYPE_CHECKING�Any�AnyStr�Callable)�Dict�Generic�Iterable�Optional�)�EXTENDED_DATA_STDERR)�SSHClientProcess)�DataType)�
SSHChannel�SSHClientChannel�SSHSubprocessProtocolc@sHeZdZdZ	ddddefdd�Zdd	d
�Zddededefd
d�Z	dS)�SSHSubprocessPipezSSH subprocess pipeN�chan�SSHClientChannel[AnyStr]�datatypecCs||_||_dS�N)�_chan�	_datatype)�selfrr�r�F/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/subprocess.py�__init__*s
zSSHSubprocessPipe.__init__�returncC�|j��dS)zShut down the remote processN)r�close�rrrrr/�zSSHSubprocessPipe.close�name�defaultcCs|j�||�S)a>Return additional information about the remote process

           This method returns extra information about the channel
           associated with this subprocess. See :meth:`get_extra_info()
           <SSHClientChannel.get_extra_info>` on :class:`SSHClientChannel`
           for additional information.

        )r�get_extra_info)rr!r"rrrr#4s
z SSHSubprocessPipe.get_extra_infor�rN)
�__name__�
__module__�__qualname__�__doc__r
rr�strrr#rrrrr's�
�
rc@s$eZdZdZddd�Zddd�ZdS)	�SSHSubprocessReadPipezSSH subprocess pipe readerrNcCr)z7Pause delivery of incoming data from the remote processN)r�
pause_readingrrrrr+Dr z#SSHSubprocessReadPipe.pause_readingcCr)z8Resume delivery of incoming data from the remote processN)r�resume_readingrrrrr,Ir z$SSHSubprocessReadPipe.resume_readingr$)r%r&r'r(r+r,rrrrr*As
r*c@s�eZdZdZddd�Zdefdd�Zdefdd	�Z		dd
e	ede	eddfdd
�Z
deddfdd�Zde
eddfdd�Zddd�ZdS)�SSHSubprocessWritePipezSSH subprocess pipe writerrNcCr)z0Forcibly close the channel to the remote processN)r�abortrrrrr.Rr zSSHSubprocessWritePipe.abortcC�
|j��S)z2Return whether the pipe supports :meth:`write_eof`)r�
can_write_eofrrrrr0W�
z$SSHSubprocessWritePipe.can_write_eofcCr/)z3Return the current size of the pipe's output buffer)r�get_write_buffer_sizerrrrr2\r1z,SSHSubprocessWritePipe.get_write_buffer_size�high�lowcCs|j�||�dS)z9Set the high- and low-water limits for write flow controlN)r�set_write_buffer_limits)rr3r4rrrr5asz.SSHSubprocessWritePipe.set_write_buffer_limits�datacC�|j�||j�dS)zWrite data on this pipeN)r�writer)rr6rrrr8g�zSSHSubprocessWritePipe.write�list_of_datacCr7)z'Write a list of data bytes on this pipeN)r�
writelinesr)rr:rrrr;lr9z!SSHSubprocessWritePipe.writelinescCr)zWrite EOF on this pipeN)r�	write_eofrrrrr<qr z SSHSubprocessWritePipe.write_eofr$)NN)r%r&r'r(r.�boolr0�intr2r	r5rr8rr;r<rrrrr-Os
��
�r-c@s\eZdZdZ				ddd�Zded	eddfd
d�Zdedee	ddfd
d�Z
ddd�ZdS)ra�SSH subprocess protocol

       This class conforms to :class:`asyncio.SubprocessProtocol`, but with
       the following enhancement:

           * If encoding is set when the subprocess is created, all data
             passed to :meth:`pipe_data_received` will be string values
             containing Unicode data. However, for compatibility with
             :class:`asyncio.SubprocessProtocol`, encoding defaults to
             `None`, in which case all data is delivered as bytes.

    �	transport�SSHSubprocessTransport[AnyStr]rNcC�dS)a�Called when a remote process is successfully started

           This method is called when a remote process is successfully
           started. The transport parameter should be stored if needed
           for later use.

           :param transport:
               The transport to use to communicate with the remote process.
           :type transport: :class:`SSHSubprocessTransport`

        Nr)rr?rrr�connection_made��z%SSHSubprocessProtocol.connection_made�fdr6cCrA)a�Called when data is received from the remote process

           This method is called when data is received from the remote
           process. If an encoding was specified when the process was
           started, the data will be delivered as a string after decoding
           with the requested encoding. Otherwise, the data will be
           delivered as bytes.

           :param fd:
               The integer file descriptor of the pipe data was received
               on. This will be 1 for stdout or 2 for stderr.
           :param data:
               The data received from the remote process
           :type fd: `int`
           :type data: `str` or `bytes`

        Nr)rrDr6rrr�pipe_data_received�rCz(SSHSubprocessProtocol.pipe_data_received�exccCrA)a�Called when the pipe to a remote process is closed

           This method is called when a pipe to a remote process is
           closed. If the channel is shut down cleanly, *exc* will be
           `None`. Otherwise, it will be an exception explaining the
           reason the pipe was closed.

           :param fd:
               The integer file descriptor of the pipe which was
               closed. This will be 1 for stdout or 2 for stderr.
           :param exc:
               The exception which caused the channel to close, or
               `None` if the channel closed cleanly.
           :type fd: `int`
           :type exc: :class:`Exception` or `None`

        Nr)rrDrFrrr�pipe_connection_lost�rCz*SSHSubprocessProtocol.pipe_connection_lostcCrA)aCCalled when a remote process has exited

           This method is called when the remote process has exited.
           Exit status information can be retrieved by calling
           :meth:`get_returncode() <SSHSubprocessTransport.get_returncode>`
           on the transport provided in :meth:`connection_made`.

        Nrrrrr�process_exited�rCz$SSHSubprocessProtocol.process_exited)r?r@rNr$)r%r&r'r(rBr>rrEr	�	ExceptionrGrHrrrrrws
�
�c
seZdZUdZded<def�fdd�Zdeefdd	�Z	d(�fd
d�Z
d)dd�Zdee
ddf�fdd�Zdededdfdd�Zdeddf�fdd�Zdededededdf
�fdd �Zdeefd!d"�Zd#edeeefd$d%�Zdeefd&d'�Z�ZS)*�SSHSubprocessTransportaSSH subprocess transport

       This class conforms to :class:`asyncio.SubprocessTransport`, but with
       the following enhancements:

           * All functionality available through :class:`SSHClientProcess`
             is also available here, such as the ability to dynamically
             redirect stdin, stdout, and stderr at any time during the
             lifetime of the process.

           * If encoding is set when the subprocess is created, all data
             written to the transports created by :meth:`get_pipe_transport`
             should be strings containing Unicode data. The encoding defaults
             to `None`, though, to preserve compatibility with
             :class:`asyncio.SubprocessTransport`, which expects data
             to be written as bytes.

    rr�protocol_factorycst���i|_|�|_dSr)�superr�_pipes�	_protocol)rrK��	__class__rrr�s
zSSHSubprocessTransport.__init__rcC�|jS)z=Return the subprocess protocol associated with this transport)rNrrrr�get_protocol�sz#SSHSubprocessTransport.get_protocolr�SSHChannel[AnyStr]Ncs>t��|�|j�|�t|j�t|j�t|jt�d�|_dS)zHandle a newly opened channel)rr
�N)rLrBrNr-rr*rrM)rrrOrrrB�s
�z&SSHSubprocessTransport.connection_madecCrA)z�Override SSHClientProcess to avoid creating SSHReader/SSHWriter
           streams, since this class uses read/write pipe objects insteadNrrrrr�session_started�rCz&SSHSubprocessTransport.session_startedrFcs,|j�d|�|j�d|�t��|�dS)z Handle an incoming channel closer
rTN)rNrGrL�connection_lost)rrFrOrrrV�sz&SSHSubprocessTransport.connection_lostr6rcCs@|j�|�}|r|�|�dS|tkrdnd}|j�||�dS)z,Handle incoming data from the remote processrTr
N)�_writers�getr8rrNrE)rr6r�writerrDrrr�
data_received�s
z$SSHSubprocessTransport.data_received�statuscst��|�|j��dS)z)Handle exit status for the remote processN)rL�exit_status_receivedrNrH)rr[rOrrr\sz+SSHSubprocessTransport.exit_status_received�signal�core_dumped�msg�langcs t��||||�|j��dS)z)Handle exit signal for the remote processN)rL�exit_signal_receivedrNrH)rr]r^r_r`rOrrrasz+SSHSubprocessTransport.exit_signal_receivedcCrA)z�Return the PID of the remote process

           This method always returns `None`, since SSH doesn't report
           remote PIDs.

        Nrrrrr�get_pids
zSSHSubprocessTransport.get_pidrDcCs|j�|�S)amReturn a transport for the requested stream

           :param fd:
               The integer file descriptor (0-2) to return the transport for,
               where 0 means stdin, 1 means stdout, and 2 means stderr.
           :type fd: `int`

           :returns: an :class:`SSHSubprocessReadPipe` or
                     :class:`SSHSubprocessWritePipe`

        )rMrX)rrDrrr�get_pipe_transport!sz)SSHSubprocessTransport.get_pipe_transportcCrQ)a�Return the exit status or signal for the remote process

           This method returns the exit status of the session if one has
           been sent. If an exit signal was sent, this method returns
           the negative of the numeric value of that signal, matching
           the behavior of :meth:`asyncio.SubprocessTransport.get_returncode`.
           If neither has been sent, this method returns `None`.

           :returns: `int` or `None`

        )�
returncoderrrr�get_returncode1s
z%SSHSubprocessTransport.get_returncode)rrSrNr$)r%r&r'r(�__annotations__�SubprocessFactoryrrrrRrBrUr	rIrVr
rZr>r\r)r=rarbrrcre�
__classcell__rrrOrrJ�s,



���

�rJN)r(�typingrrrrrrrr	�	constantsr�processr�sessionr
�channelrrrgrr*r-rrJrrrr�<module>s(M