[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.141.25.100: ~ $


e([V�*�@s�ddlZddlZddlZddlZddlZddlmZmZeje	j
dd�dZer�ddlm
Z
nddlZddlmZGdd�de�Zd	d
�ZGdd�de�ZGd
d�de�ZdS)�N�)�	iteritems�PY2�.)�StringIO)�_find_binary_readerc@sveZdZdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�EchoingStdincCs||_||_dS)N)�_input�_output)�self�input�output�r�/testing.py�__init__s	zEchoingStdin.__init__cCst|j|�S)N)�getattrr	)r�xrrr�__getattr__szEchoingStdin.__getattr__cCs|jj|�|S)N)r
�write)r�rvrrr�_echo!szEchoingStdin._echorcCs|j|jj|��S)N)rr	�read)r�nrrrr%szEchoingStdin.readcCs|j|jj|��S)N)rr	�readline)rrrrrr(szEchoingStdin.readlinecs �fdd��jj�D�S)Ncsg|]}�j|��qSr)r)�.0r)rrr�
<listcomp>,s	z*EchoingStdin.readlines.<locals>.<listcomp>)r	�	readlines)rr)rrr+szEchoingStdin.readlinescs t�fdd��jD��S)Nc3s|]}�j|�VqdS)N)r)rr)rrr�	<genexpr>/sz(EchoingStdin.__iter__.<locals>.<genexpr>)�iterr	)rr)rr�__iter__.szEchoingStdin.__iter__cCs
t|j�S)N)�reprr	)rrrr�__repr__1szEchoingStdin.__repr__N���r")�__name__�
__module__�__qualname__rrrrrrrr!rrrrrsrcCs�t|d�rAtr|St|�}|dk	r5|Std��|dkrVd}nt|t�st|j|�}tr�t|�Stj	|�S)Nrz.Could not find binary reader for input stream.�)
�hasattrrr�	TypeError�
isinstance�bytes�encoder�io�BytesIO)r�charsetrrrr�make_input_stream5s	
r/c@sCeZdZdZddd�Zedd��Zdd�ZdS)	�Resultz3Holds the captured result of an invoked CLI script.NcCs1||_||_||_||_||_dS)N)�runner�output_bytes�	exit_code�	exception�exc_info)rr1r2r3r4r5rrrrKs
				zResult.__init__cCs%|jj|jjd�jdd�S)zThe output as unicode string.�replacez
�
)r2�decoder1r.r6)rrrrr
Xsz
Result.outputcCs#d|jrt|j�pdfS)Nz<Result %s>Zokay)r4r )rrrrr!^szResult.__repr__)r#r$r%�__doc__r�propertyr
r!rrrrr0Hsr0c@s�eZdZdZddddd�Zdd�Zddd	�Zejdddd
d��Z	dddd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.
    NFcCs7|dkrd}||_|p$i|_||_dS)Nzutf-8)r.�env�
echo_stdin)rr.r<r=rrrrts
	zCliRunner.__init__cCs
|jpdS)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_namecCs&t|j�}|r"|j|�|S)z8Returns the environment overrides for invoking a script.)�dictr<�update)rZ	overridesrrrr�make_env�s
zCliRunner.make_envc#s�t�|j��tj}tj}tj}tjj}dtj_|j	|�}t
r�t�t_t_}|jr�t
�|��n^tj�}|jr�t
�|��tj�d|j��tj|d|j�t_t_�t_d�fdd�}	d�fdd�}
dd	�}|�dd�fd
d�}tjj}
tjj}tjj}tjj}|	tj_|
tj_|tj_|tj_i}z{xot|�D]a\}}tjj|�||<|dkrytj|=Wqtk
r
YqXq�|tj|<q�W|VWdxYt|�D]K\}}|dkrvytj|=Wq�tk
rrYq�Xq8|tj|<q8W|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�encodingNcsPtjj|pd��j�jd�}tjj|d�tjj�|S)N�z
r7)�sys�stdoutrr�rstrip�flush)�prompt�val)rrr�
visible_input�s

z*CliRunner.isolation.<locals>.visible_inputcs:tjj|pdd�tjj��j�jd�S)NrGr7z
)rHrIrrKrrJ)rL)rrr�hidden_input�s
z)CliRunner.isolation.<locals>.hidden_inputcSs9tjjd�}|r5tjj|�tjj�|S)Nr)rH�stdinrrIrrK)Zecho�charrrr�_getchar�s

