usr/lib64/python3.6/__pycache__/pty.cpython-36.pyc000064400000007427147204631270015537 0ustar003 \@sdZddlmZddlZddlZdddgZdZdZdZdZd dZ d d Z d d Z ddZ ddZ ddZddZeefddZeefddZdS)zPseudo terminal utilities.)selectNopenptyforkspawnc Cs<ytjSttfk r YnXt\}}t|}||fS)zdopenpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.)osrAttributeErrorOSError_open_terminal slave_open) master_fd slave_nameslave_fdr/usr/lib64/python3.6/pty.pyrs c CsLytj\}}Wnttfk r(YnXtj|}tj|||fStS)zmaster_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.)rrr r ttynamecloser )r rrrrr master_open!s  rc Cslx^dD]V}xPdD]H}d||}ytj|tj}Wntk rHwYnX|d||fSWqWtddS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)ropenO_RDWRr )xyZpty_namefdrrrr 1s   r cCsntj|tj}yddlm}m}Wntk r6|SXy|||d|||dWntk rhYnX|S)zslave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.r)ioctlI_PUSHZptemZldterm)rrrZfcntlrr ImportErrorr )Ztty_nameresultrrrrrr =s r cCsytj\}}Wnttfk r(Yn4X|tkrTy tjWntk rRYnX||fSt\}}tj}|tkrtjtj|tj |t tj |t tj |t |t krtj|tj tjt tj}tj|n tj|||fS)zdfork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.)rforkptyr r CHILDsetsidrrrdup2 STDIN_FILENO STDOUT_FILENO STDERR_FILENOrrr)pidrr rZtmp_fdrrrrOs0         cCs&x |r tj||}||d}qWdS)z#Write all the data to a descriptor.N)rwrite)rdatanrrr_writenws r)cCs tj|dS)zDefault read function.i)rread)rrrr_read}sr+cCsz|tg}xlt|gg\}}}||krH||}|s<|j|n tjt|t|kr |t}|sh|jtq t||q WdS)zParent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)N)r"rremoverr&r#r))r master_read stdin_readZfdsZrfdsZwfdsZxfdsr'rrr_copys   r/cCst|tdkr|f}t\}}|tkrs"    (