文件操作 - utils.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/pexpect/__pycache__/utils.cpython-311.pyc
编辑文件内容
� ��!^� � � � d dl Z d dlZd dlZd dlZd dlZd dlZ e n# e$ r ej ZY nw xY wej d dk re fZnee fZd� Z dd�Zd� Zdd�Zdd�ZdS ) � N� c �� � t j � | � � }t j � |� � sdS t j |� � j }t j � d� � rMt j � � dk r6t |t j t j z t j z z � � S t j |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�modes �//usr/lib/python3/dist-packages/pexpect/utils.py�is_executable_filer s� � � �G���T�"�"�E� �7�>�>�%� � � ��u� �7�5�>�>�!�D������(�(� +�� ���q� � � �D�D�L� �L�)� �L�)� *� +� +� +� �9�U�B�G�$�$�$� c �~ � t j � | � � dk rt | � � r| S |�t j }|� d� � }|st j }|� t j � � }|D ]5}t j � || � � }t |� � r|c S �6dS )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 �ffs r �whichr* 0 s� � � �w���x� � �B�&�&�+=�h�+G�+G�&��� �{��j��������A�� ��J���w�w�r�z�"�"�H�� � �� �W�\�\�$�� )� )���b�!�!� ��I�I�I� ��4r c � � g }d}d}d}d}d}d}|}| D ]�} ||k s||k rX| dk r|}�| dk r|}� | d k r|}�)| � � � r!||k r�D|� |� � d}|}�^|| z }|}�f||k r|| z }|}�t||k r| dk r|}��|| z }��||k r| d k r|}��|| z }��|dk r|� |� � |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�cs r �split_command_liner>