z%CliRunner.isolation.<locals>._getcharcs|dkr�S|S)Nr)�stream�color)�
default_colorrr�should_strip_ansi�sz.CliRunner.isolation.<locals>.should_strip_ansi)r/r.rHrPrI�stderr�clickpkgZ
formattingZFORCED_WIDTHrDrrr=rr,r-�
TextIOWrapperZtermuiZvisible_prompt_funcZhidden_prompt_funcrRZutilsrVr�os�environ�get�	Exception)rrr<rTZ	old_stdinZ
old_stdoutZ
old_stderrZold_forced_widthZbytes_outputrNrOrRrVZold_visible_prompt_funcZold_hidden_prompt_funcZold__getchar_funcZold_should_strip_ansiZold_env�key�valuer)rUrr�	isolation�sr						
	
			zCliRunner.isolationTc&Ks~d}|jd|d|d|��2}	d}
d}zy,|jd|pKfd|j|�|�Wn�tk
r�}zj|jdkr�|}
tj�}|j}t|t�s�tj	j
t|��tj	j
d�d	}WYdd}~XnFtk
r3}z&|s	�|}
d}tj�}WYdd}~XnXWdtj	j
�|	j�}
XWdQRXtd
|d|
d|d
|
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.
        Nrr<rTr�argsZ	prog_namer7rr1r2r3r4r5r")r`�mainrA�
SystemExit�coderHr5r)�intrIr�strr]rK�getvaluer0)rr@rarr<Zcatch_exceptionsrT�extrar5�outr4r3�er
rrr�invoke�s:!	#
zCliRunner.invokeccsotj�}tj�}tj|�z	|VWdtj|�ytj|�Wnttfk
riYnXXdS)z�A context manager that creates a temporary folder and changes
        the current working directory to it for isolated filesystem tests.
        N)	rZ�getcwd�tempfile�mkdtemp�chdir�shutil�rmtree�OSError�IOError)r�cwd�trrr�isolated_filesystem3s
	
zCliRunner.isolated_filesystem)r#r$r%r9rrArD�
contextlib�contextmanagerr`rkrvrrrrr;dsi	?r;)rZrHrprmrwZ_compatrr�modulesr#�rsplitrX�	cStringIOrr,r�objectrr/r0r;rrrr�<module>s

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.opt-1.pyc File 2.8 KB 0644
__init__.cpython-35.pyc File 2.8 KB 0644
_bashcomplete.cpython-35.opt-1.pyc File 2.45 KB 0644
_bashcomplete.cpython-35.pyc File 2.45 KB 0644
_compat.cpython-35.opt-1.pyc File 16.31 KB 0644
_compat.cpython-35.pyc File 16.31 KB 0644
_termui_impl.cpython-35.opt-1.pyc File 14.07 KB 0644
_termui_impl.cpython-35.pyc File 14.07 KB 0644
_textwrap.cpython-35.opt-1.pyc File 1.33 KB 0644
_textwrap.cpython-35.pyc File 1.33 KB 0644
_unicodefun.cpython-35.opt-1.pyc File 3.37 KB 0644
_unicodefun.cpython-35.pyc File 3.37 KB 0644
_winconsole.cpython-35.opt-1.pyc File 7.9 KB 0644
_winconsole.cpython-35.pyc File 7.9 KB 0644
core.cpython-35.opt-1.pyc File 57.77 KB 0644
core.cpython-35.pyc File 58.27 KB 0644
decorators.cpython-35.opt-1.pyc File 11.7 KB 0644
decorators.cpython-35.pyc File 11.7 KB 0644
exceptions.cpython-35.opt-1.pyc File 7.97 KB 0644
exceptions.cpython-35.pyc File 7.97 KB 0644
formatting.cpython-35.opt-1.pyc File 8.81 KB 0644
formatting.cpython-35.pyc File 8.81 KB 0644
globals.cpython-35.opt-1.pyc File 1.82 KB 0644
globals.cpython-35.pyc File 1.82 KB 0644
parser.cpython-35.opt-1.pyc File 12.19 KB 0644
parser.cpython-35.pyc File 12.19 KB 0644
termui.cpython-35.opt-1.pyc File 19.07 KB 0644
termui.cpython-35.pyc File 19.07 KB 0644
testing.cpython-35.opt-1.pyc File 10.59 KB 0644
testing.cpython-35.pyc File 10.59 KB 0644
types.cpython-35.opt-1.pyc File 18.07 KB 0644
types.cpython-35.pyc File 18.23 KB 0644
utils.cpython-35.opt-1.pyc File 14.36 KB 0644
utils.cpython-35.pyc File 14.36 KB 0644