HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/pexpect/__pycache__/utils.cpython-39.pyc
a

��!^��@s�ddlZddlZddlZddlZddlZddlZzeWneyPejZYn0ej	ddkrhe
fZnee
fZdd�Z
d
dd�Zdd�Zdd	d
�Zddd�ZdS)�N�cCshtj�|�}tj�|�sdSt�|�j}tj�d�rZt�	�dkrZt
|tjtjBtj
B@�St�|tj�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)``.
    FZsunosr)�os�path�realpath�isfile�stat�st_mode�sys�platform�
startswith�getuid�bool�S_IXUSR�S_IXGRP�S_IXOTH�access�X_OK)rZfpath�mode�r�1/usr/lib/python3.9/site-packages/pexpect/utils.py�is_executable_files
���rcCsvtj�|�dkrt|�r|S|dur*tj}|�d�}|s>tj}|�tj�}|D]"}tj�	||�}t|�rN|SqNdS)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)
rr�dirnamer�environ�get�defpath�split�pathsep�join)�filename�env�pZpathlistrZffrrr�which0s

r#c
Csg}d}d}d}d}d}d}|}|D]�}	||ks8||kr�|	dkrF|}q�|	dkrT|}q�|	d	krb|}q�|	��r�||krtq�|�|�d}|}q�||	}|}q$||kr�||	}|}q$||kr�|	dkr�|}q�||	}q$||kr$|	d	kr�|}q$||	}q$|dkr�|�|�|S)
aThis 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. rr��r��\�'�")�isspace�append)
Zcommand_line�arg_list�argZstate_basicZ	state_escZstate_singlequoteZstate_doublequoteZstate_whitespace�state�crrr�split_command_lineEsL



r0cCs�|durt��|}zt�||||�WSty�t��d}|jdtjkr||dur~|t��}|dkr~gggfYSn�Yq0qdS)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). Nr$r)�time�select�InterruptedErrorr	�exc_info�args�errno�EINTR)ZiwtdZowtdZewtd�timeout�end_time�errrrr�select_ignore_interrupts�s	r;cCs�|durt��|}t��}|D]$}|�|tjtjBtjBtjB�q z.|durTdn|d}|�|�}dd�|D�WSty�t	�
�d}|jdtj
kr�|dur�|t��}|dkr�gYSn�YqF0qFdS)zOSimple wrapper around poll to register file descriptors and
    ignore signals.Ni�cSsg|]\}}|�qSrr)�.0Zafd�_rrr�
<listcomp>��z*poll_ignore_interrupts.<locals>.<listcomp>r$r)r1r2Zpoll�registerZPOLLINZPOLLPRIZPOLLHUPZPOLLERRr3r	r4r5r6r7)Zfdsr8r9Zpoller�fdZ
timeout_ms�resultsr:rrr�poll_ignore_interrupts�s""

rC)N)N)N)rr	rr2r1r6r3�	NameError�error�version_info�strZstring_typesZunicoderr#r0r;rCrrrr�<module>s"
=