+
    NjZg                      a  0 t $ ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ]P.                  '       d   ^ R	IHt ^R
IHt ]P8                  R8X  d   ]P:                  R,          tR]R&   M]P:                  R",          tR]R&   ] ]!]",          ]"]3,          t#R]R&    ! R R4      t$]PJ                  R R l4       t& ! R R4      t' ! R R]PP                  4      t) ! R R4      t* ! R R]PV                  4      t,R R lt- ! R R4      t. ! R  R!4      t/R# )#    )annotationsN)TracebackType)_compat)
formatting)termui)utils)_find_binary_reader)ReadableBuffer)Commandwin32syszt.TypeAliasCaptureModeExceptionInfoc                      ] tR t^ t$ R]R&   R]R&   R]R&   R R ltR R	 ltR
 R ltRR R lltRR R llt	RR R llt
R R ltR R ltR R ltRtR# )EchoingStdin
t.BinaryIO_input_outputbool_pausedc               $    V ^8  d   QhRRRRRR/# )   inputr   outputreturnNone )formats   "O/data/cameron/venvs/serve_omidlab/lib/python3.14/site-packages/click/testing.py__annotate__EchoingStdin.__annotate__%   s!      j *      c                	,    Wn         W n        R V n        R# )FNr   r   r   )selfr   r   s   &&&r   __init__EchoingStdin.__init__%   s    r"   c                    V ^8  d   QhRRRR/# )r   xstrr   t.Anyr   )r   s   "r   r    r!   *   s     ' 'S 'U 'r"   c                	.    \        V P                  V4      # N)getattrr   r%   r)   s   &&r   __getattr__EchoingStdin.__getattr__*   s    t{{A&&r"   c                    V ^8  d   QhRRRR/# )r   rvbytesr   r   )r   s   "r   r    r!   -   s       % r"   c                	`    V P                   '       g   V P                  P                  V4       V# r-   )r   r   write)r%   r3   s   &&r   _echoEchoingStdin._echo-   s"    |||LLr"	r"   c                    V ^8  d   QhRRRR/# r   nintr   r4   r   )r   s   "r   r    r!   3   s     / /c /5 /r"   c                	V    V P                  V P                  P                  V4      4      # r-   )r7   r   readr%   r;   s   &&r   r>   EchoingStdin.read3   s     zz$++**1-..r"   c                    V ^8  d   QhRRRR/# r:   r   )r   s   "r   r    r!   6   s     0 0s 0E 0r"   c                	V    V P                  V P                  P                  V4      4      # r-   )r7   r   read1r?   s   &&r   rC   EchoingStdin.read16   s     zz$++++A.//r"   c                    V ^8  d   QhRRRR/# r:   r   )r   s   "r   r    r!   9   s     3 3# 3u 3r"   c                	V    V P                  V P                  P                  V4      4      # r-   )r7   r   readliner?   s   &&r   rG   EchoingStdin.readline9   s     zz$++..q122r"   c                   V ^8  d   QhRR/# )r   r   zlist[bytes]r   )r   s   "r   r    r!   <   s     @ @; @r"   c                	|    V P                   P                  4        Uu. uF  qP                  V4      NK  	  up# u upi r-   )r   	readlinesr7   r/   s   & r   rK   EchoingStdin.readlines<   s/    '+{{'<'<'>?'>!

