403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.7.155
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python38/lib/python3.8/site-packages/click/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python38/lib/python3.8/site-packages/click/__pycache__/testing.cpython-38.pyc
U

e([V�*�@s�ddlZddlZddlZddlZddlZddlmZmZeje	�
dd�dZer`ddlm
Z
nddlZddlmZGdd�de�Zd	d
�ZGdd�de�ZGd
d�de�ZdS)�N�)�	iteritems�PY2�.)�StringIO)�_find_binary_readerc@sPeZdZdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�EchoingStdincCs||_||_dS�N)�_input�_output)�self�input�output�r�>/opt/alt/python38/lib/python3.8/site-packages/click/testing.py�__init__szEchoingStdin.__init__cCst|j|�Sr	)�getattrr
)r�xrrr�__getattr__szEchoingStdin.__getattr__cCs|j�|�|Sr	)r�write)r�rvrrr�_echo!szEchoingStdin._echo���cCs|�|j�|��Sr	)rr
�read�r�nrrrr%szEchoingStdin.readcCs|�|j�|��Sr	)rr
�readlinerrrrr(szEchoingStdin.readlinecs�fdd��j��D�S)Ncsg|]}��|��qSr�r��.0r�rrr�
<listcomp>,sz*EchoingStdin.readlines.<locals>.<listcomp>)r
�	readlinesr rr rr"+szEchoingStdin.readlinescst�fdd��jD��S)Nc3s|]}��|�VqdSr	rrr rr�	<genexpr>/sz(EchoingStdin.__iter__.<locals>.<genexpr>)�iterr
r rr r�__iter__.szEchoingStdin.__iter__cCs
t|j�Sr	)�reprr
r rrr�__repr__1szEchoingStdin.__repr__N)r)r)�__name__�
__module__�__qualname__rrrrrr"r%r'rrrrrs

rcCsft|d�r.tr|St|�}|dk	r&|Std��|dkr<d}nt|t�sP|�|�}tr\t|�St�	|�S)Nrz.Could not find binary reader for input stream.�)
�hasattrrr�	TypeError�
isinstance�bytes�encoder�io�BytesIO)r
�charsetrrrr�make_input_stream5s


r4c@s.eZdZdZd	dd�Zedd��Zdd�ZdS)
�Resultz3Holds the captured result of an invoked CLI script.NcCs"||_||_||_||_||_dSr	��runner�output_bytes�	exit_code�	exception�exc_info)rr7r8r9r:r;rrrrKs
zResult.__init__cCs|j�|jjd��dd�S)zThe output as unicode string.�replace�
�
)r8�decoder7r3r<r rrrrXs�z
Result.outputcCsd|jrt|j�pdfS)Nz<Result %s>Zokay)r:r&r rrrr'^s�zResult.__repr__)N)r(r)r*�__doc__r�propertyrr'rrrrr5Hs�


r5c@sTeZdZdZddd�Zdd�Zddd	�Zejdd
d��Z	dd
d�Z
ejdd��ZdS)�	CliRunneraIThe 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.  This is
                    UTF-8 by default and should not be changed currently as
                    the reporting to Click only works in Python 2 properly.
    :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.
    NFcCs&|dkrd}||_|pi|_||_dS)Nzutf-8)r3�env�
echo_stdin)rr3rCrDrrrrts

zCliRunner.__init__cCs
|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)�name)r�clirrr�get_default_prog_name{szCliRunner.get_default_prog_namecCst|j�}|r|�|�|S)z8Returns the environment overrides for invoking a script.)�dictrC�update)rZ	overridesrrrr�make_env�s

zCliRunner.make_envc#st�|j��tj}tj}tj}tjj}dtj_|�	|�}t
r`t�t_t_}|jr�t
�|��n@t��}|jrxt
�|��tj�|jd��tj||jd�t_t_�t_d�fdd�	}	d
�fdd�	}
dd	�}|�d�fd
d�	}tjj}
tjj}tjj}tjj}|	tj_|
tj_|tj_|tj_i}zht|�D]T\}}tj�|�||<|dk�rrztj|=Wntk
�rnYnXn
|tj|<�q*|VW5t|�D]D\}}|dk�r�ztj|=Wntk
�r�YnXn
|tj|<�q�|t_|t_|t_|
tj_|tj_|tj_|tj_|tj_XdS)a�A 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.

        .. versionadded:: 4.0
           The ``color`` parameter was added.

        :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.
        �P)�encodingNcs<tj�|pd�����d�}tj�|d�tj��|S)N�r=r>)�sys�stdoutrr�rstrip�flush)�prompt�val�r
rr�
visible_input�s

z*CliRunner.isolation.<locals>.visible_inputcs,tj�|pdd�tj������d�S)NrNr>r=)rOrPrrRrrQ)rSrUrr�hidden_input�s
z)CliRunner.isolation.<locals>.hidden_inputcSs*tj�d�}|r&tj�|�tj��|S)Nr)rO�stdinrrPrrR)Zecho�charrrr�_getchar�s

z%CliRunner.isolation.<locals>._getcharcs|dkr�S|Sr	r)�stream�color)�
default_colorrr�should_strip_ansi�sz.CliRunner.isolation.<locals>.should_strip_ansi)N)N)NN)r4r3rOrXrP�stderr�clickpkgZ
formattingZFORCED_WIDTHrKrrrDrr1r2�
TextIOWrapperZtermuiZvisible_prompt_funcZhidden_prompt_funcrZ�utilsr^r�os�environ�	Exception�get)rr
rCr\Z	old_stdinZ
old_stdoutZ
old_stderrZold_forced_widthZbytes_outputrVrWrZr^Zold_visible_prompt_funcZold_hidden_prompt_funcZold__getchar_funcZold_should_strip_ansiZold_env�key�valuer)r]r
r�	isolation�sv

�


zCliRunner.isolationTcKsd}|j|||d���}	d}
d}z�z$|jf|p.d|�|�d�|��Wn�tk
r�}
zJ|
jdkrd|
}
t�	�}|
j}t
|t�s�tj�t
|��tj�d�d}W5d}
~
XYn8tk
r�}
z|s‚|
}
d}t�	�}W5d}
~
XYnXW5tj��|	��}XW5QRXt||||
|d	�S)
aeInvokes 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.

        .. versionadded:: 3.0
           The ``catch_exceptions`` parameter was added.

        .. versionchanged:: 3.0
           The result object now has an `exc_info` attribute with the
           traceback if available.

        .. versionadded:: 4.0
           The ``color`` parameter was added.

        :param cli: the command to invoke
        :param args: the arguments to invoke
        :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.
        N)r
rCr\rr)�argsZ	prog_namer>rrr6)rirOrPrR�getvalue�mainrH�
SystemExit�coder;r.�intr�strrer5)rrGrjr
rCZcatch_exceptionsr\�extrar;�outr:r9r�errr�invoke�sB��



�zCliRunner.invokeccs^t��}t��}t�|�z
|VW5t�|�zt�|�Wnttfk
rVYnXXdS)z�A context manager that creates a temporary folder and changes
        the current working directory to it for isolated filesystem tests.
        N)	rc�getcwd�tempfile�mkdtemp�chdir�shutil�rmtree�OSError�IOError)r�cwd�trrr�isolated_filesystem3s


zCliRunner.isolated_filesystem)NNF)N)NNF)NNNTF)r(r)r*r@rrHrK�
contextlib�contextmanagerrirtrrrrrrBds

i�
@rB)rcrOryrvr��_compatrr�modulesr(�rsplitr`�	cStringIOrr1r�objectrr4r5rBrrrr�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit