
    CjZg                    h   % S SK Jr  S SKJr  S SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  \R,                  (       a  S S
KJr  SSKJr  \
R6                  S:X  a  \R8                  S   rS\S'   O\R8                  S   rS\S'   \\ \!   \!\4   r"S\S'    " S S5      r#\RH                  S"S j5       r% " S S5      r& " S S\RN                  5      r( " S S5      r) " S S\RT                  5      r+      S#S jr, " S S5      r- " S  S!5      r.g)$    )annotationsN)TracebackType   )_compat)
formatting)termui)utils)_find_binary_reader)ReadableBuffer)Commandwin32syszt.TypeAliasCaptureMode)r   fdExceptionInfoc                      \ rS rSr% S\S'   S\S'   S\S'   SS jrSS jrSS	 jrSSS
 jjrSSS jjr	SSS jjr
SS jrSS jrSS jrSrg)EchoingStdin    
t.BinaryIO_input_outputbool_pausedc                *    Xl         X l        SU l        g )NFr   r   r   )selfinputoutputs      _/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/click/testing.py__init__EchoingStdin.__init__%   s        c                .    [        U R                  U5      $ N)getattrr   r   xs     r   __getattr__EchoingStdin.__getattr__*   s    t{{A&&r"   c                ^    U R                   (       d  U R                  R                  U5        U$ r$   )r   r   write)r   rvs     r   _echoEchoingStdin._echo-   s     ||LLr"	r"   c                V    U R                  U R                  R                  U5      5      $ r$   )r-   r   readr   ns     r   r0   EchoingStdin.read3   s     zz$++**1-..r"   c                V    U R                  U R                  R                  U5      5      $ r$   )r-   r   read1r1   s     r   r5   EchoingStdin.read16   s     zz$++++A.//r"   c                V    U R                  U R                  R                  U5      5      $ r$   )r-   r   readliner1   s     r   r8   EchoingStdin.readline9   s     zz$++..q122r"   c                ~    U R                   R                  5        Vs/ s H  oR                  U5      PM     sn$ s  snf r$   )r   	readlinesr-   r&   s     r   r;   EchoingStdin.readlines<   s/    '+{{'<'<'>?'>!

1'>???s   :c                B   ^  [        U 4S jT R                   5       5      $ )Nc              3  F   >#    U  H  nTR                  U5      v   M     g 7fr$   )r-   ).0r'   r   s     r   	<genexpr>(EchoingStdin.__iter__.<locals>.<genexpr>@   s     7;aDJJqMM;s   !)iterr   r   s   `r   __iter__EchoingStdin.__iter__?   s    74;;777r"   c                ,    [        U R                  5      $ r$   )reprr   rC   s    r   __repr__EchoingStdin.__repr__B   s    DKK  r"   r   N)r   r   r   r   returnNone)r'   strrJ   t.Any)r,   bytesrJ   rN   ))r2   intrJ   rN   )rJ   zlist[bytes])rJ   zcabc.Iterator[bytes]rJ   rL   )__name__
__module____qualname____firstlineno____annotations__r    r(   r-   r0   r5   r8   r;   rD   rH   __static_attributes__ r"   r   r   r       sA    M
'/03@8!r"   r   c              #  @   #    U c  S v   g SU l         S v   SU l         g 7f)NTF)r   )streams    r   _pause_echor[   F   s     ~s   c                  V    \ rS rSr% SrS\S'   S\S'   S\S'   SS jrSS	 jrSS
 jrSr	g)
_FDCaptureP   a>  Redirect a file descriptor to a temporary file for capture.

Saves the current target of *targetfd* via :func:`os.dup`, then
redirects it to a temporary file via :func:`os.dup2`. On
:meth:`stop`, restores the original ``fd`` and returns the captured
bytes. Inspired by Pytest's ``FDCapture``.

.. versionadded:: 8.4.0
rP   	_targetfdsaved_fdzt.BinaryIO | None_tmpfilec                ,    Xl         SU l        S U l        g NrO   )r_   r`   ra   )r   targetfds     r   r    _FDCapture.__init___   s    !r"   c                    [         R                  " U R                  5      U l        [        R
                  " SS9U l        [         R                  " U R                  R                  5       U R                  5        g )Nr   )	buffering)	osdupr_   r`   tempfileTemporaryFilera   dup2filenorC   s    r   start_FDCapture.startd   sG    t~~. ..;
$$&7r"   c                ~   U R                   c   S5       e[        R                  " U R                  U R                  5        [        R
                  " U R                  5        SU l        U R                   R                  S5        U R                   R                  5       nU R                   R                  5         S U l         U$ )Nz!_FDCapture.start() was not calledrO   r   )ra   rh   rl   r`   r_   closeseekr0   )r   datas     r   stop_FDCapture.stopi   s    }}(M*MM(
t~~.
1}}!!#r"   )r_   ra   r`   N)rd   rP   rJ   rK   rJ   rK   )rJ   rN   )
rR   rS   rT   rU   __doc__rV   r    rn   rt   rW   rX   r"   r   r]   r]   P   s(     NM
8
	r"   r]   c                  \   ^  \ rS rSr% SrS\S'   S	U 4S jjrS
