File: //usr/local/lib/python3.10/dist-packages/numpy/distutils/__pycache__/_shell_utils.cpython-310.pyc
o
���g5
� @ s� d Z ddlZddlZddlZzddlmZ W n ey% ddlmZ Y nw g d�ZG dd� d�ZG dd� d�Z G d d
� d
�Z
ejdkrHe ZdS ejdkrQe
ZdS dS )
zq
Helper functions for interacting with the shell, and consuming shell-style
parameters provided in config files.
� N��quote)�
WindowsParser�PosixParser�NativeParserc @ �( e Zd ZdZedd� �Zedd� �ZdS )�CommandLineParsera
An object that knows how to split and join command-line arguments.
It must be true that ``argv == split(join(argv))`` for all ``argv``.
The reverse neednt be true - `join(split(cmd))` may result in the addition
or removal of unnecessary escaping.
c C � t �)z5 Join a list of arguments into a command line string ��NotImplementedError��argv� r �G/usr/local/lib/python3.10/dist-packages/numpy/distutils/_shell_utils.py�join � zCommandLineParser.joinc C r )z6 Split a command line string into a list of arguments r
��cmdr r r �split r zCommandLineParser.splitN��__name__�
__module__�__qualname__�__doc__�staticmethodr r r r r r r s
r c @ r )r z�
The parsing behavior used by `subprocess.call("string")` on Windows, which
matches the Microsoft C/C++ runtime.
Note that this is _not_ the behavior of cmd.
c C s
t �| �S �N)�
subprocess�list2cmdliner r r r r * s
zWindowsParser.joinc s� dd l }z|j W n ty t�w | sg S d| } |jjj}|�|j�|_|j|�|j �f|_
|� � }|| |�|��� � fdd�t|j
�D �}|jj�� �rRJ �|d dksZJ �|dd � S )Nr zdummy c s g | ]}� | �qS r r )�.0�i��lpargsr r �
<listcomp>C s z'WindowsParser.split.<locals>.<listcomp>�dummy� )�ctypes�windll�AttributeErrorr �shell32�CommandLineToArgvW�POINTER� c_wchar_p�restype�c_int�argtypes�byref�range�value�kernel32� LocalFree)r r% r) �nargs�argsr r r r / s$
�
zWindowsParser.splitNr r r r r r # s
r c @ r )r zX
The parsing behavior used by `subprocess.call("string", shell=True)` on Posix.
c C s d� dd� | D ��S )N� c s s � | ]}t |�V qd S r r )r �argr r r � <genexpr>Q s � z#PosixParser.join.<locals>.<genexpr>)r r r r r r O s zPosixParser.joinc C s t j| dd�S )NT)�posix)�shlexr r r r r r S s zPosixParser.splitNr r r r r r K s
r �ntr9 )
r �osr: r r �ImportError�pipes�__all__r r r �namer r r r r �<module> s$ �(
