§
    0›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j        d         Z G d„ d¦  «        Zej        d&d„¦   «         Z G d„ d¦  «        Z  G d„ dej!        ¦  «        Z" G d„ d¦  «        Z# G d„ dej$        ¦  «        Z%d'd!„Z& G d"„ d#¦  «        Z' G d$„ d%¦  «        Z(dS )(é    )ÚannotationsN)ÚTracebackTypeé   )Ú_compat)Ú
formatting)Útermui)Úutils)Ú_find_binary_reader)ÚReadableBuffer)ÚCommand)ÚsysÚfdc                  ó\   — 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dS )"ÚEchoingStdinÚinputú
t.BinaryIOÚoutputÚreturnÚNonec                ó0   — || _         || _        d| _        d S )NF)Ú_inputÚ_outputÚ_paused)Úselfr   r   s      úJ/home/lighthouse/health/venv/lib/python3.11/site-packages/click/testing.pyÚ__init__zEchoingStdin.__init__   s   € ØˆŒØˆŒØˆŒˆˆó    ÚxÚstrút.Anyc                ó,   — t          | j        |¦  «        S ©N)Úgetattrr   )r   r   s     r   Ú__getattr__zEchoingStdin.__getattr__"   s   € Ý�t”{ AÑ&Ô&Ð&r   ÚrvÚbytesc                óH   — | j         s| j                             |¦  «         |S r"   )r   r   Úwrite)r   r%   s     r   Ú_echozEchoingStdin._echo%   s'   € ØŒ|ð 	#ØŒL×Ò˜rÑ"Ô"Ð"àˆ	r   éÿÿÿÿÚnÚintc                ó\   — |                       | j                             |¦  «        ¦  «        S r"   )r)   r   Úread©r   r+   s     r   r.   zEchoingStdin.read+   s$   € Ø�zŠz˜$œ+×*Ò*¨1Ñ-Ô-Ñ.Ô.Ð.r   c                ó\   — |                       | j                             |¦  «        ¦  «        S r"   )r)   r   Úread1r/   s     r   r1   zEchoingStdin.read1.   s$   € Ø�zŠz˜$œ+×+Ò+¨AÑ.Ô.Ñ/Ô/Ð/r   c                ó\   — |                       | j                             |¦  «        ¦  «        S r"   )r)   r   Úreadliner/   s     r   r3   zEchoingStdin.readline1   s$   € Ø�zŠz˜$œ+×.Ò.¨qÑ1Ô1Ñ2Ô2Ð2r   úlist[bytes]c                óN   ‡ — ˆ fd„‰ j                              ¦   «         D ¦   «         S )Nc                ó:   •— g | ]}‰                      |¦  «        ‘ŒS © ©r)   ©Ú.0r   r   s     €r   ú
<listcomp>z*EchoingStdin.readlines.<locals>.<listcomp>5   s#   ø€ Ð?Ð?Ð? !�—
’
˜1‘”Ð?Ð?Ð?r   )r   Ú	readlines©r   s   `r   r<   zEchoingStdin.readlines4   s+   ø€ Ø?Ð?Ð?Ð? t¤{×'<Ò'<Ñ'>Ô'>Ð?Ñ?Ô?Ð?r   úcabc.Iterator[bytes]c                óD   ‡ — t          ˆ fd„‰ j        D ¦   «         ¦  «        S )Nc              3  óB   •K  — | ]}‰                      |¦  «        V — Œd S r"   r8   r9   s     €r   ú	<genexpr>z(EchoingStdin.__iter__.<locals>.<genexpr>8   s-   øè è € Ð7Ð7 a�D—J’J˜q‘M”MÐ7Ð7Ð7Ð7Ð7Ð7r   )Úiterr   r=   s   `r   Ú__iter__zEchoingStdin.__iter__7   s(   ø€ ÝÐ7Ð7Ð7Ð7¨4¬;Ð7Ñ7Ô7Ñ7Ô7Ð7r   c                ó*   — t          | j        ¦  «        S r"   )Úreprr   r=   s    r   Ú__repr__zEchoingStdin.__repr__:   s   € Ý�D”KÑ Ô Ð r   N)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   )Ú__name__Ú
__module__Ú__qualname__r   r$   r)   r.   r1   r3   r<   rC   rF   r7   r   r   r   r      sÛ   € € € € € ðð ð ð ð
'ð 'ð 'ð 'ðð ð ð ð/ð /ð /ð /ð /ð0ð 0ð 0ð 0ð 0ð3ð 3ð 3ð 3ð 3ð@ð @ð @ð @ð8ð 8ð 8ð 8ð!ð !ð !ð !ð !ð !r   r   ÚstreamúEchoingStdin | Noner   úcabc.Iterator[None]c              #  ó>   K  — | €d V — d S d| _         d V — d| _         d S )NTF)r   )rK   s    r   Ú_pause_echorO   >   s3   è è € à€~ØˆˆˆˆˆàˆŒØˆˆˆØˆŒˆˆr   c                  ó*   — e Zd ZdZdd„Zdd„Zdd	„Zd
S )Ú
_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
    Útargetfdr,   r   r   c                ó0   — || _         d| _        d | _        d S ©Nr*   )Ú	_targetfdÚsaved_fdÚ_tmpfile)r   rR   s     r   r   z_FDCapture.__init__S   s   € Ø!ˆŒØˆŒØ+/ˆŒˆˆr   c                óØ   — t          j        | j        ¦  «        | _        t	          j        d¬¦  «        | _        t          j        | j                             ¦   «         | j        ¦  «         d S )Nr   )Ú	buffering)	ÚosÚduprU   rV   ÚtempfileÚTemporaryFilerW   Údup2Úfilenor=   s    r   Ústartz_FDCapture.startX   sR   € Ýœ˜tœ~Ñ.Ô.ˆŒÝ Ô.¸Ð;Ñ;Ô;ˆŒÝ
