/usr/local/lib/python3.6/site-packages/click/__pycache__
NameSizeModeActions
core.cpython-36.pyc879320644editdlrm
decorators.cpython-36.pyc143500644editdlrm
exceptions.cpython-36.pyc100380644editdlrm
formatting.cpython-36.pyc92390644editdlrm
globals.cpython-36.pyc23600644editdlrm
parser.cpython-36.pyc134390644editdlrm
shell_completion.cpython-36.pyc166130644editdlrm
termui.cpython-36.pyc262610644editdlrm
testing.cpython-36.pyc146710644editdlrm
types.cpython-36.pyc329570644editdlrm
utils.cpython-36.pyc177250644editdlrm
_compat.cpython-36.pyc156730644editdlrm
_termui_impl.cpython-36.pyc156500644editdlrm
_textwrap.cpython-36.pyc14650644editdlrm
_unicodefun.cpython-36.pyc22950644editdlrm
_winconsole.cpython-36.pyc76780644editdlrm
__init__.cpython-36.pyc26480644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/click/__pycache__/testing.cpython-36.pyc (14671B)
3 _TBg>@sddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl mZddlmZejrddlmZGd d d Zejejeejdd d d ZGdddejZejejeeejfeejdddZ GdddZ!GdddZ"dS)N) TracebackType) formatting)termui)utils)_find_binary_reader) BaseCommandc@seZdZejejddddZeejdddZe e dd d Z de e d d dZ de e d ddZ de e d ddZeje dddZeje dddZedddZdS) EchoingStdinN)inputoutputreturncCs||_||_d|_dS)NF)_input_output_paused)selfr r r./tmp/pip-build-0s3hx122/click/click/testing.py__init__szEchoingStdin.__init__)xr cCs t|j|S)N)getattrr )rrrrr __getattr__szEchoingStdin.__getattr__)rvr cCs|js|jj||S)N)rrwrite)rrrrr_echos zEchoingStdin._echor)nr cCs|j|jj|S)N)rr read)rrrrrr#szEchoingStdin.readcCs|j|jj|S)N)rr read1)rrrrrr&szEchoingStdin.read1cCs|j|jj|S)N)rr readline)rrrrrr)szEchoingStdin.readline)r csfddjjDS)Ncsg|]}j|qSr)r).0r)rrr -sz*EchoingStdin.readlines..)r readlines)rr)rrr ,szEchoingStdin.readlinescstfddjDS)Nc3s|]}j|VqdS)N)r)rr)rrr 0sz(EchoingStdin.__iter__..)iterr )rr)rr__iter__/szEchoingStdin.__iter__cCs t|jS)N)reprr )rrrr__repr__2szEchoingStdin.__repr__)r&r&)r&r&)r&)__name__ __module__ __qualname__tBinaryIOrstrAnyrbytesrintrrrZListr Iteratorr#r%rrrrr sr )streamr ccs&|dkrdVnd|_dVd|_dS)NTF)r)r1rrr _pause_echo6s r2csReZdZejeeejddfdd ZeedddZ eeddd Z Z S) _NamedTextIOWrapperN)buffernamemodekwargsr c s tj|f|||_||_dS)N)superr_name_mode)rr4r5r6r7) __class__rrrAsz_NamedTextIOWrapper.__init__)r cCs|jS)N)r9)rrrrr5Hsz_NamedTextIOWrapper.namecCs|jS)N)r:)rrrrr6Lsz_NamedTextIOWrapper.mode) r'r(r)r*r+r,r-rpropertyr5r6 __classcell__rr)r;rr3@s  r3)r charsetr cCsdt|dr0ttjtj|}|dk r(|Std|dkr>d}nt|trR|j|}t j tjt |S)Nrz.Could not find binary reader for input stream.) hasattrrr*castIO TypeError isinstancer,encodeioBytesIOr.)r r>rrrrmake_input_streamQs   rHc @seZdZdZddeejeejeeje ejej ej e e e fdddZ eeddd Zeedd d Zeedd d ZedddZdS)Resultz3Holds the captured result of an invoked CLI script.N CliRunner)runner stdout_bytes stderr_bytes return_value exit_code exceptionexc_infocCs.||_||_||_||_||_||_||_dS)N)rKrLrMrNrOrPrQ)rrKrLrMrNrOrPrQrrrrhs zResult.__init__)r cCs|jS)z(The (standard) output as unicode string.)stdout)rrrrr sz Result.outputcCs|jj|jjdjddS)z&The standard output as unicode string.replacez  )rLdecoderKr>rS)rrrrrRsz Result.stdoutcCs,|jdkrtd|jj|jjdjddS)z%The standard error as unicode string.Nzstderr not separately capturedrSz rT)rM ValueErrorrUrKr>rS)rrrrstderrs z Result.stderrcCs,|jrt|jnd}dt|jd|dS)Nokay< >)rPr$typer')rZexc_strrrrr%szResult.__repr__)N)r'r(r)__doc__r.r*Optionalr-r/ BaseExceptionTupleTyperrr<r,r rRrWr%rrrrrIes BrIc @sveZdZdZdeejejeejefeeddddZ d ed d d Z dejejeejefejeejefd ddZ e j dejejeeejfejejeejefeejejejejejfdddZdd ejejeejefejejeeejfejejeejefeeejedddZe j dejejeejfejedddZdS)rJaThe 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-8NFT)r>env echo_stdin mix_stderrr cCs ||_|p i|_||_||_dS)N)r>rcrdre)rr>rcrdrerrrrs zCliRunner.__init__r)clir cCs |jpdS)zGiven a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. root)r5)rrfrrrget_default_prog_nameszCliRunner.get_default_prog_name) overridesr cCst|j}|r|j||S)z8Returns the environment overrides for invoking a script.)dictrcupdate)rrirrrrmake_envs  zCliRunner.make_env)r rccolorr c#st||j}d}tj}tj}tj}tj} dt_|j|}t j } |j r^t j t jt|| }}t||jdddt_|j rd_t| |jdddt_d} |jrtjt_nt j } t| |jd dd d t_t|dt jttd fd d } t|dt jttd fdd } t|ttddd}|dt jt jt jttdfdd }tj}tj}tj}tj}| t_| t_|t_|t_i}zpx`|jD]T\}}tj j!|||<|dkry tj |=Wnt"k rYnXn |tj |<qW| | fVWdxP|jD]D\}}|dkr:y tj |=Wnt"k r6YnXn |tj |<qW|t_|t_|t_|t_|t_|t_|t_| t_XdS)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. NPzr)encodingr5r6rzwzbackslashreplace)rpr5r6errors)promptr cs>tjj|p djjd}tjj|dtjj|S)Nz rT)sysrRrrrstripflush)rtval) text_inputrr visible_inputs  z*CliRunner.isolation..visible_inputcs.tjj|p ddtjjjjdS)NrurTz )rvrRrrxrrw)rt)rzrr hidden_inputs z)CliRunner.isolation..hidden_input)echor cSs*tjjd}|rtjj|tjj|S)Nr)rvstdinrrRrrx)r}charrrr_getchar#s    z%CliRunner.isolation.._getchar)r1rmr cs|dkr S| S)Nr)r1rm) default_colorrrshould_strip_ansi/sz.CliRunner.isolation..should_strip_ansi)N)N)NN)#rHr>rvr~rRrWrZ FORCED_WIDTHrlrFrGrdr*rAr+r r3 _CHUNK_SIZErer2r^r,boolrBrZvisible_prompt_funcZhidden_prompt_funcrrritemsosenvironget Exception)rr rcrmZ bytes_inputZ echo_inputZ old_stdinZ old_stdoutZ old_stderrZold_forced_widthZ bytes_outputZ bytes_errorr{r|rrZold_visible_prompt_funcZold_hidden_prompt_funcZold__getchar_funcZold_should_strip_ansiZold_envkeyvaluer)rrzr isolations         zCliRunner.isolation)rfargsr rccatch_exceptionsrmextrar c,Ksd}|j|||dz} d} d} d} t|tr8tj|}y|jd} Wntk rd|j|} YnXzy|jf|pvf| d|} Wnt k r}zvt j }t j t jt jtt jf|j}|dkrd}|dkr|} t|tst jjt|t jjdd}|} WYdd}~Xn<tk rT}z|s4|} d} t j }WYdd}~XnXWdt jj| dj}|jr~d}n | dj}XWdQRXt|||| | | |dS) aInvokes 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 rcrmr prog_name)rrrTr)rKrLrMrNrOrPrQ)rrDr,shlexsplitpopKeyErrorrhmain SystemExitrvrQr*rAr^Unionr/r-coderRrrrxgetvaluererI)rrfrr rcrrmrrQZ outstreamsrNrPrOreZe_coderRrWrrrinvoke]sX,       zCliRunner.invoke)temp_dirr ccsntj}tj|d}tj|ztjt|VWdtj||dkrhytj |Wnt k rfYnXXdS)aA 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) rgetcwdtempfilemkdtempchdirr*rAr,shutilrmtreeOSError)rrcwddtrrrisolated_filesystems   zCliRunner.isolated_filesystem)rbNFT)N)NNF)NNNTF)N)r'r(r)r]r,r*r^Mappingrrrhrl contextlibcontextmanagerrr.rBr0r`rFrGrSequencer-rIrrPathLikerrrrrrJs2 2* N\rJ)#rrFrrrrvrZtypingr*typesrrurrr_compatrZ TYPE_CHECKINGcorerr rr^r0r2 TextIOWrapperr3rr,r.rBr+rHrIrJrrrrs,      " :