PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  Ɵ[c@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z yddl Z Wne k rddlZ nXddlmZmZddlmZmZe jjZejdpejdZer8eZddlmZneZe jdd kZercd Z n5d Z d e!fd YZ"de!fdYZ#e$e$f\a%a&dZ'dZ(dZ)de*fdYZ+de+fdYZ,dS(iN(t STDIN_FILENOtCHILDi(twhichtPtyProcessErrortsolaristsunos(t _fork_ptyiicCs t|gS(N(tbytes(ti((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt_byte(scCs t|S(N(tchr(R((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR +stFileNotFoundErrorcBseZRS((t__name__t __module__(((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR .st TimeoutErrorcBseZRS((R R (((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR/sc Cstdk rtdk rdSyddlm}m}d}xmd D]e}ttd|d}|dksBt|d rqBny|j }WqBt k rqBqBXqBW|dkrt dnt tj |d |}t tj |d |}Wnjt ttt tjfk rmy'dd lm}m}||}}Wqnt k rid\}}qnXnXt|at|adS(skSet constants _EOF and _INTR. This avoids doing potentially costly operations on module load. Ni(tVEOFtVINTRtstdintstdouts__%s__tfilenosNo stream has a filenoi(tCEOFtCINTRii(sstdinsstdout(ii(t_EOFtNonet_INTRttermiosRRtgetattrtsysthasattrRt ValueErrortordt tcgetattrt ImportErrortOSErrortIOErrorterrorRRR ( RRtfdtnametstreamtintrteofRR((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt_make_eof_intr3s2    !  cCs d}ytj|}WnYtjk rt}|jdtjkrnt|jdd|jd|fnnX|r|dtjB|dtk r} | jdtjtjtj<fkrqnX|S(s%Start the given command in a child process in a pseudo terminal. This does all the fork/exec type of stuff for a pty, and returns an instance of PtyProcess. If preexec_fn is supplied, it will be called with no arguments in the child process before exec-ing the specified command. It may, for instance, set signal handlers to SIG_DFL or SIG_IGN. Dimensions of the psuedoterminal used for the subprocess can be specified as a tuple (rows, cols), or the default (24, 80) will be used. s)Expected a list or tuple for argv, got %ris%The command was not found or was not sexecutable: %s.iiis{}:0:{}sutf-8s OSError:{}:{}it:iR@RAs)Subprocess failed, got bad error data: %rN(=t isinstancetlistttuplet TypeErrorRRR tostpipetuse_native_pty_forktptytforkRtfork_ptyRR>RR"R*R+R,tENOTTYR4RORR#tcloseR9tF_SETFDt FD_CLOEXECtmintresourcet getrlimitt RLIMIT_NOFILEt closerangetchdirt ExceptionttypeR tformattstrtPY3tencodeRCt_exittexecvtexecvpeR!tEX_OSERRtargvtenvt launch_dirtreadtlentsplitRtbuiltinsREtintt setwinsizetENXIO(tclsR}tcwdR~techot preexec_fnt dimensionstcommandtcommand_with_pathtexec_err_pipe_readtexec_err_pipe_writeRLR$R3tmax_fdtetenamettosendtinstt exec_err_dataterrclassterrno_sR1texctypet exception((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytspawns                       % cCst|j}|jdk rt|jg}|jdk rV|jd|jn|jdk r||jd|jndj|dj |Sdj||j |j SdS(Nsenv=%rscwd=%rs {}.spawn({})s, s{}(pid={}, fd={})( RtR R}RtreprR~tappendRRutjoinRLR$(RZtclsnameR*((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt__repr__TscCs t|ts|jdS|S(Nsutf-8(R_RRx(R=((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt_coerce_send_stringbs cCs|S(N((R=((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt_coerce_read_stringhscCs(|js$y|jWq$q$XndS(sLThis makes sure that no system resources are left open. Python only garbage collects Python objects. OS file descriptors are not Python objects, so they must be handled explicitly. If the child file descriptor was opened outside of this class (passed to the constructor) then this does not close it. N(RSRj(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt__del__ls  cCs|jS(sCThis returns the file descriptor of the pty for the child. (R$(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR~scCsv|jsr|j|jjtj|j|jr]|j|s]t dq]nd|_ t |_ndS(s?This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the child ignores SIGHUP and SIGINT). sCould not terminate the child.iN( RStflushRQRjttimetsleepRXtisalivet terminateRR$tTrue(RZtforce((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRjs     cCsdS(sWThis does nothing. It is here to support the interface for a File-like object. N((RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRscCstj|jS(s^This returns True if the file descriptor is open and connected to a tty(-like) device, else False. On SVR4-style platforms implementing streams, such as SunOS and HP-UX, the child pty may not appear as a terminal device. This means methods such as setecho(), setwinsize(), getwinsize() may raise an IOError. (RctisattyR$(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs cCs|dk rtj|}nxbtr|js8tS|dkrT|dk rTtS|dk rs|tj}ntjdq"WdS(sThis waits until the terminal ECHO flag is set False. This returns True if the echo mode is off. This returns False if the ECHO flag was not set False before the timeout. This can be used to detect when the child is waiting for a password. Usually a child application will turn off echo mode when it is waiting for the user to enter a password. For example, instead of expecting the "password:" prompt you can wait for the child to set ECHO off:: p = pexpect.spawn('ssh user@example.com') p.waitnoecho() p.sendline(mypassword) If timeout==None then this method to block until ECHO flag is False. ig?N(RRRtgetechoROR(RZttimeouttend_time((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt waitnoechos    cCsytj|j}Wn_tjk rw}d}|jdtjkrqt|jdd|jd|fnnXt|dtj @|_ |j S(sThis returns the terminal echo mode. This returns True if echo is on or False if echo is off. Child applications that are expecting you to enter a password often set ECHO False. See waitnoecho(). Not supported on platforms where ``isatty()`` returns False. s,getecho() may not be called on this platformis%s: %s.ii( RRR$R#R*R+R,R"tboolR-R(RZR2R3R1((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs*cCst|j|||_dS(sZThis sets the terminal echo mode on or off. Note that anything the child sent before the echo will be lost, so you should be sure that your input buffer is empty before you call setecho(). For example, the following will work as expected:: p = pexpect.spawn('cat') # Echo is on by default. p.sendline('1234') # We expect see this twice from the child... p.expect(['1234']) # ... once from the tty echo... p.expect(['1234']) # ... and again from cat itself. p.setecho(False) # Turn off tty echo p.sendline('abcd') # We will set this only once (echoed by cat). p.sendline('wxyz') # We will set this only once (echoed by cat) p.expect(['abcd']) p.expect(['wxyz']) The following WILL NOT WORK because the lines sent before the setecho will be lost:: p = pexpect.spawn('cat') p.sendline('1234') p.setecho(False) # Turn off tty echo p.sendline('abcd') # We will set this only once (echoed by cat). p.sendline('wxyz') # We will set this only once (echoed by cat) p.expect(['1234']) p.expect(['1234']) p.expect(['abcd']) p.expect(['wxyz']) Not supported on platforms where ``isatty()`` returns False. N(R4R$R(RZR0((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytsetechos icCsy|jj|}WnJttfk rb}|jdtjkr\t|_t dnnX|dkrt|_t dn|S(sRead and return at most ``size`` bytes from the pty. Can block if there is nothing to read. Raises :exc:`EOFError` if the terminal was closed. Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal with the vagaries of EOF on platforms that do strange things, like IRIX or older Solaris systems. It handles the errno=EIO pattern used on Linux, and the empty-string return used on BSD platforms and (seemingly) on recent Solaris. is,End Of File (EOF). Exception style platform.ts/End Of File (EOF). Empty string style platform.( RQtread1R!R"R*R+tEIORRWtEOFError(RZtsizeR=R3((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs    cCsy|jj}WnJttfk r_}|jdtjkrYt|_t dnnX|dkrt|_t dn|S(sRead one line from the pseudoterminal, and return it as unicode. Can block if there is nothing to read. Raises :exc:`EOFError` if the terminal was closed. is,End Of File (EOF). Exception style platform.Rs/End Of File (EOF). Empty string style platform.( RQtreadlineR!R"R*R+RRRWR(RZR=R3((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs   cCs,|jj|}|r(|jjn|S(N(RQRCR(RZRFRtn((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt_writeb'scCs|j|d|S(saWrite bytes to the pseudoterminal. Returns the number of bytes written. R(R(RZR=R((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRC-scCs|j}t|}d|ko/dknrg|tdd}t|}|j||fSi dd6dd6dd 6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6}||krdSt||}|j||fS(sHelper method that wraps send() with mnemonic access for sending control character to the child (such as Ctrl-C or Ctrl-D). For example, to send Ctrl-G (ASCII 7, bell, ''):: child.sendcontrol('g') See also, sendintr() and sendeof(). iaiztaiit@t`it[t{is\t|it]t}it^t~it_it?R(iR(tlowerRR R(RZtcharRtbytetd((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt sendcontrol4s"     cCs|jttfS(s1This sends an EOF to the child. This sends a character which causes the pending parent output buffer to be sent to the waiting child program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which signifies end-of-file. This means to work as expected a sendeof() has to be called at the beginning of a line. This method does not send a newline. It is the responsibility of the caller to ensure the eof is sent at the beginning of a line. (RR(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytsendeofPs cCs|jttfS(snThis sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line. (RR(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytsendintr\scCs|jS(s@This returns True if the EOF exception was ever raised. (RW(RZ((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR(bscCs!|jstSy|jtjtj|j|jsCtS|jtjtj|j|jsstS|jtj tj|j|jstS|r|jtj tj|j|jstSt Snt SWn5t k rtj|j|jstSt SnXdS(sThis forces a child process to terminate. It starts nicely with SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This returns True if the child was terminated. This returns False if the child could not be terminated. N( RRtkilltsignaltSIGHUPRRRYtSIGCONTtSIGINTtSIGKILLROR!(RZR((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRhs6       cCs|jr*tj|jd\}}n|jStj||_tj|r||_tj||_d|_ t |_ netj |r||_d|_tj ||_ t |_ n&tj|rtdddn|jS(smThis waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is technically still alive until its output is read by the parent. is!Called wait() on a stopped child s.process. This is not supported. Is some other s2process attempting job control with our child pid?N(RRctwaitpidRLRTt WEXITSTATUSt WIFEXITEDRVRRURRRt WIFSIGNALEDtWTERMSIGt WIFSTOPPEDR(RZRLRV((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytwaits&        cCs|jr tS|jrd}n tj}ytj|j|\}}WnCtk r}|jtj krt ddddqnX|dkrytj|j|\}}WnCtk r}|jtj krt ddddqnX|dkrt Sn|dkr!t Stj |r`||_ tj||_d |_t |_nitj|r||_ d |_tj||_t |_n*tj|rt dddd ntS( sZThis tests if the child process is running or not. This is non-blocking. If the child was terminated then this will read the exitstatus or signalstatus of the child. This returns True if the child process appears to be running or False if not. It can take literally SECONDS for Solaris to return the right status. is isalive() encountered condition s0where "terminated" is 0, but there was no child s)process. Did someone else call waitpid() son our process?s-that should never happen. There was no child s,where child process is stopped. This is not s,supported. Is some other process attempting sjob control with our child pid?N(RRRORWRctWNOHANGRRLR!R+tECHILDRRRRVRRTRRURRR(RZtwaitpid_optionsRLRVR((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRsR                   cCs&|jr"tj|j|ndS(sSend the given signal to the child application. In keeping with UNIX tradition it has a misleading name. It does not necessarily kill the child unless you send the right signal. See the :mod:`signal` module for constants representing signal numbers. N(RRcRRL(RZtsig((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs cCs\ttdd}tjddddd}tj|j||}tjd|dd!S(sNReturn the window size of the pseudoterminal as a tuple (rows, cols). t TIOCGWINSZiht@R6ii(RRR7R8R9R:R$tunpack(RZRR=tx((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyt getwinsizescCst|j||S(s@Set the terminal window size of the child tty. This will cause a SIGWINCH signal to be sent to the child. This does not change the physical window size. It changes the size reported to TTY-aware applications like vi or curses -- applications that respond to the SIGWINCH signal. (R>R$(RZR;R<((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRsN(iiP(1R R t__doc__Rt string_typeRwRctlinesepRxtcrlft staticmethodRGRRRCRtencodingR}R~RR]t classmethodRRRRRRRRjRRRRRRRRRRRR(RORRRRRR(((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR?sT            $        (  M tPtyProcessUnicodecBsPeZdZereZneZdddZddZdZ dZ RS(sUnicode wrapper around a process running in a pseudoterminal. This class exposes a similar interface to :class:`PtyProcess`, but its read methods return unicode, and its :meth:`write` accepts unicode. sutf-8tstrictcCsJtt|j||||_||_tj|d||_dS(Nterrors(tsuperRR]Rt codec_errorstcodecstgetincrementaldecodertdecoder(RZRLR$RR((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR]$s  icCs.tt|j|}|jj|dtS(sRead at most ``size`` bytes from the pty, return them as unicode. Can block if there is nothing to read. Raises :exc:`EOFError` if the terminal was closed. The size argument still refers to bytes, not unicode code points. tfinal(RRRRRERO(RZRRF((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR*scCs+tt|j}|jj|dtS(sRead one line from the pseudoterminal, and return it as unicode. Can block if there is nothing to read. Raises :exc:`EOFError` if the terminal was closed. R(RRRRRERO(RZRF((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyR5scCs(|j|j}tt|j|S(slWrite the unicode string ``s`` to the pseudoterminal. Returns the number of bytes written. (RxRRRRC(RZR=RF((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRC>s( R R RRwRvRtunicodeR]RRRC(((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pyRs  (-RR+R9RMRcRfRnRR7RRRRR t __builtin__RRtutilRRtplatformRt _platformt startswitht _is_solarisROReRRRt version_infoRwR R!R RRRRR)R4R>tobjectR?R(((s9/tmp/pip-build-ViqJzN/ptyprocess/ptyprocess/ptyprocess.pytsL                +