1'>???s   9c                   V ^8  d   QhRR/# )r   r   zcabc.Iterator[bytes]r   )r   s   "r   r    r!   ?   s     8 8. 8r"   c                	B   a  \        V 3R  lS P                   4       4      # )c              3  F   <"   T F  pSP                  V4      x  K  	  R # 5ir-   )r7   ).0r)   r%   s   & r   	<genexpr>(EchoingStdin.__iter__.<locals>.<genexpr>@   s     7;aDJJqMM;s   !)iterr   r%   s   fr   __iter__EchoingStdin.__iter__?   s    74;;777r"   c                   V ^8  d   QhRR/# r   r   r*   r   )r   s   "r   r    r!   B   s     ! !# !r"   c                	,    \        V P                  4      # r-   )reprr   rT   s   &r   __repr__EchoingStdin.__repr__B   s    DKK  r"   r$   N))__name__
__module____qualname____firstlineno____annotations__r&   r0   r7   r>   rC   rG   rK   rU   r[   __static_attributes__r   r"   r   r   r       sF    M
'/03@8! !r"   r   c                    V ^8  d   QhRRRR/# )r   streamzEchoingStdin | Noner   zcabc.Generator[None]r   )r   s   "r   r    r    G   s      + 0D r"   c              #  F   "   V f   R x  R # RV n         R x  RV n         R # 5i)NTF)r   )re   s   &r   _pause_echorg   F   s     ~s   !c                  ^    ] tR t^Pt$ RtR]R&   R]R&   R]R&   R R ltR	 R
 ltR R ltRt	R# )
_FDCapturea>  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
r<   	_targetfdsaved_fdzt.BinaryIO | None_tmpfilec                    V ^8  d   QhRRRR/# )r   targetfdr<   r   r   r   )r   s   "r   r    _FDCapture.__annotate___   s        r"   c                	.    Wn         RV n        RV n        R#    Nr]   )rj   rk   rl   )r%   rn   s   &&r   r&   _FDCapture.__init___   s    !r"   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r    ro   d   s     8 8t 8r"   c                	    \         P                  ! V P                  4      V n        \        P
                  ! ^ R7      V n        \         P                  ! V P                  P                  4       V P                  4       R# )r   )	bufferingN)	osduprj   rk   tempfileTemporaryFilerl   dup2filenorT   s   &r   start_FDCapture.startd   sG    t~~. ..;
$$&7r"   c                   V ^8  d   QhRR/# )r   r   r4   r   )r   s   "r   r    ro   i   s     	 	e 	r"   c                	   V P                   f   Q R4       h\        P                  ! V P                  V P                  4       \        P
                  ! V P                  4       RV n        V P                   P                  ^ 4       V P                   P                  4       pV P                   P                  4        R V n         V# )Nz!_FDCapture.start() was not calledr]   )rl   rx   r|   rk   rj   closeseekr>   )r%   datas   & r   stop_FDCapture.stopi   s    }}(M*MM(
t~~.
1}}!!#r"   )rj   rl   rk   N)
r^   r_   r`   ra   __doc__rb   r&   r~   r   rc   r   r"   r   ri   ri   P   s-     NM
8
	 	r"   ri   c                  b   a  ] tR t^ut$ RtR]R&   R V 3R lltR V 3R lltR V 3R	 lltR
t	V ;t
# )BytesIOCopyz\Patch ``io.BytesIO`` to let the written stream be copied to another.

.. versionadded:: 8.2

io.BytesIOcopy_toc                    V ^8  d   QhRRRR/# )r   r   r   r   r   r   )r   s   "r   r    BytesIOCopy.__annotate__}   s      
 t r"   c                	0   < \         SV `  4        Wn        R # r-   )superr&   r   )r%   r   	__class__s   &&r   r&   BytesIOCopy.__init__}   s    r"   c                   V ^8  d   QhRR/# ru   r   )r   s   "r   r    r      s      t r"   c                	X   < \         SV `  4        V P                  P                  4        R # r-   )r   flushr   r%   r   s   &r   r   BytesIOCopy.flush   s    r"   c                    V ^8  d   QhRRRR/# )r   br
   r   r<   r   )r   s   "r   r    r      s        ~  #  r"   c                	X   < V P                   P                  V4       \        SV `  V4      # r-   )r   r6   r   )r%   r   r   s   &&r   r6   BytesIOCopy.write   s$    1w}Qr"   r   )r^   r_   r`   ra   r   rb   r&   r   r6   rc   __classcell__r   s   @r   r   r   u   s.    
      r"   r   c                  F    ] tR t^t$ RtR]R&   R]R&   R]R&   R R ltR	tR
# )StreamMixerzvMixes `<stdout>` and `<stderr>` streams.

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

