Ë
     V.jud  ã                  óä  — d dl mZ d dlmZ d dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ ej,                  rd d
lmZ ddlmZ ej6                  d   Z G d„ d«      Zej<                  dd„«       Z G d„ d«      Z  G d„ dejB                  «      Z" G d„ d«      Z# G d„ dejH                  «      Z%	 	 	 	 	 	 dd„Z& G d„ d«      Z' G d„ d«      Z(y)é    )ÚannotationsN)ÚTracebackTypeé   )Ú_compat)Ú
formatting)Útermui)Úutils)Ú_find_binary_reader)ÚReadableBuffer)ÚCommand)ÚsysÚfdc                  óZ   — e Zd Zdd„Zdd„Zdd„Zddd„Zddd„Zddd„Zdd„Z	dd„Z
dd	„Zy
)ÚEchoingStdinc                ó.   — || _         || _        d| _        y )NF)Ú_inputÚ_outputÚ_paused)ÚselfÚinputÚoutputs      úOC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\click/testing.pyÚ__init__zEchoingStdin.__init__   s   € ØˆŒØˆŒØˆ�ó    c                ó.   — t        | j                  |«      S ©N)Úgetattrr   ©r   Úxs     r   Ú__getattr__zEchoingStdin.__getattr__"   s   € Ü�t—{‘{ AÓ&Ð&r   c                óT   — | j                   s| j                  j                  |«       |S r   )r   r   Úwrite)r   Úrvs     r   Ú_echozEchoingStdin._echo%   s    € Ø�|Š|Ø�L‰L×Ñ˜rÔ"àˆ	r   c                óV   — | j                  | j                  j                  |«      «      S r   )r$   r   Úread©r   Úns     r   r&   zEchoingStdin.read+   s    € Ø�z‰z˜$Ÿ+™+×*Ñ*¨1Ó-Ó.Ð.r   c                óV   — | j                  | j                  j                  |«      «      S r   )r$   r   Úread1r'   s     r   r*   zEchoingStdin.read1.   s    € Ø�z‰z˜$Ÿ+™+×+Ñ+¨AÓ.Ó/Ð/r   c                óV   — | j                  | j                  j                  |«      «      S r   )r$   r   Úreadliner'   s     r   r,   zEchoingStdin.readline1   s    € Ø�z‰z˜$Ÿ+™+×.Ñ.¨qÓ1Ó2Ð2r   c                óz   — | j                   j                  «       D �cg c]  }| j                  |«      ‘Œ c}S c c}w r   )r   Ú	readlinesr$   r   s     r   r.   zEchoingStdin.readlines4   s1   € Ø'+§{¡{×'<Ñ'<Ô'>Ó?Ñ'> !�—
‘
˜1•Ð'>Ñ?Ð?ùÒ?s   �8c                ó@   ‡ — t        ˆ fd„‰ j                  D «       «      S )Nc              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­wr   )r$   )Ú.0r   r   s     €r   Ú	<genexpr>z(EchoingStdin.__iter__.<locals>.<genexpr>8   s   øè ø€ Ð7©; a�D—J‘J˜q—M©;ùs   ƒ)Úiterr   ©r   s   `r   Ú__iter__zEchoingStdin.__iter__7   s   ø€ ÜÓ7¨4¯;ª;Ó7Ó7Ð7r   c                ó,   — t        | j                  «      S r   )Úreprr   r4   s    r   Ú__repr__zEchoingStdin.__repr__:   s   € Ü�D—K‘KÓ Ð r   N)r   ú
t.BinaryIOr   r9   ÚreturnÚNone)r   Ústrr:   út.Any)r#   Úbytesr:   r>   )éÿÿÿÿ)r(   Úintr:   r>   )r:   zlist[bytes])r:   zcabc.Iterator[bytes]©r:   r<   )Ú__name__Ú
__module__Ú__qualname__r   r    r$   r&   r*   r,   r.   r5   r8   © r   r   r   r      s0   „ óó
'óô/ô0ô3ó@ó8ô!r   r   c              #  ó>   K  — | €d –— y d| _         d –— d| _         y ­w)NTF)r   )Ústreams    r   Ú_pause_echorH   >   s   è ø€ à€~ÜàˆŒÛØˆ�ùs   ‚c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)	Ú
_FDCaptureaV  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
    c                ó.   — || _         d| _        d | _        y ©Nr?   )Ú	_targetfdÚsaved_fdÚ_tmpfile)r   Útargetfds     r   r   z_FDCapture.__init__S   s   € Ø!ˆŒØˆŒØ+/ˆ�r   c                óò   — t        j                  | j                  «      | _        t	        j
                  d¬«      | _        t        j                  | j                  j                  «       | j                  «       y )Nr   )Ú	buffering)	ÚosÚduprM   rN   ÚtempfileÚTemporaryFilerO   Údup2Úfilenor4   s    r   Ústartz_FDCapture.startX   sG   € ÜŸ™˜tŸ~™~Ó.ˆŒÜ ×.Ñ.¸Ô;ˆŒÜ
