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/pexpect/__pycache__/replwrap.cpython-310.pyc
o

�h?�@s�dZddlZddlZddlZddlZejddkZereZ	dZ
dZGdd�de�Z
ejfdd	�Zd
d�Zdd
d�Zddd�ZdS)zEGeneric wrapper for read-eval-print-loops, a.k.a. interactive shells
�N�z[PEXPECT_PROMPT>z[PEXPECT_PROMPT+c@s<eZdZdZeedfdd�Zdd�Zd
d	d
�Zd
dd�Z	dS)�REPLWrappera�Wrapper for a REPL.

    :param cmd_or_spawn: This can either be an instance of :class:`pexpect.spawn`
      in which a REPL has already been started, or a str command to start a new
      REPL process.
    :param str orig_prompt: The prompt to expect at first.
    :param str prompt_change: A command to change the prompt to something more
      unique. If this is ``None``, the prompt will not be changed. This will
      be formatted with the new and continuation prompts as positional
      parameters, so you can use ``{}`` style formatting to insert them into
      the command.
    :param str new_prompt: The more unique prompt to expect after the change.
    :param str extra_init_cmd: Commands to do extra initialisation, such as
      disabling pagers.
    NcCs�t|t�rtj|ddd�|_n||_|jjr!|j�d�|j��|dur)||_n
|�	||�
||��||_||_|��|durH|�
|�dSdS)NF�utf-8��echo�encoding)�
isinstance�
basestring�pexpect�spawn�childr�setecho�
waitnoecho�prompt�
set_prompt�format�continuation_prompt�_expect_prompt�run_command)�self�cmd_or_spawn�orig_prompt�
prompt_change�
new_promptr�extra_init_cmd�r�C/usr/local/CyberCP/lib/python3.10/site-packages/pexpect/replwrap.py�__init__!s"


��zREPLWrapper.__init__cCs|j�|�|j�|�dS)N)r�expect�sendline)rrrrrrr<szREPLWrapper.set_prompt���FcCs|jj|j|jg||d�S)N)�timeout�async_)r�expect_exactrr)rr!r"rrrr@s�zREPLWrapper._expect_promptcCs�|��}|�d�r|�d�|std��|r"ddlm}||||�Sg}|j�|d�|dd�D]}|j|d�|�|jj	�|j�|�q2|j|d�dkrc|j�
tj�|jdd�td	|��d�
||jj	g�S)
a0Send a command to the REPL, wait for and return output.

        :param str command: The command to send. Trailing newlines are not needed.
          This should be a complete block of input that will trigger execution;
          if a continuation prompt is found after sending input, :exc:`ValueError`
          will be raised.
        :param int timeout: How long to wait for the next prompt. -1 means the
          default from the :class:`pexpect.spawn` object (default 30 seconds).
          None means to wait indefinitely.
        :param bool async_: On Python 3.4, or Python 3.3 with asyncio
          installed, passing ``async_=True`` will make this return an
          :mod:`asyncio` Future, which you can yield from to get the same
          result that this method would normally give directly.
        �
�zNo command was given�)�repl_run_command_asyncrN)r!z2Continuation prompt found - input was incomplete:
)�
splitlines�endswith�append�
ValueError�_asyncr'rrr�before�kill�signal�SIGINT�join)r�commandr!r"�cmdlinesr'�res�linerrrrDs*

�zREPLWrapper.run_command)r F)
�__name__�
__module__�__qualname__�__doc__�PEXPECT_PROMPT�PEXPECT_CONTINUATION_PROMPTrrrrrrrrrs
�
rcCst|dd�S)z>Start a Python shell and return a :class:`REPLWrapper` object.z>>> z(import sys; sys.ps1={0!r}; sys.ps2={1!r})r)r2rrr�pythonosr<cCsftj||ddd�}tdd�|tdd�}tdd�|tdd�}d�||�}t|d|dd�S)	NFrr�z%PS1='{0}' PS2='{1}' PROMPT_COMMAND=''z\$zexport PAGER=cat)r)r
rr:r;rr)r2�args�non_printable_insertr�ps1�ps2rrrr�_repl_shss�rB�bashcCs(tj�tj�t�d�}t|d|gdd�S)z<Start a bash shell and return a :class:`REPLWrapper` object.z	bashrc.shz--rcfilez\[\]�r?)�os�pathr1�dirname�__file__rB)r2�bashrcrrrrC�s�zsh�z--no-rcsz-Vz+ZcCst|t|�dd�S)z;Start a zsh shell and return a :class:`REPLWrapper` object.z%(!..)rD)rB�list)r2r>rrrrJ�s)rC)rJrK)r9�os.pathrEr/�sysr
�version_info�PY3�strr	r:r;�objectr�
executabler<rBrCrJrrrr�<module>s^