.. versionadded:: 8.2
r   r   r   stdoutstderrc                   V ^8  d   QhRR/# ru   r   )r   s   "r   r    StreamMixer.__annotate__   s     7 7$ 7r"   c                	    \         P                  ! 4       V n        \        V P                  R 7      V n        \        V P                  R 7      V n        R# )r   N)ioBytesIOr   r   r   r   rT   s   &r   r&   StreamMixer.__init__   s/    jjl!$++6!$++6r"   )r   r   r   N)r^   r_   r`   ra   r   rb   r&   rc   r   r"   r   r   r      s%     7 7r"   r   c                     a  ] tR t^t$ RtR]R&   R]R&   R]R&   R V 3R lltR	 R
 ltR V 3R llt]	R R l4       t
]	R R l4       tRtV ;t# )_NamedTextIOWrappera  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.
r*   _name_moder<   _original_fdc          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   bufferr   namer*   modekwargsr+   r   r   r   )r   s   "r   r     _NamedTextIOWrapper.__annotate__   s<     
 

 
 	

 
 

r"   c                	P   < \         SV `  ! V3/ VB  W n        W0n        RV n        R# rq   )r   r&   r   r   r   )r%   r   r   r   r   r   s   &&&&,r   r&   _NamedTextIOWrapper.__init__   s)     	*6*

r"   c                   V ^8  d   QhRR/# ru   r   )r   s   "r   r    r      s      t r"   c                    R# )zThe buffer this object contains belongs to some other object,
so prevent the default ``__del__`` implementation from closing
that buffer.

.. versionadded:: 8.3.2
Nr   rT   s   &r   r   _NamedTextIOWrapper.close   s    r"   c                   V ^8  d   QhRR/# )r   r   r<   r   )r   s   "r   r    r      s          r"   c                Z   < V P                   ^ 8  d   V P                   # \        SV `	  4       # )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}   r   s   &r   r}   _NamedTextIOWrapper.fileno   s,     !$$$w~r"   c                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r            c r"   c                	    V P                   # r-   )r   rT   s   &r   r   _NamedTextIOWrapper.name       zzr"   c                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r      r   r"   c                	    V P                   # r-   )r   rT   s   &r   r   _NamedTextIOWrapper.mode   r   r"   )r   r   r   )r^   r_   r`   ra   r   rb   r&   r   r}   propertyr   r   rc   r   r   s   @r   r   r      s[    	 JJ
 
       r"   r   c               $    V ^8  d   QhRRRRRR/# )r   r    str | bytes | t.IO[t.Any] | Nonecharsetr*   r   r   r   )r   s   "r   r    r       s$      +69r"   c                   \        V R 4      '       d2   \        \        P                  ! RV 4      4      pVe   V# \	        R4      hV f   Rp M'\        V \        4      '       d   V P                  V4      p \        P                  ! V 4      # )r>   zt.IO[t.Any]z.Could not find binary reader for input stream.r"   )
hasattrr	   tcast	TypeError
isinstancer*   encoder   r   )r   r   r3   s   && r   make_input_streamr      sp     uf u!=>>IHII}	E3		W%::er"   c                      ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   R]R	&   R
]R&   R]R&   R]R&   RR R llt]R R l4       t]R R l4       t	]R R l4       t
R R ltRtR# )Resulta  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runnerr4   stdout_bytesstderr_bytesoutput_bytesr+   return_valuer<   	exit_codeBaseException | None	exceptionExceptionInfo | Noneexc_infoNc               <    V ^8  d   QhRRRRRRRRRRR	R
RRRRRR/	# )r   r   r   r   r4   r   r   r   r+   r   r<   r   r   r   r   r   r   r   )r   s   "r   r    Result.__annotate__  sd     ! !! ! 	!
 ! ! ! (! '! 
!r"   c	                	f    Wn         W n        W0n        W@n        WPn        W`n        Wpn        Wn        R # 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                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r     s     	
 	
 	
r"   c                    V P                   P                  V P                  P                  R4      P	                  RR4      # )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   rT   s   &r   r   Result.output  s9       ''(;(;YGOOD
 	
r"   c                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r   '  s     
 
 
r"   c                    V P                   P                  V P                  P                  R4      P	                  RR4      # )z&The standard output as unicode string.r   r   r   )r   r   r   r   r   rT   s   &r   r   Result.stdout&  s9       ''(;(;YGOOD
 	
r"   c                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r   .  s     
 
 
r"   c                    V P                   P                  V P                  P                  R4      P	                  RR4      # )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   rT   s   &r   r   Result.stderr-  s9       ''(;(;YGOOD
 	