�‰�—‘×$Ñ$Ó&¨¯©Õ7r   c                óx  — | j                   €J d«       ‚t        j                  | j                  | j                  «       t        j
                  | j                  «       d| _        | j                   j                  d«       | j                   j                  «       }| j                   j                  «        d | _         |S )Nz!_FDCapture.start() was not calledr?   r   )rO   rS   rW   rN   rM   ÚcloseÚseekr&   )r   Údatas     r   Ústopz_FDCapture.stop]   s…   € Ø�}‰}Ð(ÐMÐ*MÓMÐ(Ü
�‰�—‘˜tŸ~™~Ô.Ü
�‰�—‘ÔØˆŒØ�‰×Ñ˜1ÔØ�}‰}×!Ñ!Ó#ˆØ�‰×ÑÔØˆŒØˆr   N)rP   r@   r:   r;   ©r:   r;   )r:   r>   )rB   rC   rD   Ú__doc__r   rY   r^   rE   r   r   rJ   rJ   H   s   „ ñó0ó
8ô
	r   rJ   c                  ó<   ‡ — e Zd ZdZdˆ fd„Zdˆ fd„Zdˆ fd„Zˆ xZS )ÚBytesIOCopyzdPatch ``io.BytesIO`` to let the written stream be copied to another.

    .. versionadded:: 8.2
    c                ó0   •— t         ‰| �  «        || _        y r   )Úsuperr   Úcopy_to)r   re   Ú	__class__s     €r   r   zBytesIOCopy.__init__o   s   ø€ Ü‰ÑÔØˆ�r   c                óV   •— t         ‰| �  «        | j                  j                  «        y r   )rd   Úflushre   ©r   rf   s    €r   rh   zBytesIOCopy.flushs   s   ø€ Ü‰‰ŒØ�‰×ÑÕr   c                óX   •— | j                   j                  |«       t        ‰| �  |«      S r   )re   r"   rd   )r   Úbrf   s     €r   r"   zBytesIOCopy.writew   s$   ø€ Ø�‰×Ñ˜1ÔÜ‰w‰}˜QÓÐr   )re   z
io.BytesIOr:   r;   r_   )rk   r   r:   r@   )rB   rC   rD   r`   r   rh   r"   Ú__classcell__©rf   s   @r   rb   rb   i   s   ø„ ñõ
õ÷ ñ  r   rb   c                  ó   — e Zd ZdZdd„Zy)ÚStreamMixerz‚Mixes `<stdout>` and `<stderr>` streams.

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

    .. versionadded:: 8.2
    c                ó¢   — t        j                  «       | _        t        | j                  ¬«      | _        t        | j                  ¬«      | _        y )N)re   )ÚioÚBytesIOr   rb   ÚstdoutÚstderrr4   s    r   r   zStreamMixer.__init__„   s/   € Ü"$§*¡*£,ˆŒÜ"-°d·k±kÔ"BˆŒÜ"-°d·k±kÔ"Bˆ�r   Nr_   )rB   rC   rD   r`   r   rE   r   r   ro   ro   |   s   „ ñôCr   ro   c                  óp   ‡ — e Zd ZdZ	 	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zd	ˆ fd„Zed