U 4S jjrSU 4S jjrSr	U =r
$ )BytesIOCopyu   z\Patch ``io.BytesIO`` to let the written stream be copied to another.

.. versionadded:: 8.2

io.BytesIOcopy_toc                .   > [         TU ]  5         Xl        g r$   )superr    r|   )r   r|   	__class__s     r   r    BytesIOCopy.__init__}   s    r"   c                V   > [         TU ]  5         U R                  R                  5         g r$   )r~   flushr|   r   r   s    r   r   BytesIOCopy.flush   s    r"   c                X   > U R                   R                  U5        [        TU ]  U5      $ r$   )r|   r+   r~   )r   br   s     r   r+   BytesIOCopy.write   s$    1w}Qr"   r|   )r|   r{   rJ   rK   rv   )r   r   rJ   rP   )rR   rS   rT   rU   rw   rV   r    r   r+   rW   __classcell__r   s   @r   ry   ry   u   s$    
    r"   ry   c                  B    \ rS rSr% SrS\S'   S\S'   S\S'   SS jrS	rg
)StreamMixer   zvMixes `<stdout>` and `<stderr>` streams.

The result is available in the ``output`` attribute.

.. versionadded:: 8.2
r{   r   ry   stdoutstderrc                    [         R                  " 5       U l        [        U R                  S9U l        [        U R                  S9U l        g )Nr   )ioBytesIOr   ry   r   r   rC   s    r   r    StreamMixer.__init__   s/    jjl!$++6!$++6r"   )r   r   r   Nrv   )rR   rS   rT   rU   rw   rV   r    rW   rX   r"   r   r   r      s      7r"   r   c                     ^  \ rS rSr% SrS\S'   S\S'   S\S'             SU 4S jjrSS	 jrSU 4S
 jjr\	SS j5       r
\	SS j5       rSrU =r$ )_NamedTextIOWrapper   a  A :class:`~io.TextIOWrapper` with custom ``name`` and ``mode``
that does not close its underlying buffer.

When ``CliRunner`` runs in ``fd`` mode, ``_original_fd`` is patched to
point at the saved (pre-redirection) ``fd``, so C-level consumers that call
:meth:`fileno` (like ``faulthandler`` or ``subprocess``) keep working. In
the default ``sys`` mode ``_original_fd`` stays at ``-1`` and
:meth:`fileno` raises :exc:`io.UnsupportedOperation`, matching the
pre-``8.3.3`` behavior.
rL   _name_moderP   _original_fdc                N   > [         TU ]  " U40 UD6  X l        X0l        SU l        g rc   )r~   r    r   r   r   )r   buffernamemodekwargsr   s        r   r    _NamedTextIOWrapper.__init__   s)     	*6*