r"   c                   V ^8  d   QhRR/# rX   r   )r   s   "r   r    r   8  s     4 4# 4r"   c                	    V P                   '       d   \        V P                   4      MR pR\        V 4      P                   RV R2# )okay< >)r   rZ   typer^   )r%   exc_strs   & r   r[   Result.__repr__8  s:    *....$t~~&f4:&&'q	33r"   )r   r   r   r   r   r   r   r   r-   )r^   r_   r`   ra   r   rb   r&   r   r   r   r   r[   rc   r   r"   r   r   r      s    * N##""!( 	
 	
 
 
 
 
4 4r"   r   c                      ] tR tRt$ RtR]R&   R]R&   R]R&   R]R	&   R
]R&   RR R lltR R ltRR R llt]	P                  RR R ll4       tRR R llt]	P                  RR R ll4       tRtR# )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.
r*   r   cabc.Mapping[str, str | None]envr   
echo_stdincatch_exceptionsr   captureNc               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r   r*   r   $cabc.Mapping[str, str | None] | Noner   r   r   r   r   r   r   r   )r   s   "r   r    CliRunner.__annotate__h  sF       2 	
   
r"   c                	    VR9  d   \        RV: R24      hVR8X  d&   \        P                  R8X  d   \        RV: R24      hWn        T;'       g    / V n        W0n        W@n        WPn        R# )r   fdzcapture=z) is not valid. Choose from 'sys' or 'fd'.r   z( is not supported on Windows. Use 'sys'.N>   r  r   )
ValueErrorr   platformr   r   r   r   r   )r%   r   r   r   r   r   s   &&&&&&r   r&   CliRunner.__init__h  sx     -'7+%NO  d?s||w67+%MN  99"$ 0r"   c                    V ^8  d   QhRRRR/# )r   clir   r   r*   r   )r   s   "r   r    r   ~  s     " " "S "r"   c                .    VP                   ;'       g    R# )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%   r  s   &&r   get_default_prog_nameCliRunner.get_default_prog_name~  s    
 xx!!6!r"   c                    V ^8  d   QhRRRR/# )r   	overridesr   r   r   r   )r   s   "r   r    r     s      =	&r"   c                b    \        V P                  4      pV'       d   VP                  V4       V# )z8Returns the environment overrides for invoking a script.)dictr   update)r%   r  r3   s   && r   make_envCliRunner.make_env  s%     $((^IIi 	r"   c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r   r   colorr   r   z9cabc.Generator[tuple[io.BytesIO, io.BytesIO, io.BytesIO]]r   )r   s   "r   r    r     s9     C, C,/C, 2C, 	C,
 
CC,r"   c              #  	  aaa"   \        WP                  4      pRp\        P                  p\        P                  p\        P
                  p\        P                  p	^P\        n        V P                  V4      p\        4       p
V P                  '       d:   \        P                  ! \        P                  \        WJP                  4      4      ;rE\        W@P                  RRR7      ;\        n        oV P                  '       d   ^Sn        \        V
P                  V P                  RRR7      \        n        \        V
P
                  V P                  RRRR	7      \        n        \#        V4      RR
 V3R lll4       p\#        V4      RR V3R lll4       p\#        V4      R R l4       pVoRR V3R lllp\$        P&                  p\$        P(                  p\$        P*                  p\,        P.                  p\0        P.                  p\2        P4                  P6                  oV\$        n        V\$        n        V\$        n        V\,        n        V\0        n        RR V3R lllpV\2        P4                  n        / p VP9                  4        FS  w  pp\:        P<                  P?                  V4      VV&   Vf    \:        P<                  V K@  V\:        P<                  V&   KU  	  V
P                  V
P
                  V