Œ�”×$Ò$Ñ&Ô&¨¬Ñ7Ô7Ð7Ð7Ð7r   r&   c                óL  — | j         €
J d¦   «         ‚t          j        | j        | j        ¦  «         t          j        | j        ¦  «         d| _        | j                              d¦  «         | j                              ¦   «         }| j                              ¦   «          d | _         |S )Nz!_FDCapture.start() was not calledr*   r   )rW   rZ   r^   rV   rU   ÚcloseÚseekr.   )r   Údatas     r   Ústopz_FDCapture.stop]   s‘   € ØŒ}Ð(Ð(Ð*MÑ(Ô(Ð(Ý
Œ�”˜tœ~Ñ.Ô.Ð.Ý
Œ�”ÑÔÐØˆŒØŒ×Ò˜1ÑÔÐØŒ}×!Ò!Ñ#Ô#ˆØŒ×ÒÑÔÐØˆŒØˆr   N)rR   r,   r   r   ©r   r   )r   r&   )rH   rI   rJ   Ú__doc__r   r`   re   r7   r   r   rQ   rQ   H   sZ   € € € € € ðð ð0ð 0ð 0ð 0ð
8ð 8ð 8ð 8ð
	ð 	ð 	ð 	ð 	ð 	r   rQ   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
    Úcopy_toú
io.BytesIOr   r   c                óV   •— t          ¦   «                              ¦   «          || _        d S r"   )Úsuperr   rj   )r   rj   Ú	__class__s     €r   r   zBytesIOCopy.__init__o   s$   ø€ Ý‰Œ×ÒÑÔÐØˆŒˆˆr   c                óz   •— t          ¦   «                              ¦   «          | j                             ¦   «          d S r"   )rm   Úflushrj   ©r   rn   s    €r   rp   zBytesIOCopy.flushs   s.   ø€ Ý‰Œ�Š‰ŒˆØŒ×ÒÑÔÐÐÐr   Úbr   r,   c                óz   •— | j                              |¦  «         t          ¦   «                              |¦  «        S r"   )rj   r(   rm   )r   rr   rn   s     €r   r(   zBytesIOCopy.writew   s/   ø€ ØŒ×Ò˜1ÑÔÐÝ‰wŒw�}Š}˜QÑÔÐr   )rj   rk   r   r   rf   )rr   r   r   r,   )rH   rI   rJ   rg   r   rp   r(   Ú__classcell__©rn   s   @r   ri   ri   i   sƒ   ø€ € € € € ðð ð
ð ð ð ð ð ðð ð ð ð ð ð ð  ð  ð  ð  ð  ð  ð  ð  ð  r   ri   c                  ó   — e Zd ZdZdd„ZdS )ÚStreamMixerz‚Mixes `<stdout>` and `<stderr>` streams.

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

    .. versionadded:: 8.2
    r   r   c                óž   — t          j        ¦   «         | _        t          | j        ¬¦  «        | _        t          | j        ¬¦  «        | _        d S )N)rj   )ÚioÚBytesIOr   ri   ÚstdoutÚstderrr=   s    r   r   zStreamMixer.__init__„   s;   € Ý"$¤*¡,¤,ˆŒÝ"-°d´kÐ"BÑ"BÔ"BˆŒÝ"-°d´kÐ"BÑ"BÔ"BˆŒˆˆr   Nrf   )rH   rI   rJ   rg   r   r7   r   r   rw   rw   |   s8   € € € € € ðð ðCð Cð Cð Cð Cð Cr   rw   c                  óh   ‡ — 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.
    Úbufferr   Únamer   ÚmodeÚkwargsr    r   r   c                óf   •—  t          ¦   «         j        |fi |¤Ž || _        || _        d| _        d S rT   )rm   r   Ú_nameÚ_modeÚ_original_fd)r   r   r€   r�   r‚   rn   s        €r   r   z_NamedTextIOWrapper.__init__–   s@   ø€ ð 	�‰ŒÔ˜Ð*Ð* 6Ð*Ð*Ð*ØˆŒ