d„«       Zed
d„«       Z	ˆ xZ
S )Ú_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.
    c                óP   •— t        ‰| �  |fi |¤Ž || _        || _        d| _        y rL   )rd   r   Ú_nameÚ_modeÚ_original_fd)r   ÚbufferÚnameÚmodeÚkwargsrf   s        €r   r   z_NamedTextIOWrapper.__init__–   s-   ø€ ô 	‰Ñ˜Ñ* 6Ò*ØˆŒ
ØˆŒ
Ø!#ˆÕr   c                 ó   — y)zÃThe buffer this object contains belongs to some other object,
        so prevent the default ``__del__`` implementation from closing
        that buffer.

        .. versionadded:: 8.3.2
        NrE   r4   s    r   r[   z_NamedTextIOWrapper.close¢   s   � r   c                óV   •— | j                   dk\  r| j                   S t        ‰| �	  «       S )zÿReturn 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   )rz   rd   rX   ri   s    €r   rX   z_NamedTextIOWrapper.filenoª   s,   ø€ ð ×Ñ Ò!Ø×$Ñ$Ð$Ü‰w‰~ÓÐr   c                ó   — | j                   S r   )rx   r4   s    r   r|   z_NamedTextIOWrapper.name´   ó   € à�z‰zÐr   c                ó   — | j                   S r   )ry   r4   s    r   r}   z_NamedTextIOWrapper.mode¸   r‚   r   )
