�
��e? � � � d Z ddlZddlZddlZddlZej d dk\ ZereZ dZ
dZ G d� de� Z
ej fd�Zd � Zdd
�Zd
d�Zy)zEGeneric wrapper for read-eval-print-loops, a.k.a. interactive shells
� N� z[PEXPECT_PROMPT>z[PEXPECT_PROMPT+c �4 � e Zd ZdZeedfd�Zd� Zdd�Zdd�Z y)�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.
Nc � � t |t � rt j |dd�� | _ n|| _ | j j
r5| j j
d� | j j � |�|| _ n)| j ||j ||� � || _ || _ | j � |�| j |� y y )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_cmds �2/usr/lib/python3/dist-packages/pexpect/replwrap.py�__init__zREPLWrapper.__init__! s� � � �l�J�/� ���|�%�'�R�D�J�%�D�J��:�:�?�?�
�J�J���u�%��J�J�!�!�#�� �%�D�K��O�O�K�%�,�,�Z�9L�M�
O�$�D�K�#6�� ������%����^�,� &� c �p � | j j |� | j j |� y )N)r �expect�sendline)r r r s r r zREPLWrapper.set_prompt< |