ØˆŒ
Ø!#ˆÔÐÐr   c                ó   — dS )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
        Nr7   r=   s    r   rb   z_NamedTextIOWrapper.close¢   s   € € € r   r,   c                óh   •— | 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   )r†   rm   r_   rq   s    €r   r_   z_NamedTextIOWrapper.filenoª   s0   ø€ ð Ô Ò!Ð!ØÔ$Ð$Ý‰wŒw�~Š~ÑÔÐr   c                ó   — | j         S r"   )r„   r=   s    r   r€   z_NamedTextIOWrapper.name´   ó
   € àŒzÐr   c                ó   — | j         S r"   )r…   r=   s    r   r�   z_NamedTextIOWrapper.mode¸   rŠ   r   )
r   r   r€   r   r�   r   r‚   r    r   r   rf   )r   r,   rG   )rH   rI   rJ   rg   r   rb   r_   Úpropertyr€   r�   rt   ru   s   @r   r~   r~   Š   s¹   ø€ € € € € ð	ð 	ð
$ð 
$ð 
$ð 
$ð 
$ð 
$ðð ð ð ð ð  ð  ð  ð  ð  ð ðð ð ñ „Xðð ðð ð ñ „Xðð ð ð ð r   r~   r   ú str | bytes | t.IO[t.Any] | NoneÚcharsetr   r   c                ó  — t          | d¦  «        r5t          t          j        d| ¦  «        ¦  «        }|�|S t	          d¦  «        ‚| €d} n*t          | t          ¦  «        r|                      |¦  «        } t          j	        | ¦  «        S )Nr.   zt.IO[t.Any]z.Could not find binary reader for input stream.r   )
Úhasattrr
   ÚtÚcastÚ	TypeErrorÚ
isinstancer   Úencodery   rz   )r   rŽ   r%   s      r   Úmake_input_streamr–   ½   sˆ   € õ ˆu�fÑÔð JÝ ¥¤¨°uÑ!=Ô!=Ñ>Ô>ˆàˆ>ØˆIåÐHÑIÔIÐIà€}ØˆˆÝ	�E�3Ñ	Ô	ð &Ø—’˜WÑ%Ô%ˆåŒ:�eÑÔÐr   c                  ón   — 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	dS )Ú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``.
    NÚrunnerÚ	CliRunnerÚstdout_bytesr&   Ústderr_bytesÚoutput_bytesÚreturn_valuer    Ú	exit_coder,   Ú	exceptionúBaseException | NoneÚexc_infoú?tuple[type[BaseException], BaseException, TracebackType] | Nonec	                óv   — || _         || _        || _        || _        || _        || _        || _        || _        d S r"   ©r™   r›   rœ   r�   rž   rŸ   r    r¢   )	r   r™   r›   rœ   r�   rž   rŸ   r    r¢   s	            r   r   zResult.__init__ç   sD   € ð ˆŒØ(ˆÔØ(ˆÔØ(ˆÔØ(ˆÔØ"ˆŒØ"ˆŒØ ˆŒˆˆr   r   r   c                ót   — | j                              | j        j        d¦  «                             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§   r=   s    r   r   zResult.outputü   s9   € ð Ô ×'Ò'¨¬Ô(;¸YÑGÔG×OÒOØ�Dñ