r{   r9   r|   r<   r}   r<   r~   r=   r:   r;   r_   )r:   r@   rA   )rB   rC   rD   r`   r   r[   rX   Úpropertyr|   r}   rl   rm   s   @r   rv   rv   Š   so   ø„ ñ	ð
$àð
$ð ð
$ð ð	
$ð
 ð
$ð 
õ
$óõ ð òó ðð òó ôr   rv   c                óì   — t        | d«      r.t        t        j                  d| «      «      }|�|S t	        d«      ‚| €d} n!t        | t        «      r| j                  |«      } t        j                  | «      S )Nr&   zt.IO[t.Any]z.Could not find binary reader for input stream.r   )
Úhasattrr
   ÚtÚcastÚ	TypeErrorÚ
isinstancer<   Úencoderq   rr   )r   Úcharsetr#   s      r   Úmake_input_streamr�   ½   sj   € ô ˆu�fÔÜ ¤§¡¨°uÓ!=Ó>ˆàˆ>ØˆIäÐHÓIÐIà€}Ø‰Ü	�Eœ3Ô	Ø—‘˜WÓ%ˆä�:‰:�eÓÐr   c                  óx   — e Zd ZdZ	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d	d„Zed
d„«       Zed
d„«       Zed
d„«       Zd
d„Z	y)ÚResultaC  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``.
    Nc	                ót   — || _         || _        || _        || _        || _        || _        || _        || _        y r   ©ÚrunnerÚstdout_bytesÚstderr_bytesÚoutput_bytesÚreturn_valueÚ	exit_codeÚ	exceptionÚexc_info)	r   r’   r“   r”   r•   r–   r—   r˜   r™   s	            r   r   zResult.__init__ç   s@   € ð ˆŒØ(ˆÔØ(ˆÔØ(ˆÔØ(ˆÔØ"ˆŒØ"ˆŒØ ˆ�r   c                ó‚   — | j                   j                  | j                  j                  d«      j	                  dd«      S )a  The 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›   r4   s    r   r   zResult.outputü   s9   € ð × Ñ ×'Ñ'¨¯©×(;Ñ(;¸YÓG×OÑOØ�Dó
ð 	
r   c                ó‚   — | j                   j                  | j                  j                  d«      j	                  dd«      S )z&The standard output as unicode string.r›   rœ   r�   )r“   rž   r’   rŒ   r›   r4   s    r   rs   zResult.stdout  s9   € ð × Ñ ×'Ñ'¨¯©×(;Ñ(;¸YÓG×OÑOØ�Dó
ð 	
r   c                ó‚   — | j                   j                  | j                  j                  d«      j	                  dd«      S )zŸThe 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›   r4   s    r   rt   zResult.stderr  s9   € ð × Ñ ×'Ñ'¨¯©×(;Ñ(;¸YÓG×OÑOØ�Dó
ð 	
r   c                ó€   — | j                   rt        | j                   «      nd}dt        | «      j                  › d|› d�S )NÚokayÚ<Ú Ú>)r˜   r7   ÚtyperB   )r   Úexc_strs     r   r8   zResult.__repr__  s8   € Ø*.¯.ª.”$�t—~‘~Ô&¸fˆØ”4˜“:×&Ñ&Ð' q¨¨	°Ð3Ð3r   r   )r’   Ú	CliRunnerr“   r>   r”   r>   r•   r>   r–   r=   r—   r@   r˜   zBaseException | Noner™   z?tuple[type[BaseException], BaseException, TracebackType] | NonerA   )
rB   rC   rD   r`   r   r„   r   rs   rt   r8   rE   r   r   r�   r�   Ñ   s    „ ñð> ð!àð!ð ð!ð ð	!ð
 ð!ð ð!ð ð!ð (ð!ðó!ð* ò	
ó ð	
ð ò
ó ð
ð ò
ó ð
ô4r   r�   c                  óò   — e Zd ZdZ	 	 	 	 	 d		 	 	 	 	 	 	 	 	 	 	 d
d„Zdd„Z	 d	 	 	 dd„Zej                  	 	 	 d	 	 	 	 	 	 	 dd„«       Z		 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z
ej                  	 d	 	 	 dd„«       Zy)r¨   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.
    Nc                óÆ   — |dvrt        d|›d�«      ‚|dk(  r"t        j                  dk(  rt        d|›d�«      ‚|| _        |xs i | _        || _        || _        || _        y )N>   r   r   zcapture=z) is not valid. Choose from 'sys' or 'fd'.r   Úwin32z( is not supported on Windows. Use 'sys'.)Ú
ValueErrorr   ÚplatformrŒ   ÚenvÚ
echo_stdinÚcatch_exceptionsÚcapture)r   rŒ   r®   r¯   r°   r±   s         r   r   zCliRunner.__init__D  s~   € ð ˜-Ñ'ÜØ˜7˜+Ð%NÐOóð ð �dŠ?œsŸ|™|¨wÒ6ÜØ˜7˜+Ð%MÐNóð ð ˆŒØ25²)¸ˆŒØ$ˆŒØ 0ˆÔØ$+ˆ�r   c                ó"   — |j                   xs dS )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)r|   )r   Úclis     r   Úget_default_prog_namezCliRunner.get_default_prog_nameZ  s   € ð
 �x‰xÒ!˜6Ð!r   c                óV   — t        | j                  «      }|r|j                  |«       |S )z8Returns the environment overrides for invoking a script.)Údictr®   Úupdate)r   Ú	overridesr#   s      r   Úmake_envzCliRunner.make_enva  s%   € ô �$—(‘(‹^ˆÙØ�I‰I�iÔ Øˆ	r   c              #  ó@	  ‡‡‡K  — t        || j                  «      }d}t        j                  }t        j                  }t        j
                  }t        j                  }	dt        _        | j                  |«      }t        «       }
| j                  r:t        j                  t        j                  t        ||
j                  «      «      x}}t        || j                  dd¬«      xt        _        Š| j                  rd‰_        t        |
j                  | j                  dd¬«      t        _        t        |
j
                  | j                  d	dd
¬«      t        _        t#        |«      ddˆfd„«       }t#        |«      ddˆfd„«       }t#        |«      dd„«       }|Š	 d	 	 	 	 	 dˆfd„}t$        j&                  }t$        j(                  }t$        j*                  }t,        j.                  }t0        j.                  }t2        j4                  j6                  Š|t$        _        |t$        _        |t$        _        |t,        _        |t0        _        	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dˆfd„}|t2        j4                  _        i }	 |j9                  «       D ]O  \  }}t:        j<                  j?                  |«      ||<   |€	 t:        j<                  |= Œ=|t:        j<                  |<   ŒQ |
j                  |
j
                  |
