Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/click/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/click/__pycache__/testing.cpython-310.pyc
o

�+ca�>�@sddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZejrGddlmZGd	d
�d
�Zejdejedejdfd
d��ZGdd�dej�Zdejejeeejfdedejfdd�Z Gdd�d�Z!Gdd�d�Z"dS)�N)�
TracebackType�)�
formatting)�termui)�utils)�_find_binary_reader)�BaseCommandc@s�eZdZdejdejddfdd�Zdedejfdd	�Zd
e	de	fdd�Z
ddede	fdd�Zddede	fdd�Z
ddede	fdd�Zdeje	fdd�Zdeje	fdd�Zdefdd�ZdS)�EchoingStdin�input�output�returnNcCs||_||_d|_dS)NF)�_input�_output�_paused)�selfr
r�r�//usr/lib/python3/dist-packages/click/testing.py�__init__s
zEchoingStdin.__init__�xcCst|j|�S�N)�getattrr
)rrrrr�__getattr__szEchoingStdin.__getattr__�rvcCs|js	|j�|�|Sr)rr�write)rrrrr�_echoszEchoingStdin._echo����ncC�|�|j�|��Sr)rr
�read�rrrrrr#�zEchoingStdin.readcCrr)rr
�read1rrrrr!&r zEchoingStdin.read1cCrr)rr
�readlinerrrrr")r zEchoingStdin.readlinecs�fdd��j��D�S)Ncsg|]}��|��qSr�r��.0r�rrr�
<listcomp>-sz*EchoingStdin.readlines.<locals>.<listcomp>)r
�	readlinesr&rr&rr(,�zEchoingStdin.readlinescst�fdd��jD��S)Nc3s�|]}��|�VqdSrr#r$r&rr�	<genexpr>0s�z(EchoingStdin.__iter__.<locals>.<genexpr>)�iterr
r&rr&r�__iter__/r)zEchoingStdin.__iter__cCs
t|j�Sr)�reprr
r&rrr�__repr__2s
zEchoingStdin.__repr__)r)�__name__�
__module__�__qualname__�t�BinaryIOr�str�Anyr�bytesr�intrr!r"�Listr(�Iteratorr,r.rrrrr	sr	�streamrccs*�|dur
dVdSd|_dVd|_dS)NTF)r)r:rrr�_pause_echo6s�

r;c
sZeZdZdejdededejddf
�fdd�Zedefd	d
��Z	edefdd��Z
�ZS)
�_NamedTextIOWrapper�buffer�name�mode�kwargsrNcs$t�j|fi|��||_||_dSr)�superr�_name�_mode)rr=r>r?r@��	__class__rrrAs
z_NamedTextIOWrapper.__init__cC�|jSr)rBr&rrrr>H�z_NamedTextIOWrapper.namecCrFr)rCr&rrrr?LrGz_NamedTextIOWrapper.mode)r/r0r1r2r3r4r5r�propertyr>r?�
__classcell__rrrDrr<@s �����r<r
�charsetcCsdt|d�rtt�tj|��}|dur|Std��|durd}n
t|t�r)|�|�}t	�
t�t|��S)Nrz.Could not find binary reader for input stream.�)�hasattrrr2�cast�IO�	TypeError�
isinstancer4�encode�io�BytesIOr6)r
rJrrrr�make_input_streamQs


rTc@s�eZdZdZ	ddddedejedejded	eje	d
ejej
eje	e	effdd�Z
ed
efdd��Zed
efdd��Zed
efdd��Zd
efdd�ZdS)�Resultz3Holds the captured result of an invoked CLI script.N�runner�	CliRunner�stdout_bytes�stderr_bytes�return_value�	exit_code�	exception�exc_infocCs.||_||_||_||_||_||_||_dSr�rVrXrYrZr[r\r])rrVrXrYrZr[r\r]rrrrhs