PB                  3x  VP9                  4        F1  w  ppVf    \:        P<                  V K  V\:        P<                  V&   K3  	  V\        n        V\        n        V\        n        V\$        n        V\$        n        V\$        n        V\,        n        V\0        n        V	\        n        S\2        P4                  n        R#   \@         d     EKJ  i ; i  \@         d     K  i ; i  TP9                  4        FC  w  ppTf'    \:        P<                  T K    \@         d     K,  i ; iT\:        P<                  T&   KE  	  T\        n        T\        n        T\        n        T\$        n        T\$        n        T\$        n        T\,        n        T\0        n        T	\        n        S\2        P4                  n        i ; i5i)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.
Nz<stdin>r)encodingr   r   z<stdout>wz<stderr>backslashreplace)r  r   r   errorsc                    V ^8  d   QhRRRR/# r   promptz
str | Noner   r*   r   )r   s   "r   r    )CliRunner.isolation.<locals>.__annotate__  s     	 	* 	 	r"   c                L  < \         P                  P                  T ;'       g    R 4        \        S4      P	                  R4      p\         P                  P                  T R24       \         P                  P                  4        T#   \
         d   p\        4       ThRp?ii ; i) r   Nr   )r   r   r6   nextrstripStopIterationEOFErrorr   )r  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                    V ^8  d   QhRRRR/# r  r   )r   s   "r   r    r    s     	( 	( 	(s 	(r"   c                
  < \         P                  P                  T ;'       g    R  R24       \         P                  P                  4         \	        S4      P                  R4      #   \         d   p\        4       ThRp?ii ; i)r  r   r   N)r   r   r6   r   r   r!  r"  r#  )r  r%  r&  s   & r   hidden_input)CliRunner.isolation.<locals>.hidden_input  sg    JJ"~R01JJ(J'..v66  (ja'(s   A' 'B2A==Bc                    V ^8  d   QhRRRR/# )r   echor   r   r*   r   )r   s   "r   r    r    s     	 	4 	C 	r"   c                    \         P                  P                  ^4      pV '       d    \         P                  P	                  V4       \         P                  P                  4        V# )rr   )r   stdinr>   r   r6   r   )r.  chars   & r   _getchar%CliRunner.isolation.<locals>._getchar  s>    99>>!$D

  &JJKr"   c               $    V ^8  d   QhRRRRRR/# )r   re   zt.IO[t.Any] | Noner  bool | Noner   r   r   )r   s   "r   r    r    s$     	 	&	6A		r"   c                (   < Vf   S'       * # V'       * # r-   r   )re   r  default_colors   &&r   should_strip_ansi.CliRunner.isolation.<locals>.should_strip_ansi  s     }(((9r"   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r%   zpdb.Pdbcompletekeyr*   r0  zt.IO[str] | Noner   r   r+   r   r   r   )r   s   "r   r    r    sD     #	 #	#	#	 $#	 %	#	
 #	 #	r"   c           	     v   < Vf   \         P                  pVf   \         P                  pS! V 3RVRVRV/VB  R# )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.
Nr;  r0  r   )r   	__stdin__
__stdout__)r%   r;  r0  r   r   old_pdb_inits   &&&&,r   _patched_pdb_init.CliRunner.isolation.<locals>._patched_pdb_init  sL    : }~"-5:CIMSr"   r-   )NN)tabNN)"r   r   r   r0  r   r   r   FORCED_WIDTHr  r   r   r   r   BinaryIOr   r   _CHUNK_SIZErg   r   visible_prompt_funchidden_prompt_funcr2  r   r8  r   pdbPdbr&   itemsrx   environget	Exceptionr   )r%   r   r   r  bytes_input
echo_input	old_stdin
old_stdout
old_stderrold_forced_widthstream_mixerr'  r+  r2  r8  old_visible_prompt_funcold_hidden_prompt_funcold__getchar_funcold_should_strip_ansiold__compat_should_strip_ansir@  old_envkeyvaluer7  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	 	 
!	 	 	 #)"<"<!'!:!:"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   I4R>:<O* 7O>O* R>!O2BR>OO* OO* O'#R>&O''R>*R;PR;P(	$R;'P(	(BR;;R>c               8    V ^8  d   QhRRRRRRRRR	R
RRRRRR/# )r   r  r   argszstr | cabc.Sequence[str] | Noner   r   r   r   r   r5  r  r   extrar+   r   r   r   )r   s   "r   r    r   T  sd     O
 O
O
 .O
 0	O

 2O
 &O
 O
 O
 
O
r"   c                   RpVf   V P                   pRp	Rp
V P                  R8X  d8   \        ^4      p	\        ^4      p
 V	P                  4        V