ô 
ð 	
r   c                ót   — | j                              | j        j        d¦  «                             dd¦  «        S )z&The standard output as unicode string.r§   r¨   r©   )r›   rª   r™   rŽ   r§   r=   s    r   r{   zResult.stdout  s9   € ð Ô ×'Ò'¨¬Ô(;¸YÑGÔG×OÒOØ�Dñ
ô 
ð 	
r   c                ót   — | j                              | j        j        d¦  «                             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§   r=   s    r   r|   zResult.stderr  s9   € ð Ô ×'Ò'¨¬Ô(;¸YÑGÔG×OÒOØ�Dñ
ô 
ð 	
r   c                ór   — | j         rt          | j         ¦  «        nd}dt          | ¦  «        j        › d|› d�S )NÚokayú<ú ú>)r    rE   ÚtyperH   )r   Úexc_strs     r   rF   zResult.__repr__  s?   € Ø*.¬.ÐD•$�t”~Ñ&Ô&Ð&¸fˆØ3•4˜‘:”:Ô&Ð3Ð3¨Ð3Ð3Ð3Ð3r   r"   )r™   rš   r›   r&   rœ   r&   r�   r&   rž   r    rŸ   r,   r    r¡   r¢   r£   rG   )
rH   rI   rJ   rg   r   rŒ   r   r{   r|   rF   r7   r   r   r˜   r˜   Ñ   s°   € € € € € ðð ð> ð!ð !ð !ð !ð !ð* ð	
ð 	
ð 	
ñ „Xð	
ð ð
ð 
ð 
ñ „Xð
ð ð
ð 
ð 
ñ „Xð
ð4ð 4ð 4ð 4ð 4ð 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		 	 	 	 	 d0d1d$„Z
ej        	 d,d2d(„¦   «         ZdS )3rš   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.
    úutf-8NFTr   rŽ   r   Úenvú$cabc.Mapping[str, str | None] | NoneÚ
echo_stdinÚboolÚcatch_exceptionsÚcaptureÚCaptureModer   r   c                óÐ   — |dvrt          d|›d�¦  «        ‚|dk    r#t          j        dk    rt          d|›d�¦  «        ‚|| _        |pi | _        || _        || _        || _        d S )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Ž   r¶   r¸   rº   r»   )r   rŽ   r¶   r¸   rº   r»   s         r   r   zCliRunner.__init__D  s”   € ð ˜-Ð'Ð'ÝØO˜7ÐOÐOÐOñô ð ð �dŠ?ˆ?�sœ|¨wÒ6Ð6ÝØN˜7ÐNÐNÐNñô ð ð ˆŒØ25°)¸ˆŒØ$ˆŒØ 0ˆÔØ$+ˆŒˆˆr   Úclir   c                ó   — |j         p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   rÁ   s     r   Úget_default_prog_namezCliRunner.get_default_prog_nameZ  s   € ð
 ŒxÐ!˜6Ð!r   Ú	overridesúcabc.Mapping[str, str | None]c                ó\   — t          | j        ¦  «        }|r|                     |¦  «         |S )z8Returns the environment overrides for invoking a script.)Údictr¶   Úupdate)r   rÅ   r%   s      r   Úmake_envzCliRunner.make_enva  s0   € õ �$”(‰^Œ^ˆØð 	!Ø�IŠI�iÑ Ô Ð Øˆ	r   r   r�   Úcolorú8cabc.Iterator[tuple[io.BytesIO, io.BytesIO, io.BytesIO]]c              #  ó¢  ‡‡‡K  — t          || j        ¦  «        }d}t          j        }t          j        }t          j        }t          j        }	dt          _        |                      |¦  «        }t          ¦   «         }
| j
        r4t          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          j        j        Š|t$          _        |t$          _        |t$          _        |t,          _        |t0          _        	 	 	 d*d+ˆfd$„}|t2          j        _        i }	 |                     ¦   «         D ]W\  }}t:          j                             |¦  «        ||<   |€	 t:          j        |= Œ8# t@          $ r Y ŒDw xY w|t:          j        |<   ŒX|