jB                  f–— |j9                  «       D ]-  \  }}|€	 t:        j<                  |= Œ|t:        j<                  |<   Œ/ |t        _        |t        _        |t        _        |t$        _        |t$        _        |t$        _        |t,        _        |t0        _        |	t        _        ‰t2        j4                  _        y# t@        $ r Y �Œ<w xY w# t@        $ r Y ŒÄw xY w# |j9                  «       D ]<  \  }}|€"	 t:        j<                  |= Œ# t@        $ r Y Œ&w xY w|t:        j<                  |<   Œ> |t        _        |t        _        |t        _        |t$        _        |t$        _        |t$        _        |t,        _        |t0        _        |	t        _        ‰t2        j4                  _        w xY w­w)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.
        NéP   z<stdin>Úr)Úencodingr|   r}   r   z<stdout>Úwz<stderr>Úbackslashreplace)r¾   r|   r}   Úerrorsc                ó<  •— t         j                  j                  | xs d«       	 t        ‰«      j	                  d«      }t         j                  j                  |› d�«       t         j                  j                  «        |S # t
        $ r}t        «       |‚d }~ww xY w)NÚ rœ   r�   )r   rs   r"   ÚnextÚrstripÚStopIterationÚEOFErrorrh   )ÚpromptÚvalÚeÚ