P                  4        V P                  W4VR7      ;_uu_ 4       pV	eC   V
e?   V	P                  \        P                  n	        V
P                  \        P                  n	        RpRp^ p\        V\        4      '       d   \        P                  ! V4      p VP                  R4      p VP$                  ! R	RT;'       g    R	RV/VB p\        P                  P7                  4        \        P                  P7                  4        V	ee   V
ea   V	P9                  4       pV
P9                  4       pV'       d   V^ ,          P3                  V4       V'       d   V^,          P3                  V4       V^ ,          P;                  4       pV^,          P;                  4       pV^,          P;                  4       p RRR4       \=        V XXXXXXVR7      #   \         d    R;r ELi ; i  \          d    T P#                  T4      p ELZi ; i  \&         d   p\        P(                  ! 4       p\*        P,                  ! RTP.                  4      pTf   ^ pT^ 8w  d   Tp\        T\0        4      '       gJ   \        P                  P3                  \        T4      4       \        P                  P3                  R4       ^pTp Rp?ELRp?i\4         d.   pT'       g   h Tp^p\        P(                  ! 4       p Rp?EL*Rp?ii ; i  \        P                  P7                  4        \        P                  P7                  4        T	ee   T
ea   T	P9                  4       pT
P9                  4       pT'       d   T^ ,          P3                  T4       T'       d   T^,          P3                  T4       T^ ,          P;                  4       pT^,          P;                  4       pT^,          P;                  4       pi ; i  + '       g   i     EL?; i)
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  	prog_namer`  zint | t.Any | Noner   r   r   )r   r   ri   r~   OSErrorr]  rk   r   r   r   r   r   r*   shlexsplitpopKeyErrorr	  main
SystemExitr   r   r   coder<   r6   rM  r   r   getvaluer   )r%   r  r`  r   r   r   r  ra  r   cap_outcap_err
outstreamsr   r   r   rc  r%  e_codefd_outfd_errr   r   r   s   &&&&&&&,               r   invokeCliRunner.invokeT  su   j ##44 &*%)<<4 mG mG) ^^%^>>* "w':*1*:*:

'*1*:*:

'L.2II$$${{4(<!IIk2	*2"xxVTZZRV9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    H+ :A9Q4I  I#&A+QQ2AQ+H=<H= I QI  Q#M.B&LMM'M("M
MMMA,QQ%AQQQ	c                    V ^8  d   QhRRRR/# )r   temp_dirzstr | os.PathLike[str] | Noner   zcabc.Generator[str]r   )r   s   "r   r    r     s      5	r"   c              #    "   \         P                  ! 4       p\        P                  ! VR7      p\         P                  ! V4        Vx  \         P                  ! V4       Vf   ^ RIp VP                  V4       R# R#   \         d     R# i ; i  \         P                  ! T4       Tf)   ^ RIp TP                  T4       i   \         d     i i ; ii ; i5i)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)rx   getcwdrz   mkdtempchdirshutilrmtreerd  )r%   rv  cwddtr|  s   &&   r   isolated_filesystemCliRunner.isolated_filesystem  s       iik(+
	HHHSMMM"%	  
   HHSMMM"%   sf   ACB 
C)A> :C>B	CBCC0CCCCCCC)r   r   r   r   r   )zutf-8NFTr   r-   )NNF)NNNNF)r^   r_   r`   ra   r   rb   r&   r	  r  
contextlibcontextmanagerr]  rs  r  rc   r   r"   r   r   r   =  st    "H L	&&," C, C,JO
b  r"   r   )r   r  )0__conditional_annotations__
__future__r   collections.abcabccabcr  r   rx   rH  re  r   rz   typingr   typesr   r  r   r   r   r   r	   TYPE_CHECKING	_typeshedr
   corer   r  Literalr   rb   tupler   BaseExceptionr   r   r  rg   ri   r   r   r   TextIOWrapperr   r   r   r   )r  s   @r   <module>r     s   " "   	 	 
  
        (???(<<7 yy/K/ yy5K5"4#6}#TU{ U#! #!L  " "J "**  *7 7$4"** 4n(S4 S4lG Gr"   