zResult.__init__rcCrF)z(The (standard) output as unicode string.)�stdoutr&rrrr�sz
Result.outputcCs|j�|jjd��dd�S)z&The standard output as unicode string.�replace�
�
)rX�decoderVrJr`r&rrrr_�s�z
Result.stdoutcCs,|jdur	td��|j�|jjd��dd�S)z%The standard error as unicode string.Nzstderr not separately capturedr`rarb)rY�
ValueErrorrcrVrJr`r&rrr�stderr�s

�z
Result.stderrcCs,|jrt|j�nd}dt|�j�d|�d�S)N�okay�<� �>)r\r-�typer/)r�exc_strrrrr.�szResult.__repr__r)r/r0r1�__doc__r6r2�Optionalr5r7�
BaseException�Tuple�TyperrrHr4rr_rer.rrrrrUes6��������
�rUc@s�eZdZdZ				d dedejejeejefded	ed
df
dd�Z	d
dd
efdd�Z
	d!dejejeejefd
ejeejeffdd�Zej
			d"dejejeeejfdejejeejefded
ejejejejejffdd��Z					d#d
ddejejeejefdejejeeejfdejejeejefdededejd
efdd�Zej
	d!dejejeejfd
ejefdd��ZdS)$rWa�The CLI runner provides functionality to invoke a Click command line
    script for unittesting purposes in a isolated environment.  This only
    works in single-threaded systems without any concurrency as it changes the
    global interpreter state.

    :param charset: the character set for the input and output data.
    :param env: a dictionary with environment variables for overriding.
    :param echo_stdin: if this is set to `True`, then reading from stdin writes
                       to stdout.  This is useful for showing examples in
                       some circumstances.  Note that regular prompts
                       will automatically echo the input.
    :param mix_stderr: if this is set to `False`, then stdout and stderr are
                       preserved as independent streams.  This is useful for
                       Unix-philosophy apps that have predictable stdout and
                       noisy stderr, such that each may be measured
                       independently
    �utf-8NFTrJ�env�
echo_stdin�
mix_stderrrcCs ||_|pi|_||_||_dSr)rJrrrsrt)rrJrrrsrtrrrr�s

zCliRunner.__init__�clircCs
|jpdS)z�Given a command object it will return the default program name
        for it.  The default is the `name` attribute or ``"root"`` if not
        set.
        �root)r>)rrurrr�get_default_prog_name�s
zCliRunner.get_default_prog_name�	overridescCst|j�}|r|�|�|S)z8Returns the environment overrides for invoking a script.)�dictrr�update)rrxrrrr�make_env�s

zCliRunner.make_envr
�colorc#s��t||j�}d}tj}tj}tj}tj}	dt_|�|�}t	�
�}
|jr0t�
tjt||
��}}t||jddd�t_�|jrBd�_t|
|jddd�t_d}|jrVtjt_nt	�
�}t||jd	dd
d�t_t|�ddtjtd
tf�fdd�
�}t|�ddtjtd
tf�fdd�
�}
t|�dtd
tfdd��}|�	ddtjtjdtjtd
tf�fdd�
}tj}tj}tj}tj}|t_|
t_|t_|t_i}zn|��D]%\}}tj �!|�||<|dur�ztj |=Wq�t"y�Yq�w|tj |<q�|
|fVW|��D]\}}|du�rztj |=Wq�t"�yYq�w|tj |<q�|t_|t_|t_|t_|t_|t_|t_|	t_dS|��D]"\}}|du�rYztj |=W�q=t"�yXY�q=w|tj |<�q=|t_|t_|t_|t_|t_|t_|t_|	t_w)anA context manager that sets up the isolation for invoking of a
        command line tool.  This sets up stdin with the given input data
        and `os.environ` with the overrides from the given dictionary.
        This also rebinds some internals in Click to be mocked (like the
        prompt functionality).

        This is automatically done in the :meth:`invoke` method.

        :param input: the input stream to put into sys.stdin.
        :param env: the environment overrides as dictionary.
        :param color: whether the output should contain color codes. The
                      application can still override this explicitly.

        .. versionchanged:: 8.0
            ``stderr`` is opened with ``errors="backslashreplace"``
            instead of the default ``"strict"``.

        .. versionchanged:: 4.0
            Added the ``color`` parameter.
        N�Pz<stdin>�r)�encodingr>r?rz<stdout>�wz<stderr>�backslashreplace)rr>r?�errors�promptrcs>tj�|pd�����d�}tj�|�d��tj��|S)N�rarb)�sysr_rr"�rstrip�flush)r��val��
text_inputrr�
visible_inputs

z*CliRunner.isolation.<locals>.visible_inputcs.tj�|pd�d��tj������d�S)Nr�rbra)r�r_rr�r"r�)r�r�rr�hidden_inputs
z)CliRunner.isolation.<locals>.hidden_input�echocSs*tj�d�}|rtj�|�tj��|S)Nr)r��stdinrr_rr�)r��charrrr�_getchar#s

z%CliRunner.isolation.<locals>._getcharr:r|cs|dur�S|Srr)r:r|)�
default_colorrr�should_strip_ansi/sz.CliRunner.isolation.<locals>.should_strip_ansir)NN)#rTrJr�r�r_rer�FORCED_WIDTHr{rRrSrsr2rMr3r	r<�_CHUNK_SIZErtr;rmr4�boolrNr�visible_prompt_func�hidden_prompt_funcr�rr��items�os�environ�get�	Exception)rr
rrr|�bytes_input�
echo_input�	old_stdin�
old_stdout�
old_stderr�old_forced_width�bytes_output�bytes_errorr�r�r�r��old_visible_prompt_func�old_hidden_prompt_func�old__getchar_func�old_should_strip_ansi�old_env�key�valuer)r�r�r�	isolation�s��
�
�
�
�  	�
����
�
�
�zCliRunner.isolation�args�catch_exceptions�extracKs�d}|j|||d���}	d}
d}d}t|t�rt�|�}z|�d�}
Wnty0|�|�}
Ynwz�z|jd|p9d|
d�|��}
Wnet	y�}z=t
��}t�
tjtjttjf|j�}|durcd}|dkri|}t|t�s~t
j�t|��t
j�d�d}|}WYd}~n!d}~wty�}z|s��|}d}t
��}WYd}~nd}~wwWt
j��|	d��}|jr�d}n|	d��}nt
j��|	d��}|jr�d}w|	d��}wWd�n1s�wYt||||
|||d	�S)
a�Invokes a command in an isolated environment.  The arguments are
        forwarded directly to the command line script, the `extra` keyword
        arguments are passed to the :meth:`~clickpkg.Command.main` function of
        the command.

        This returns a :class:`Result` object.

        :param cli: the command to invoke
        :param args: the arguments to invoke. It may be given as an iterable
                     or a string. When given as string it will be interpreted
                     as a Unix shell command. More details at
                     :func:`shlex.split`.
        :param input: the input data for `sys.stdin`.
        :param env: the environment overrides.
        :param catch_exceptions: Whether to catch any other exceptions than
                                 ``SystemExit``.
        :param extra: the keyword arguments to pass to :meth:`main`.
        :param color: whether the output should contain color codes. The
                      application can still override this explicitly.

        .. versionchanged:: 8.0
            The result object has the ``return_value`` attribute with
            the value returned from the invoked command.

        .. versionchanged:: 4.0
            Added the ``color`` parameter.

        .. versionchanged:: 3.0
            Added the ``catch_exceptions`` parameter.

        .. versionchanged:: 3.0
            The result object has the ``exc_info`` attribute with the
            traceback if available.
        N)r
rrr|r�	prog_namer)r�r�rbrr^)r�rPr4�shlex�split�pop�KeyErrorrw�main�
SystemExitr�r]r2rMrm�Unionr7r5�coder_rr�r��getvaluertrU)rrur�r
rrr�r|r�r]�
outstreamsrZr\r[r��e�e_coder_rerrr�invoke]sr,

� 
����

���.�zCliRunner.invoke�temp_dirccs��t��}tj|d�}t�|�z"|VWt�|�|dur1zt�|�WdSty0YdSwdSt�|�|durMzt�|�WwtyLYwww)a�A context manager that creates a temporary directory and
        changes the current working directory to it. This isolates tests
        that affect the contents of the CWD to prevent them from
        interfering with each other.

        :param temp_dir: Create the temporary directory under this
            directory. If given, the created directory is not removed
            when exiting.

        .. versionchanged:: 8.0
            Added the ``temp_dir`` parameter.
        )�dirN)r��getcwd�tempfile�mkdtemp�chdir�shutil�rmtree�OSError)rr��cwdr2rrr�isolated_filesystem�s,�

��
���zCliRunner.isolated_filesystem)rqNFTr)NNF)NNNTF)r/r0r1rlr4r2rm�Mappingr�rrwr{�
contextlib�contextmanagerr�r6rNr9rorRrSr��Sequencer5rUr�r��PathLiker�rrrrrW�s������
���
�	�������������	
�e���rW)#r�rRr�r�r�r�r��typingr2�typesrr�rrr�_compatr�
TYPE_CHECKING�corerr	r�rmr9r;�
TextIOWrapperr<r�r4r6rNr3rTrUrWrrrr�<module>s8" 	��
�:

Spamworldpro Mini