j        |
j        |
j!        fV — |                     ¦   «         D ]5\  }}|€	 t:          j        |= Œ# t@          $ r Y Œ"w xY w|t:          j        |<   Œ6|t          _        |t          _        |t          _        |t$          _        |t$          _        |t$          _        |t,          _        |t0          _        |	t          _        ‰t2          j        _        dS # |                     ¦   «         D ]5\  }}|€	 t:          j        |= Œ# t@          $ r Y Œ"w xY w|t:          j        |<   Œ6|t          _        |t          _        |t          _        |t$          _        |t$          _        |t$          _        |t,          _        |t0          _        |	t          _        ‰t2          j        _        w xY 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�   ÚerrorsÚpromptú
str | Noner   r   c                óT  •— t           j                             | pd¦  «         	 t          ‰¦  «                             d¦  «        }n!# t
          $ r}t          ¦   «         |‚d }~ww xY wt           j                             |› d�¦  «         t           j                             ¦   «          |S )NÚ r¨   r©   )r   r{   r(   ÚnextÚrstripÚStopIterationÚEOFErrorrp   )rÔ   ÚvalÚeÚ
text_inputs      €r   Úvisible_inputz*CliRunner.isolation.<locals>.visible_input¶  sŸ   ø€ åŒJ×Ò˜V˜\ rÑ*Ô*Ð*ð(Ý˜:Ñ&Ô&×-Ò-¨fÑ5Ô5��øÝ ð (ð (ð (Ý‘j”j aÐ'øøøøð(øøøåŒJ×Ò ˜Z˜Z˜ZÑ(Ô(Ð(ÝŒJ×ÒÑÔÐØˆJs   ¤"A Á
A%ÁA Á A%c                ó  •— t           j                             | pd› d�¦  «         t           j                             ¦   «          	 t	          ‰¦  «                             d¦  «        S # t          $ r}t          ¦   «         |‚d }~ww xY w)Nr×   r©   r¨   )r   r{   r(   rp   rØ   rÙ   rÚ   rÛ   )rÔ   rÝ   rÞ   s     €r   Úhidden_inputz)CliRunner.isolation.<locals>.hidden_inputÁ  s†   ø€ åŒJ×Ò  ¨"Ð0Ð0Ð0Ñ1Ô1Ð1ÝŒJ×ÒÑÔÐð(Ý˜JÑ'Ô'×.Ò.¨vÑ6Ô6Ð6øÝ ð (ð (ð (Ý‘j”j aÐ'øøøøð(øøøs   Á!A' Á'
BÁ1B Â BÚechor¹   c                óÂ   — t           j                             d¦  «        }| rt           j                             |¦  «         t           j                             ¦   «          |S )Nr   )r   Ústdinr.   r{   r(   rp   )râ   Úchars     r   Ú_getcharz%CliRunner.isolation.<locals>._getcharÊ  sL   € å”9—>’> !Ñ$Ô$ˆDàð 'Ý”
× Ò  Ñ&Ô&Ð&åŒJ×ÒÑÔÐØˆKr   rK   út.IO[t.Any] | NonerË   úbool | Nonec                ó   •— |€‰ S | S r"   r7   )rK   rË   Údefault_colors     €r   Úshould_strip_ansiz.CliRunner.isolation.<locals>.should_strip_ansiÖ  s   ø€ ð ˆ}Ø(Ð(Ð(Ø�9Ðr   Útabr   úpdb.PdbÚcompletekeyrä   út.IO[str] | Noner{   r‚   r    r   c                óZ   •— |€t           j        }|€t           j        } ‰| f|||dœ|¤Ž dS )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)rî   rä   r{   )r   Ú	__stdin__Ú
__stdout__)r   rî   rä   r{   r‚   Úold_pdb_inits        €r   Ú_patched_pdb_initz.CliRunner.isolation.<locals>._patched_pdb_inité  sW   ø€ ð: ˆ}Ýœ�Øˆ~Ýœ�ØˆLØðØ"-°UÀ6ðð ØMSðð ð ð ð r   r"   )rÔ   rÕ   r   r   )râ   r¹   r   r   )NN)rK   rç   rË   rè   r   r¹   )rì   NN)r   rí   rî   r   rä   rï   r{   rï   r‚   r    r   r   )"r–   rŽ   r   rä   r{   r|   r   ÚFORCED_WIDTHrÊ   rw   r¸   r‘   r’   ÚBinaryIOr   r~   Ú_CHUNK_SIZErO   r   Úvisible_prompt_funcÚhidden_prompt_funcræ   r	   rë   r   ÚpdbÚPdbr   ÚitemsrZ   Ú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ˆ	Ý”Zˆ
Ý”Zˆ
Ý%Ô2ÐØ"$�
Ôà�mŠm˜CÑ Ô ˆå"‘}”}ˆàŒ?ð 	Ý'(¤vÝ”
�L¨°lÔ6IÑJÔJñ(ô (ð ˆK˜*õ "5Ø $¤,°YÀSð"
ñ "
ô "
ð 	
�Œ	�Jð Œ?ð 	'ð &'ˆJÔ"å(ØÔØ”\ØØð	
ñ 
ô 
�Œ
õ )ØÔØ”\ØØØ%ð
ñ 
ô 
�Œ
õ 
�ZÑ	 Ô	 ð	ð 	ð 	ð 	ð 	ð 	ñ 
!Ô	 ð	õ 
�ZÑ	 Ô	 ð	(ð 	(ð 	(ð 	(ð 	(ð 	(ñ 
!Ô	 ð	(õ 
�ZÑ	 Ô	 ð	ð 	ð 	ñ 
!Ô	 ð	ð ˆð EIð	ð 	ð 	ð 	ð 	ð 	ð 	õ #)Ô"<ÐÝ!'Ô!:ÐÝ"œOÐÝ %Ô 7ÐÝ(/Ô(AÐ%Ý”wÔ'ˆØ%2�Ô"Ø$0�Ô!Ø"�ŒØ"3�ÔØ$5�Ô!ð  %Ø&*Ø'+ð	#	ð #	ð #	ð #	ð #	ð #	ð #	ðJ -�ŒÔàˆð	,Ø!Ÿiši™kœkð ,ð ,‘
��UÝ!œzŸ~š~¨cÑ2Ô2�˜‘Ø�=ðÝœJ s˜O˜OøÝ$ð ð ð Ø˜ðøøøð ',•B”J˜s‘O�OØÔ&¨Ô(;¸\Ô=PÐQÐQÐQÐQà%Ÿmšm™oœoð ,ð ,‘
��UØ�=ðÝœJ s˜O˜OøÝ$ð ð ð Ø˜ðøøøð ',•B”J˜s‘O�OØ#�CŒJØ#�CŒJØ!�CŒIØ)@�FÔ&Ø(>�FÔ%Ø/�FŒOØ&;�EÔ#Ø(E�GÔ%Ø&6�JÔ#Ø+�CŒGÔÐÐøð# &Ÿmšm™oœoð ,ð ,‘
��UØ�=ðÝœJ s˜O˜OøÝ$ð ð ð Ø˜ðøøøð ',•B”J˜s‘O�OØ#�CŒJØ#�CŒJØ!�CŒIØ)@�FÔ&Ø(>�FÔ%Ø/�FŒOØ&;�EÔ#Ø(E�GÔ%Ø&6�JÔ#Ø+�CŒGÔÐ+Ð+Ð+Ð+sg   È:=N É8JÊN Ê
JÊN ÊJÊ)N ËK&Ë&
K3Ë2K3ÎQÎ"N0Î/QÎ0
N=	Î:QÎ<N=	Î=BQÚargsústr | cabc.Sequence[str] | Nonerè   Úextrar    r˜   c           
     óh  — d}|€| j         }d}	d}
| j        dk    r\t          d¦  «        }	t          d¦  «        }
	 |	                     ¦   «          |
                     ¦   «          n# t          $ r dx}	}
Y nw xY w|                      |||¬¦  «        5 }|	�.|
�,|	j        t          j        _	        |
j        t          j
        _	        d}d}d}t          |t          ¦  «        rt          j        |¦  «        }	 |                     d¦  «        }n%# t           $ r |                      |¦  «        }Y nw xY w	  |j        d|pd|d	œ|¤Ž}nà# t&          $ r§}t          j        ¦   «         }t+          j        d