text_inputs      €r   Úvisible_inputz*CliRunner.isolation.<locals>.visible_input¶  s~   ø€ ä�J‰J×Ñ˜Vš\ rÔ*ð(Ü˜:Ó&×-Ñ-¨fÓ5�ô �J‰J×Ñ ˜u B˜ZÔ(Ü�J‰J×ÑÔØˆJøô	 !ò (Ü“j aÐ'ûð(ús   ¦B Â	BÂBÂBc                óú   •— t         j                  j                  | xs d› d�«       t         j                  j                  «        	 t	        ‰«      j                  d«      S # t        $ r}t        «       |‚d }~ww xY w)NrÃ   r�   rœ   )r   rs   r"   rh   rÄ   rÅ   rÆ   rÇ   )rÈ   rÊ   rË   s     €r   Úhidden_inputz)CliRunner.isolation.<locals>.hidden_inputÁ  se   ø€ ä�J‰J×Ñ ¢¨"˜~¨RÐ0Ô1Ü�J‰J×ÑÔð(Ü˜JÓ'×.Ñ.¨vÓ6Ð6øÜ ò (Ü“j aÐ'ûð(ús   ÁA! Á!	A:Á*A5Á5A:c                óÂ   — t         j                  j                  d«      }| rt         j                  j	                  |«       t         j                  j                  «        |S )Nr   )r   Ústdinr&   rs   r"   rh   )ÚechoÚchars     r   Ú_getcharz%CliRunner.isolation.<locals>._getcharÊ  s>   € ä—9‘9—>‘> !Ó$ˆDáÜ—
‘
× Ñ  Ô&ä�J‰J×ÑÔØˆKr   c                ó   •— |€‰ S | S r   rE   )rG   ÚcolorÚdefault_colors     €r   Úshould_strip_ansiz.CliRunner.isolation.<locals>.should_strip_ansiÖ  s   ø€ ð ˆ}Ø(Ð(Ð(Ø�9Ðr   c                óh   •— |€t         j                  }|€t         j                  } ‰| f|||dœ|¤Ž y)ab  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Ð   rs   )r   Ú	__stdin__Ú
__stdout__)r   rÙ   rÐ   rs   r~   Úold_pdb_inits        €r   Ú_patched_pdb_initz.CliRunner.isolation.<locals>._patched_pdb_inité  s@   ø€ ð: ˆ}ÜŸ™�Øˆ~ÜŸ™�ÙØðØ"-°UÀ6ñØMSór   r   )rÈ   z
str | Noner:   r<   )rÑ   Úboolr:   r<   )NN)rG   zt.IO[t.Any] | NonerÕ   úbool | Noner:   rÞ   )ÚtabNN)r   zpdb.PdbrÙ   r<   rÐ   út.IO[str] | Noners   rá   r~   r=   r:   r;   )"r�   rŒ   r   rÐ   rs   rt   r   ÚFORCED_WIDTHrº   ro   r¯   r‡   rˆ   ÚBinaryIOr   rv   Ú_CHUNK_SIZErH   r   Úvisible_prompt_funcÚhidden_prompt_funcrÓ   r	   r×   r   ÚpdbÚPdbr   ÚitemsrS   Ú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   Ú	isolationzCliRunner.isolationj  s  úè ø€ ôD (¨¨t¯|©|Ó<ˆØˆ
ä—I‘Iˆ	Ü—Z‘Zˆ
Ü—Z‘Zˆ
Ü%×2Ñ2ÐØ"$Œ
Ôà�m‰m˜CÓ ˆä"“}ˆà�?Š?Ü'(§v¡vÜ—
‘
œL¨°l×6IÑ6IÓJó(ð ˆK˜*ô "5Ø $§,¡,°YÀSô"
ð 	
ŒŒ	�Jð �?Š?ð &'ˆJÔ"ä(Ø×ÑØ—\‘\ØØô	
ŒŒ
ô )Ø×ÑØ—\‘\ØØØ%ô
ŒŒ
ô 
�ZÓ	 õ	ó 
!ð	ô 
�ZÓ	 õ	(ó 
!ð	(ô 
�ZÓ	 ò	ó 
!ð	ð ˆð EIð	Ø&ð	Ø6Að	àõ	ô #)×"<Ñ"<ÐÜ!'×!:Ñ!:ÐÜ"ŸO™OÐÜ %× 7Ñ 7ÐÜ(/×(AÑ(AÐ%Ü—w‘w×'Ñ'ˆØ%2ŒÔ"Ø$0ŒÔ!Ø"ŒŒØ"3ŒÔØ$5ŒÔ!ð  %Ø&*Ø'+ð	#	Øð#	àð#	ð $ð#	ð %ð	#	ð
 ð#	ð õ#	ðJ -Œ�‰Ôàˆð	,Ø!Ÿi™ižk‘
��UÜ!Ÿz™zŸ~™~¨cÓ2�˜‘Ø�=ðÜŸJ™J s™Oð ',”B—J‘J˜s’Oð *ð  ×&Ñ&¨×(;Ñ(;¸\×=PÑ=PÐQÒQà%Ÿm™mžo‘
��UØ�=ðÜŸJ™J s™Oð ',”B—J‘J˜s’Oð .ð $ŒCŒJØ#ŒCŒJØ!ŒCŒIØ)@ŒFÔ&Ø(>ŒFÔ%Ø/ŒFŒOØ&;ŒEÔ#Ø(EŒGÔ%Ø&6ŒJÔ#Ø+ŒC�G‰GÕøô/ %ò Úðûô %ò Ùðûð	 &Ÿm™mžo‘
��UØ�=ðÜŸJ™J s™OøÜ$ò Ùðúð ',”B—J‘J˜s’Oð .ð $ŒCŒJØ#ŒCŒJØ!ŒCŒIØ)@ŒFÔ&Ø(>ŒFÔ%Ø/ŒFŒOØ&;ŒEÔ#Ø(EŒGÔ%Ø&6ŒJÔ#Ø+ŒC�G‰GÕüsŒ   …I-RÉ3:O Ê.N3Ê?;O Ë:RÌOÌ$BRÎ3	O Î<O Î?O Ï O Ï	OÏRÏOÏRÏRÏ,O>Ï=RÏ>	P
	ÐRÐ	P
	Ð
BRÒRc           
     ó¨  — d}|€| j                   }d}	d}
| j                  dk(  r7t        d«      }	t        d«      }
	 |	j                  «        |