r"   c                    g)zThe buffer this object contains belongs to some other object,
so prevent the default ``__del__`` implementation from closing
that buffer.

.. versionadded:: 8.3.2
NrX   rC   s    r   rq   _NamedTextIOWrapper.close   s    r"   c                X   > U R                   S:  a  U R                   $ [        TU ]	  5       $ )zReturn the file descriptor of the saved original stream when
``CliRunner`` runs in ``fd`` mode. Otherwise delegate to
:class:`~io.TextIOWrapper`, which raises
:exc:`io.UnsupportedOperation` for a ``BytesIO``-backed buffer.
r   )r   r~   rm   r   s    r   rm   _NamedTextIOWrapper.fileno   s,     !$$$w~r"   c                    U R                   $ r$   )r   rC   s    r   r   _NamedTextIOWrapper.name       zzr"   c                    U R                   $ r$   )r   rC   s    r   r   _NamedTextIOWrapper.mode   r   r"   )r   r   r   )
r   r   r   rL   r   rL   r   rM   rJ   rK   rv   )rJ   rP   rQ   )rR   rS   rT   rU   rw   rV   r    rq   rm   propertyr   r   rW   r   r   s   @r   r   r      s    	 JJ

 
 	

 
 

     r"   r   c                   [        U S5      (       a0  [        [        R                  " SU 5      5      nUb  U$ [	        S5      eU c  Sn O&[        U [        5      (       a  U R                  U5      n [        R                  " U 5      $ )Nr0   zt.IO[t.Any]z.Could not find binary reader for input stream.r"   )
hasattrr
   tcast	TypeError
isinstancerL   encoder   r   )r   charsetr,   s      r   make_input_streamr      sp     uf u!=>>IHII}	E3		W%::er"   c                      \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   S\S'    S                 SS jjr\SS j5       r\SS j5       r	\SS j5       r
SS jrSrg)Result   a  Holds the captured result of an invoked CLI script.

:param runner: The runner that created the result
:param stdout_bytes: The standard output as bytes.
:param stderr_bytes: The standard error as bytes.
:param output_bytes: A mix of ``stdout_bytes`` and ``stderr_bytes``, as the
    user would see  it in its terminal.
:param return_value: The value returned from the invoked command.
:param exit_code: The exit code as integer.
:param exception: The exception that happened if one did.
:param exc_info: Exception information (exception type, exception instance,
    traceback type).

.. versionchanged:: 8.2
    ``stderr_bytes`` no longer optional, ``output_bytes`` introduced and
    ``mix_stderr`` has been removed.

.. versionadded:: 8.0
    Added ``return_value``.
	CliRunnerrunnerrN   stdout_bytesstderr_bytesoutput_bytesrM   return_valuerP   	exit_codeBaseException | None	exceptionExceptionInfo | Noneexc_infoNc	                d    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        g r$   r   r   r   r   r   r   r   r   )	r   r   r   r   r   r   r   r   r   s	            r   r    Result.__init__  s0     (((("" r"   c                    U R                   R                  U R                  R                  S5      R	                  SS5      $ )zThe terminal output as unicode string, as the user would see it.

.. versionchanged:: 8.2
    No longer a proxy for ``self.stdout``. Now has its own independent stream
    that is mixing `<stdout>` and `<stderr>`, in the order they were written.
replace

)r   decoder   r   r   rC   s    r   r   Result.output  s9       ''(;(;YGOOD
 	
r"   c                    U R                   R                  U R                  R                  S5      R	                  SS5      $ )z&The standard output as unicode string.r   r   r   )r   r   r   r   r   rC   s    r   r   Result.stdout&  s9       ''(;(;YGOOD
 	
r"   c                    U R                   R                  U R                  R                  S5      R	                  SS5      $ )zThe standard error as unicode string.

.. versionchanged:: 8.2
    No longer raise an exception, always returns the `<stderr>` string.
r   r   r   )r   r   r   r   r   rC   s    r   r   Result.stderr-  s9       ''(;(;YGOOD
 	
r"   c                    U R                   (       a  [        U R                   5      OSnS[        U 5      R                   SU S3$ )Nokay< >)r   rG   typerR   )r   exc_strs     r   rH   Result.__repr__8  s8    *...$t~~&f4:&&'q	33r"   )r   r   r   r   r   r   r   r   r$   )r   r   r   rN   r   rN   r   rN   r   rM   r   rP   r   r   r   r   rJ   rK   rQ   )rR   rS   rT   rU   rw   rV   r    r   r   r   r   rH   rW   rX   r"   r   r   r      s    * N##"" *.!! ! 	!
 ! ! ! (! '! 
!( 	
 	
 
 
 
 
4r"   r   c                  D   \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
\S'        S           SS jjrSS jr S   SS jjr\	R                     S       SS jj5       r     S               SS jjr\	R                   S   SS jj5       rSrg)r   i=  a  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 catch_exceptions: Whether to catch any exceptions other than
                         ``SystemExit`` when running :meth:`~CliRunner.invoke`.
:param capture: Selects the output capture strategy. ``sys`` (default)
    captures Python-level writes only and leaves
    :meth:`sys.stdout.fileno` raising :exc:`io.UnsupportedOperation`, so
    user code that calls :func:`os.dup2` on ``sys.stdout.fileno()`` cannot
    clobber the host runner's stdout. ``fd`` redirects file descriptors
    ``1`` and ``2`` via :func:`os.dup2` to a temporary file, also catching
    output from stale stream references, C extensions, and subprocesses.
    ``fd`` is not supported on Windows.

.. versionchanged:: 8.4.0
    Added the ``capture`` parameter. The default ``sys`` mode no longer
    exposes the original fd through :meth:`fileno`, reverting the change
    introduced in ``8.3.3`` that broke Pytest's ``fd``-level capture
    teardown. Use ``capture="fd"`` to restore that behavior with proper
    isolation. :issue:`3384`

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

.. versionchanged:: 8.2
    ``mix_stderr`` parameter has been removed.
rL   r   cabc.Mapping[str, str | None]envr   
echo_stdincatch_exceptionsr   captureNc                    US;  a  [        SU< S35      eUS:X  a$  [        R                  S:X  a  [        SU< S35      eXl        U=(       d    0 U l        X0l        X@l        XPl        g )N>   r   r   zcapture=z) is not valid. Choose from 'sys' or 'fd'.r   r   z( is not supported on Windows. Use 'sys'.)
ValueErrorr   platformr   r   r   r   r   )r   r   r   r   r   r   s         r   r    CliRunner.__init__h  sv     -'7+%NO  d?s||w67+%MN  9"$ 0r"   c                ,    UR                   =(       d    S$ )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)r   )r   clis     r   get_default_prog_nameCliRunner.get_default_prog_name~  s    
 xx!6!r"   c                `    [        U R                  5      nU(       a  UR                  U5        U$ )z8Returns the environment overrides for invoking a script.)dictr   update)r   	overridesr,   s      r   make_envCliRunner.make_env  s%     $((^IIi 	r"   c              #  z	  ^^^#    [        XR                  5      nSn[        R                  n[        R                  n[        R
                  n[        R                  n	S[        l        U R                  U5      n[        5       n
U R                  (       a9  [        R                  " [        R                  [        XJR                  5      5      =pE[        X@R                  SSS9=[        l        mU R                  (       a  STl        [        U
R                  U R                  SSS9[        l        [        U
R
                  U R                  S	SS
S9[        l        [#        U5      SSU4S jjj5       n[#        U5      SSU4S jjj5       n[#        U5      SS j5       nUm S     SU4S jjjn[$        R&                  n[$        R(                  n[$        R*                  n[,        R.                  n[0        R.                  n[2        R4                  R6                  mU[$        l        U[$        l        U[$        l        U[,        l        U[0        l           S           SU4S jjjnU[2        R4                  l        0 n UR9                  5        HR  u  nn[:        R<                  R?                  U5      UU'   Uc   [:        R<                  U	 M?  U[:        R<                  U'   MT     U
R                  U
R
                  U
RB                  4v   UR9                  5        H0  u  nnUc   [:        R<                  U	 M  U[:        R<                  U'   M2     U[        l        U[        l        U[        l        U[$        l        U[$        l        U[$        l        U[,        l        U[0        l        U	[        l        T[2        R4                  l        g! [@         a     GMF  f = f! [@         a     M  f = f! UR9                  5        HA  u  nnUc%   [:        R<                  U	 M  ! [@         a     M*  f = fU[:        R<                  U'   MC     U[        l        U[        l        U[        l        U[$        l        U[$        l        U[$        l        U[,        l        U[0        l        U	[        l        T[2        R4                  l        f = f7f)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.

: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.

.. versionadded:: 8.2
    An additional output stream is returned, which is a mix of
    `<stdout>` and `<stderr>` streams.

.. versionchanged:: 8.2
    Always returns the `<stderr>` stream.

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

.. versionchanged:: 4.0
    Added the ``color`` parameter.
Nr^   z<stdin>r)encodingr   r   r   z<stdout>wz<stderr>backslashreplace)r   r   r   errorsc                H  > [         R                  R                  U =(       d    S5         [        T5      R	                  S5      n[         R                  R                  U S35        [         R                  R                  5         U$ ! [
         a  n[        5       UeS nAff = f)N r   r   )r   r   r+   nextrstripStopIterationEOFErrorr   )promptvale
text_inputs      r   visible_input*CliRunner.isolation.<locals>.visible_input  s~    JJV\r*(:&--f5 JJuBZ(JJJ	 ! (ja'(s   B 
B!BB!c                  > [         R                  R                  U =(       d    S S35        [         R                  R                  5          [	        T5      R                  S5      $ ! [         a  n[        5       UeS nAff = f)Nr   r   r   )r   r   r+   r   r   r   r   r   )r   r   r   s     r   hidden_input)CliRunner.isolation.<locals>.hidden_input  se    JJ"~R01JJ(J'..v66  (ja'(s   A& &
B 0A;;B c                    [         R                  R                  S5      nU (       a  [         R                  R	                  U5        [         R                  R                  5         U$ )Nr   )r   stdinr0   r   r+   r   )echochars     r   _getchar%CliRunner.isolation.<locals>._getchar  s>    99>>!$D

  &JJKr"   c                &   > Uc  T(       + $ U(       + $ r$   rX   )rZ   colordefault_colors     r   should_strip_ansi.CliRunner.isolation.<locals>.should_strip_ansi  s     }(((9r"   c                j   > Uc  [         R                  nUc  [         R                  nT" U 4XUS.UD6  g)a  Default ``pdb.Pdb`` to real terminal streams during
``CliRunner`` isolation.

Without this patch, ``pdb.Pdb.__init__`` inherits from
``cmd.Cmd`` which falls back to ``sys.stdin``/``sys.stdout``
when no explicit streams are provided. During isolation
those are ``BytesIO``-backed wrappers, so the debugger
reads from an empty buffer and writes to captured output,
making interactive debugging impossible.

By defaulting to ``sys.__stdin__``/``sys.__stdout__`` (the
original terminal streams Python preserves regardless of
redirection), debuggers can interact with the user while
``click.echo`` output is still captured normally.

This covers ``pdb.set_trace()``, ``breakpoint()``,
``pdb.post_mortem()``, and debuggers that subclass
``pdb.Pdb`` (ipdb, pdbpp). Explicit ``stdin``/``stdout``
arguments are honored and not overridden. Debuggers that
do not subclass ``pdb.Pdb`` (pudb, debugpy) are not
covered.
N)completekeyr  r   )r   	__stdin__
__stdout__)r   r  r  r   r   old_pdb_inits        r   _patched_pdb_init.CliRunner.isolation.<locals>._patched_pdb_init  s>    : }~"-6MSr"   r$   )r   z
str | NonerJ   rL   )r  r   rJ   rL   )NN)rZ   zt.IO[t.Any] | Noner  bool | NonerJ   r   )tabNN)r   zpdb.Pdbr  rL   r  t.IO[str] | Noner   r  r   rM   rJ   rK   )"r   r   r   r  r   r   r   FORCED_WIDTHr   r   r   r   r   BinaryIOr   r   _CHUNK_SIZEr[   r   visible_prompt_funchidden_prompt_funcr  r	   r	  r   pdbPdbr    itemsrh   environget	Exceptionr   )r   r   r   r  bytes_input
echo_input	old_stdin
old_stdout
old_stderrold_forced_widthstream_mixerr   r   r  r	  old_visible_prompt_funcold_hidden_prompt_funcold__getchar_funcold_should_strip_ansiold__compat_should_strip_ansir  old_envkeyvaluer  r  r   s                           @@@r   	isolationCliRunner.isolation  s%    D (||<
II	ZZ
ZZ
%22"$
mmC "}??'(vv

L6I6IJ( K "5,,YS"
 	
	J ?? &'J"(\\	

 )\\%

 
Z	 	 	 
!	 
Z	 	( 	( 
!	( 
Z	 	 
!	  EI	&	6A		 	 #)"<"<!'!:!:"OO % 7 7(/(A(A%ww''%2"$0!""3$5!  %&*'+	#	#	#	 $#	 %	#	
 #	 #	 #	J -	,!iik
U!zz~~c2=JJsO ',BJJsO *  &&(;(;\=P=PQQ%mmo
U=JJsO ',BJJsO . $CJ#CJ!CI)@F&(>F%/FO&;E#(EG%&6J#+CGG/ %  % 	 &mmo
U=JJsO$  ',BJJsO . $CJ#CJ!CI)@F&(>F%/FO&;E#(EG%&6J#+CGGs   I8R;>;O) :O>O) 	R;#O4BR;
OO) OO) 
O&"R;%O&&R;)R8PR8
P%	!R8$P%	%BR88R;c                   SnUc  U R                   nSn	Sn
U R                  S:X  a7  [        S5      n	[        S5      n
 U	R                  5         U
R                  5         U R                  X4US9 nU	bA  U
b>  U	R                  [        R                  l	        U
R                  [        R                  l	        SnSnSn[        U[        5      (       a  [        R                  " U5      n UR                  S5      n UR$                  " SU=(       d    SUS	.UD6n[        R                  R7                  5         [        R                  R7                  5         U	bY  U
bV  U	R9                  5       nU
R9                  5       nU(       a  US   R3                  U5        U(       a  US   R3                  U5        US   R;                  5       nUS   R;                  5       nUS   R;                  5       n SSS5        [=        U WWWWWWUS9$ ! [         a    S=p GNf = f! [          a    U R#                  U5      n GN;f = f! [&         a  n[        R(                  " 5       n[*        R,                  " S
UR.                  5      nUc  SnUS:w  a  Un[        U[0        5      (       dI  [        R                  R3                  [        U5      5        [        R                  R3                  S5        SnUn SnAGNSnAf[4         a,  nU(       d  e UnSn[        R(                  " 5       n SnAGNSnAff = f! [        R                  R7                  5         [        R                  R7                  5         U	bY  U
bV  U	R9                  5       nU
R9                  5       nU(       a  US   R3                  U5        U(       a  US   R3                  U5        US   R;                  5       nUS   R;                  5       nUS   R;                  5       nf = f! , (       d  f       GN= f)ak  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``. If :data:`None`, the value
                         from :class:`CliRunner` is used.
: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.

.. versionadded:: 8.2
    The result object has the ``output_bytes`` attribute with
    the mix of ``stdout_bytes`` and ``stderr_bytes``, as the user would
    see it in its terminal.

.. versionchanged:: 8.2
    The result object always returns the ``stderr_bytes`` stream.

.. 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.
Nr   r      )r   r   r  r   	prog_namerX   )argsr3  zint | t.Any | Noner   r   )r   r   r]   rn   OSErrorr/  r`   r   r   r   r   r   rL   shlexsplitpopKeyErrorr   main
SystemExitr   r   r   coderP   r+   r  r   rt   getvaluer   )r   r   r4  r   r   r   r  extrar   cap_outcap_err
outstreamsr   r   r   r3  r   e_codefd_outfd_errr   r   r   s                          r   invokeCliRunner.invokeT  sj   j ##44 &*%)<<4 mG mG) ^^%^>* "w':*1*:*:

'*1*:*:

'L.2II$$${{4(<!IIk2	*2"xxVTZR9VPUV2 

  "

  "
 &7+>$\\^F$\\^F"1++F3"1++F3#A//1#A//1#A//1} ?@ %	
 		
G  )$((')(  < 66s;	<
  #<<> 4aff=>FQ; !I!&#..JJ$$S[1JJ$$T*F"	 *'		<<>* 

  "

  "
 &7+>$\\^F$\\^F"1++F3"1++F3#A//1#A//1#A//1} ?>s    G> -A6O9$H6H4CO9>HHH1-O90H11O94
L >B#K'!L#'L 4!LL#L  L##CO66O99
Pc              #    #    [         R                  " 5       n[        R                  " US9n[         R                  " U5         Uv   [         R                  " U5        Uc  SSKn UR                  U5        gg! [         a     gf = f! [         R                  " U5        Uc'  SSKn UR                  U5        f ! [         a     f f = ff = f7f)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.
)dirNr   )rh   getcwdrj   mkdtempchdirshutilrmtreer5  )r   temp_dircwddtrL  s        r   isolated_filesystemCliRunner.isolated_filesystem  s       iik(+
	HHHSMMM"%	  
   HHSMMM"%   sf   A CB C%A8 6C8
BCBCC
'B98C
9
CC
CC

C)r   r   r   r   r   )zutf-8NFTr   )r   rL   r   $cabc.Mapping[str, str | None] | Noner   r   r   r   r   r   rJ   rK   )r   r   rJ   rL   r$   )r   rS  rJ   r   )NNF)r    str | bytes | t.IO[t.Any] | Noner   rS  r  r   rJ   z9cabc.Generator[tuple[io.BytesIO, io.BytesIO, io.BytesIO]])NNNNF)r   r   r4  zstr | cabc.Sequence[str] | Noner   rT  r   rS  r   r  r  r   r>  rM   rJ   r   )rN  zstr | os.PathLike[str] | NonerJ   zcabc.Generator[str])rR   rS   rT   rU   rw   rV   r    r   r   
contextlibcontextmanagerr/  rE  rQ  rW   rX   r"   r   r   r   =  s   "H L	&& 48 !%$ 2 	
   
," AE=	&  3748	C,/C, 2C, 	C,
 
CC, C,P 152648(,O
O
 .O
 0	O

 2O
 &O
 O
 O
 
O
b 8<5	 r"   r   )rZ   zEchoingStdin | NonerJ   zcabc.Generator[None])r   rT  r   rL   rJ   r   )/
__future__r   collections.abcabccabcrU  r   rh   r  r6  r   rj   typingr   typesr   r   r   r   r   r	   r
   TYPE_CHECKING	_typeshedr   corer   r   Literalr   rV   tupler   BaseExceptionr   r   rV  r[   r]   r   ry   r   TextIOWrapperr   r   r   r   rX   r"   r   <module>rd     s"   "   	 	 
  
        (??(<<7 yy/K/ yy5K5"4#6}#TU{ U#! #!L  " "J "**  *7 7$4"** 4n+69(S4 S4lG Gr"   