|j        ¦  «        }|€d}|dk    r|}t          |t0          ¦  «        sMt          j                             t          |¦  «        ¦  «         t          j                             d¦  «         d}|}Y d}~n4d}~wt4          $ r$}|s‚ |}d}t          j        ¦   «         }Y d}~nd}~ww xY wt          j                             ¦   «          t          j
                             ¦   «          |	�d|
�b|	                     ¦   «         }|
                     ¦   «         }|r|d                              |¦  «         |r|d                              |¦  «         |d                              ¦   «         }|d                              ¦   «         }|d                              ¦   «         }nõ# t          j                             ¦   «          t          j
                             ¦   «          |	�d|
�b|	                     ¦   «         }|
                     ¦   «         }|r|d                              |¦  «         |r|d                              |¦  «         |d                              ¦   «         }|d                              ¦   «         }|d                              ¦   «         }w xY w	 ddd¦  «         n# 1 swxY w Y   t=          | |||||||¬¦  «        S )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_namer7   )r  r  zint | t.Any | Noner©   r¥   )rº   r»   rQ   r`   ÚOSErrorr  rV   r   r{   r†   r|   r”   r   ÚshlexÚsplitÚpopÚKeyErrorrÄ   ÚmainÚ
SystemExitr¢   r‘   r’   Úcoder,   r(   rÿ   rp   re   Úgetvaluer˜   )r   rÁ   r  r   r¶   rº   rË   r  r¢   Úcap_outÚcap_errÚ
outstreamsrž   r    rŸ   r  rÝ   Úe_codeÚfd_outÚfd_errr{   r|   r   s                          r   ÚinvokezCliRunner.invoke0  s›  € ðj ˆØÐ#Ø#Ô4Ðð &*ˆØ%)ˆàŒ<˜4ÒÐÝ  ‘m”mˆGÝ  ‘m”mˆGð)Ø—’‘”�Ø—’‘”��øÝð )ð )ð )Ø$(Ð(�˜'˜'˜'ð)øøøð �^Š^ %¨S¸ˆ^Ñ>Ô>ð >	2À*ð Ð" wÐ':Ø*1Ô*:•”
Ô'Ø*1Ô*:•”
Ô'àˆLØ.2ˆIØˆIå˜$¥Ñ$Ô$ð )Ý”{ 4Ñ(Ô(�ð<Ø!ŸIšI kÑ2Ô2�	�	øÝð <ð <ð <Ø ×6Ò6°sÑ;Ô;�	�	�	ð<øøøð*2Ø'˜sœxÐV¨T¨Z°RÀ9ÐVÐVÐPUÐVÐV��øÝð #ð #ð #Ýœ<™>œ>�ÝœÐ 4°a´fÑ=Ô=�à�>Ø�Fà˜Q’;�;Ø !�Iå! &­#Ñ.Ô.ð Ý”J×$Ò$¥S¨¡[¤[Ñ1Ô1Ð1Ý”J×$Ò$ TÑ*Ô*Ð*Ø�Fà"�	�	�	�	�	�	øøøøåð *ð *ð *Ø'ð ØØ�	Ø�	Ýœ<™>œ>������øøøøð*øøøõ ”
× Ò Ñ"Ô"Ð"Ý”
× Ò Ñ"Ô"Ð"ð
 Ð&¨7Ð+>Ø$Ÿ\š\™^œ^�FØ$Ÿ\š\™^œ^�FØð 4Ø" 1œ×+Ò+¨FÑ3Ô3Ð3Øð 4Ø" 1œ×+Ò+¨FÑ3Ô3Ð3à# Aœ×/Ò/Ñ1Ô1�Ø# Aœ×/Ò/Ñ1Ô1�Ø# Aœ×/Ò/Ñ1Ô1��øõ! ”
× Ò Ñ"Ô"Ð"Ý”
× Ò Ñ"Ô"Ð"ð
 Ð&¨7Ð+>Ø$Ÿ\š\™^œ^�FØ$Ÿ\š\™^œ^�FØð 4Ø" 1œ×+Ò+¨FÑ3Ô3Ð3Øð 4Ø" 1œ×+Ò+¨FÑ3Ô3Ð3à# Aœ×/Ò/Ñ1Ô1�Ø# Aœ×/Ò/Ñ1Ô1�Ø# Aœ×/Ò/Ñ1Ô1�Ð1Ð1Ð1Ð1�ð}>	2ð >	2ð >	2ñ >	2ô >	2ð >	2ð >	2ð >	2ð >	2ð >	2ð >	2øøøð >	2ð >	2ð >	2ð >	2õ@ ØØØØØ%ØØØð	
ñ 	
ô 	
ð 		
s™   º(A# Á#A4Á3A4ÂA PÃ0DÄPÄD(Ä%PÄ'D(Ä(PÄ,D?Ä>LÄ?
HÅ	BG+Ç&LÇ+HÇ8HÈLÈHÈLÈC1PÌC2PÐPÐPÐPÚtemp_dirústr | os.PathLike[str] | Noneúcabc.Iterator[str]c              #  óž  K  — t          j        ¦   «         }t          j        |¬¦  «        }t          j        |¦  «         	 |V — t          j        |¦  «         |€-ddl}	 |                     |¦  «         dS # t          $ r Y dS w xY wdS # t          j        |¦  «         |€+ddl}	 |                     |¦  «         w # t          $ r Y w w xY ww xY 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   )rZ   Úgetcwdr\   ÚmkdtempÚchdirÚshutilÚrmtreer  )r   r&  ÚcwdÚdtr.  s        r   Úisolated_filesystemzCliRunner.isolated_filesystemÁ  s  è è € õ  Œi‰kŒkˆÝÔ (Ð+Ñ+Ô+ˆÝ
Œ�‰Œˆð	ØˆHˆHˆHåŒH�S‰MŒMˆMàÐØ���ðØ—M’M "Ñ%Ô%Ð%Ð%Ð%øÝð ð ð Ø�D�Dðøøøð  Ðøõ ŒH�S‰MŒMˆMàÐØ���ðØ—M’M "Ñ%Ô%Ð%Ð%øÝð ð ð Ø�Dðøøøð  øøøsB   Á B	 ÁA6 Á6
BÂBÂ	CÂ%B;Â:CÂ;
CÃCÃCÃC)rµ   NFTr   )rŽ   r   r¶   r·   r¸   r¹   rº   r¹   r»   r¼   r   r   )rÁ   r   r   r   r"   )rÅ   r·   r   rÆ   )NNF)r   r�   r¶   r·   rË   r¹   r   rÌ   )NNNNF)rÁ   r   r  r  r   r�   r¶   r·   rº   rè   rË   r¹   r  r    r   r˜   )r&  r'  r   r(  )rH   rI   rJ   rg   r   rÄ   rÊ   Ú
contextlibÚcontextmanagerr  r%  r2  r7   r   r   rš   rš     s  € € € € € ð"ð "ðL Ø48Ø Ø!%Ø$ð,ð ,ð ,ð ,ð ,ð,"ð "ð "ð "ð AEðð ð ð ð ð Ôð 37Ø48Øð	C,ð C,ð C,ð C,ñ ÔðC,ðP 15Ø26Ø48Ø(,ØðO
ð O
ð O
ð O
ð O
ðb Ôà8<ðð ð ð ñ Ôðð ð r   rš   )rK   rL   r   rM   )r   r�   rŽ   r   r   r   ))Ú
__future__r   Úcollections.abcÚabcÚcabcr3  ry   rZ   rú   r  r   r\   Útypingr‘   Útypesr   r×   r   r   r   r	   r
   ÚTYPE_CHECKINGÚ	_typeshedr   Úcorer   ÚLiteralr¼   r   r4  rO   rQ   rz   ri   rw   ÚTextIOWrapperr~   r–   r˜   rš   r7   r   r   ú<module>r@     sž  ðØ "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø 
€
€
€
Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (à„?ð Ø(Ð(Ð(Ð(Ð(Ð(àÐÐÐÐÐàŒi˜Ô$€ð!ð !ð !ð !ð !ñ !ô !ð !ðD Ôðð ð ñ Ôððð ð ð ð ñ ô ð ðB ð  ð  ð  ð  �"”*ñ  ô  ð  ð&Cð Cð Cð Cð Cñ Cô Cð Cð0ð 0ð 0ð 0ð 0˜"Ô*ñ 0ô 0ð 0ðfð ð ð ð(K4ð K4ð K4ð K4ð K4ñ K4ô K4ð K4ð\Að Að Að Að Añ Aô Að Að Að Ar   