j                  «        | j                  |||¬«      5 }|	�@|
�>|	j                  t        j                  _	        |
j                  t        j                  _	        d}d}d}t        |t        «      rt        j                  |«      }	 |j                  d«      }	  |j$                  d|xs d|d	œ|¤Ž}t        j                  j7                  «        t        j                  j7                  «        |	�N|
�L|	j9                  «       }|
j9                  «       }|r|d   j3                  |«       |r|d   j3                  |«       |d   j;                  «       }|d   j;                  «       }|d   j;                  «       }	 ddd«       t=        | |¬«      S # t        $ r dx}	}
Y �ŒŸw xY w# t         $ r | j#                  |«      }Y �Œ,w xY w# t&        $ r¥}t        j(                  «       }t+        j,                  d
|j.                  «      }|€d}|dk7  r|}t        |t0        «      sIt        j                  j3                  t        |«      «       t        j                  j3                  d«       d}|}Y d}~�Œ¿d}~wt4        $ r&}|s‚ |}d}t        j(                  «       }Y d}~�Œìd}~ww xY w# t        j                  j7                  «        t        j                  j7                  «        |	�N|
�L|	j9                  «       }|
j9                  «       }|r|d   j3                  |«       |r|d   j3                  |«       |d   j;                  «       }|d   j;                  «       }|d   j;                  «       }w xY w# 1 sw Y   �ŒúxY w)a{  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_namerE   )Úargsrÿ   zint | t.Any | Noner�   r‘   )r°   r±   rJ   rY   ÚOSErrorrü   rN   r   rs   rz   rt   rŠ   r<   ÚshlexÚsplitÚpopÚKeyErrorrµ   ÚmainÚ
SystemExitr™   r‡   rˆ   Úcoder@   r"   rì   rh   r^   Úgetvaluer�   )r   r´   r   r   r®   r°   rÕ   Úextrar™   Úcap_outÚcap_errÚ
outstreamsr–   r˜   r—   rÿ   rÊ   Úe_codeÚfd_outÚfd_errrs   rt   r   s                          r   ÚinvokezCliRunner.invoke0  sh  € ðj ˆØÐ#Ø#×4Ñ4Ðð &*ˆØ%)ˆà�<‰<˜4ÒÜ  “mˆGÜ  “mˆGð)Ø—‘”Ø—‘”ð �^‰^ %¨S¸ˆ^Ô>À*ð Ð" wÐ':Ø*1×*:Ñ*:”—
‘
Ô'Ø*1×*:Ñ*:”—
‘
Ô'àˆLØ.2ˆIØˆIä˜$¤Ô$Ü—{‘{ 4Ó(�ð<Ø!ŸI™I kÓ2�	ð*2Ø'˜sŸx™xÐV¨TªZ°RÀ9ÑVÐPUÑV�ô2 —
‘
× Ñ Ô"Ü—
‘
× Ñ Ô"ð
 Ð&¨7Ð+>Ø$Ÿ\™\›^�FØ$Ÿ\™\›^�FÙØ" 1™×+Ñ+¨FÔ3ÙØ" 1™×+Ñ+¨FÔ3à# A™×/Ñ/Ó1�Ø# A™×/Ñ/Ó1�Ø# A™×/Ñ/Ó1‘÷} ?ô@ ØØØØØ%ØØØô	
