/usr/lib/python3/dist-packages/pexpect/__pycache__
Edit: /usr/lib/python3/dist-packages/pexpect/__pycache__/utils.cpython-310.pyc (3764B)
o
ÿé!^ƒ ã @ s¢ d dl Z d dlZd dlZd dlZd dlZd dlZze W n ey( ejZY nw ej d dkr4e
fZnee
fZdd„ Z
d
dd„Zdd„ Zd
d d
„Zd
dd„ZdS )é Né c C sh t j | ¡}t j |¡sdS t |¡j}tj d¡r-t ¡ dkr-t
|tjtjB tj
B @ ƒS t |t j¡S )zšChecks that path is an executable regular file, or a symlink towards one.
This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
FÚsunosr )ÚosÚpathÚrealpathÚisfileÚstatÚst_modeÚsysÚplatformÚ
startswithÚgetuidÚboolÚS_IXUSRÚS_IXGRPÚS_IXOTHÚaccessÚX_OK)r ÚfpathÚmode© r ú//usr/lib/python3/dist-packages/pexpect/utils.pyÚis_executable_file s ÿþr c C sv t j | ¡dkrt| ƒr| S |du rt j}| d¡}|st j}| t j¡}|D ]}t j || ¡}t|ƒr8| S q'dS )zÐThis takes a given filename; tries to find it in the environment path;
then checks if it is executable. This returns the full path to the filename
if found and executable. Otherwise this returns None.Ú NÚPATH)
r r Údirnamer ÚenvironÚgetÚdefpathÚsplitÚpathsepÚjoin)ÚfilenameÚenvÚpÚpathlistr Úffr r r Úwhich0 s
ÿr' c
C s g }d}d}d}d}d}d}|}| D ]c} ||ks||krK| dkr#|}q| dkr*|}q| d kr1|}q| ¡ rD||kr:q| |¡ d}|}q|| }|}q||krV|| }|}q||krf| dkra|}q|| }q||kru| d krq|}q|| }q|dkr| |¡ |S )
a This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command line. r r é é r é ú\ú'ú")ÚisspaceÚappend)
Úcommand_lineÚarg_listÚargÚstate_basicÚ state_escÚstate_singlequoteÚstate_doublequoteÚstate_whitespaceÚstateÚcr r r Úsplit_command_lineE sN
€
r: c C sˆ |dur
t ¡ | } z t | |||¡W S tyB t ¡ d }|jd tjkr?|dur>|t ¡ }|dk r>g g g f Y S n‚ Y nw q)zæThis is a wrapper around select.select() that ignores signals. If
select.select raises a select.error exception and errno is an EINTR
error then it is ignored. Mainly this is used to ignore sigwinch
(terminal resize). NTr( r )ÚtimeÚselectÚInterruptedErrorr
Úexc_infoÚargsÚerrnoÚEINTR)ÚiwtdÚowtdÚewtdÚtimeoutÚend_timeÚerrr r r Úselect_ignore_interrupts‚ s" €€ôýrH c C sÐ |dur
t ¡ | }t ¡ }| D ]}| |tjtjB tjB tjB ¡ q z|du r+dn|d }| |¡}dd„ |D ƒW S tyf t
¡ d }|jd tj
krc|durb|t ¡ }|dk rbg Y S n‚ Y nw q$)zOSimple wrapper around poll to register file descriptors and
ignore signals.NTiè c S s g | ]\}}|‘qS r r )Ú.0ÚafdÚ_r r r Ú
® s z*poll_ignore_interrupts..r( r )r; r<