ڛac @ s d Z d d l Z d d l Z d d l Z d d l Z e j d d k Z e rX e Z n d Z
d Z d e f d YZ
d d
Z d d Z d S(
sE Generic wrapper for read-eval-print-loops, a.k.a. interactive shells
iNi i u [PEXPECT_PROMPT>u [PEXPECT_PROMPT+t REPLWrapperc B sG e Z d Z e e d d Z d Z d e d Z d e d Z
RS( s 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.
c C s t | t r0 t j | d t d d | _ n | | _ | j j re | j j t | j j n | d k r} | | _
n% | j | | j | | | | _
| | _
| j | d k r | j | n d S( Nt echot encodings utf-8( t
isinstancet
basestringt pexpectt spawnt Falset childR t setechot
waitnoechot Nonet promptt
set_promptt formatt continuation_promptt _expect_promptt run_command( t selft cmd_or_spawnt orig_promptt
prompt_changet
new_promptR t extra_init_cmd( ( s3 /tmp/pip-install-ztITAX/pexpect/pexpect/replwrap.pyt __init__! s !
c C s$ | j j | | j j | d S( N( R t expectt sendline( R R R ( ( s3 /tmp/pip-install-ztITAX/pexpect/pexpect/replwrap.pyR
<