ð 		
øôG ò )Ø$(Ð(�›'ð)ûô( ò <Ø ×6Ñ6°sÓ;“	ð<ûô
 ò #ÜŸ<™<›>�ÜŸ™Ð 4°a·f±fÓ=�à�>Ø�Fà˜Q’;Ø !�Iä! &¬#Ô.Ü—J‘J×$Ñ$¤S¨£[Ô1Ü—J‘J×$Ñ$ TÔ*Ø�Fà"–	ûäò *Ù'ØØ�	Ø�	ÜŸ<™<›>–ûð*ûô —
‘
× Ñ Ô"Ü—
‘
× Ñ Ô"ð
 Ð&¨7Ð+>Ø$Ÿ\™\›^�FØ$Ÿ\™\›^�FÙØ" 1™×+Ñ+¨FÔ3ÙØ" 1™×+Ñ+¨FÔ3à# A™×/Ñ/Ó1�Ø# A™×/Ñ/Ó1�Ø# A™×/Ñ/Ó1‘ú÷} ?Ñ>ús‡   » G* Á/A.OÃG>Ã0HÄ	COÇ*G;Ç:G;Ç>HÈOÈHÈOÈ	K:È(BKËK=ËK:ËK5Ë/K=Ë5K:Ë:K=Ë=COÏOÏOc              #  ó’  K  — t        j                  «       }t        j                  |¬«      }t        j                  |«       	 |–— t        j                  |«       |€ddl}	 |j                  |«       yy# t        $ r Y yw xY w# t        j                  |«       |€&ddl}	 |j                  |«       w # t        $ r Y w w xY ww xY w­w)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   )rS   ÚgetcwdrU   ÚmkdtempÚchdirÚshutilÚrmtreer  )r   Útemp_dirÚcwdÚdtr  s        r   Úisolated_filesystemzCliRunner.isolated_filesystemÁ  s´   è ø€ ô  �i‰i‹kˆÜ×Ñ (Ô+ˆÜ
�‰�Œð	ØŠHä�H‰H�SŒMàÐÛðØ—M‘M "Õ%ð	  øô
 ò Ùðûô �H‰H�SŒMàÐÛðØ—M‘M "Õ%øÜò Ùðúð  üsf   ‚A CÁB ÁCÁ#A6 Á4CÁ6	BÁ?CÂBÂCÂCÂ"B4Â3CÂ4	C Â=CÂ?C Ã CÃC)zutf-8NFTr   )rŒ   r<   r®   ú$cabc.Mapping[str, str | None] | Noner¯   rÞ   r°   rÞ   r±   ÚCaptureModer:   r;   )r´   r   r:   r<   r   )r¹   r  r:   zcabc.Mapping[str, str | None])NNF)r   ú str | bytes | t.IO[t.Any] | Noner®   r  rÕ   rÞ   r:   z8cabc.Iterator[tuple[io.BytesIO, io.BytesIO, io.BytesIO]])NNNNF)r´   r   r   zstr | cabc.Sequence[str] | Noner   r  r®   r  r°   rß   rÕ   rÞ   r
  r=   r:   r�   )r  zstr | os.PathLike[str] | Noner:   zcabc.Iterator[str])rB   rC   rD   r`   r   rµ   rº   Ú
contextlibÚcontextmanagerrü   r  r  rE   r   r   r¨   r¨     sg  „ ñ"ðL Ø48Ø Ø!%Ø$ð,àð,ð 2ð,ð ð	,ð
 ð,ð ð,ð 
ó,ó,"ð AEðØ=ðà	&óð ×Ñð 37Ø48Øð	C,à/ðC,ð 2ðC,ð ð	C,ð
 
BòC,ó ðC,ðP 15Ø26Ø48Ø(,ØðO
àðO
ð .ðO
ð 0ð	O
ð
 2ðO
ð &ðO
ð ðO
ð ðO
ð 
óO
ðb ×Ñà8<ðØ5ðà	òó ñr   r¨   )rG   zEchoingStdin | Noner:   zcabc.Iterator[None])r   r  rŒ   r<   r:   r9   ))Ú
__future__r   Úcollections.abcÚabcÚcabcr   rq   rS   rç   r  r   rU   Útypingr‡   Útypesr   rÃ   r   r   r   r	   r
   ÚTYPE_CHECKINGÚ	_typeshedr   Úcorer   ÚLiteralr  r   r!  rH   rJ   rr   rb   ro   ÚTextIOWrapperrv   r�   r�   r¨   rE   r   r   Ú<module>r-     så   ðÝ "å Û Û 	Û 	Û 
Û Û 
Û Û Ý å Ý Ý Ý Ý (à‡?‚?Ý(åà�i‰i˜Ñ$€÷!ñ !ðD ×Ñòó ð÷ñ ôB �"—*‘*ô  ÷&Cñ Cô0˜"×*Ñ*ô 0ðfØ+ðØ69ðàó÷(K4ñ K4÷\Aò Ar   