
    yIf[
                        d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	  G d de          Z
 G d	 d
          ZddZdZdS )z-Module declaring a command execution request.    )annotationsN)Enum)Path)Sequencec                  2    e Zd ZdZdZdZedd            ZdS )StdinSourcer         returnc                 n    t           j                                        rt          j        nt          j        S )z@:return: ``USER`` if the standard input is tty type else ``OFF``)sysstdinisattyr   USEROFF     G/var/www/piapp/venv/lib/python3.11/site-packages/tox/execute/request.py	user_onlyzStdinSource.user_only   s'     $'9#3#3#5#5J{;?Jr   N)r   r   )__name__
__module____qualname__r   r   APIstaticmethodr   r   r   r   r   r      sG        
CD
CK K K \K K Kr   r   c                  >    e Zd ZdZ	 dddZedd            ZddZdS )ExecuteRequestz%Defines a commands execution request.NcmdSequence[str | Path]cwdr   envdict[str, str]r   r   run_idstrallowlist[str] | Noner   Nonec                    t          |          dk    rd}t          |          d |D             | _        || _        || _        || _        || _        |d|v rd}|| _        dS )a$  
        Create a new execution request.

        :param cmd: the command to run
        :param cwd: the current working directory
        :param env: the environment variables
        :param stdin: the type of standard input allowed
        :param run_id: an id to identify this run
        r   zcannot execute an empty commandc                ,    g | ]}t          |          S r   r#   ).0is     r   
<listcomp>z+ExecuteRequest.__init__.<locals>.<listcomp>.   s    333!s1vv333r   N*)len
ValueErrorr   r   r    r   r"   r$   )selfr   r   r    r   r"   r$   msgs           r   __init__zExecuteRequest.__init__   ss    $ s88q==3CS//!33s333
E


r   c                &   	 t          t          | j        d                                       | j                            }n# t
          $ r | j        d         }Y nw xY w|g}|                    | j        dd                    t          |          S )z.:return: the command to run as a shell commandr   r	   N)r#   r   r   relative_tor   r/   extend	shell_cmd)r0   exe_cmds      r   r6   zExecuteRequest.shell_cmd7   s    	d48A;''33DH==>>CC 	 	 	(1+CCC	uDHQRRL!!!s   ?A AAc                P    | j         j         d| j        d| j        d| j        dS )Nz(cmd=z, cwd=z, env=..., stdin=))	__class__r   r   r   r   )r0   s    r   __repr__zExecuteRequest.__repr__B   s6    .)nnnn$(nn_c_innnnr   N)r   r   r   r   r    r!   r   r   r"   r#   r$   r%   r   r&   )r   r#   )r   r   r   __doc__r2   propertyr6   r<   r   r   r   r   r      sr        // #'    <    Xo o o o o or   r   r   Sequence[str]r   r#   c                    t           j        dk    r(ddlm}  |t	          d | D                                 S ddlm d                    fd| D                       S )Nwin32r   )list2cmdlinec              3  4   K   | ]}t          |          V  d S r=   r)   )r*   xs     r   	<genexpr>zshell_cmd.<locals>.<genexpr>J   s(      !6!6Q#a&&!6!6!6!6!6!6r   )quote c              3  H   K   | ]} t          |                    V  d S r=   r)   )r*   rE   shlex_quotes     r   rF   zshell_cmd.<locals>.<genexpr>N   s3      55AKKA''555555r   )r   platform
subprocessrC   tupleshlexrG   join)r   rC   rJ   s     @r   r6   r6   F   s    
|w++++++|E!6!6#!6!6!666777******885555555555r   )r   r   r6   )r   r@   r   r#   )r>   
__future__r   r   enumr   pathlibr   typingr   r   r   r6   __all__r   r   r   <module>rU      s    3 3 " " " " " " 



                  K K K K K$ K K K-o -o -o -o -o -o -o -o`6 6 6 6r   