+
    wi?                     Z   ^ 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	 R
4      t] P*                  R R l4       t ! R R]P.                  4      tR R lt ! R R4      t ! R R4      tR# )    N)TracebackType)_compat)
formatting)termui)utils)_find_binary_reader)BaseCommandc                      a  ] tR t^t o V 3R lR ltV 3R lR ltV 3R lR ltRV 3R lR lltRV 3R	 lR
 lltRV 3R lR llt	V 3R lR lt
V 3R lR ltV 3R lR ltRtV tR# )EchoingStdinc                R   < V ^8  d   QhRS[ P                  RS[ P                  RR/# )   inputoutputreturnN)tBinaryIO)format__classdict__s   "\/Users/ahmad/.openclaw/workspace/scripts/.venv/lib/python3.14/site-packages/click/testing.py__annotate__EchoingStdin.__annotate__   s*      ajj !**      c                ,    Wn         W n        R V n        R# )FN_input_output_paused)selfr   r   s   &&&r   __init__EchoingStdin.__init__   s    r   c                :   < V ^8  d   QhRS[ RS[P                  /# )r   xr   )strr   Any)r   r   s   "r   r   r      s     ' 'S 'QUU '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S[ RS[ /# )r   rvr   )bytes)r   r   s   "r   r   r      s       % r   c                `    V P                   '       g   V P                  P                  V4       V# r&   )r   r   write)r   r,   s   &&r   _echoEchoingStdin._echo   s"    |||LLr"	r   c                &   < V ^8  d   QhRS[ RS[/# r   nr   intr-   )r   r   s   "r   r   r   $   s     / /c /5 /r   c                V    V P                  V P                  P                  V4      4      # r&   )r0   r   readr   r4   s   &&r   r8   EchoingStdin.read$   s     zz$++**1-..r   c                &   < V ^8  d   QhRS[ RS[/# r3   r5   )r   r   s   "r   r   r   '   s     0 0s 0E 0r   c                V    V P                  V P                  P                  V4      4      # r&   )r0   r   read1r9   s   &&r   r=   EchoingStdin.read1'   s     zz$++++A.//r   c                &   < V ^8  d   QhRS[ RS[/# r3   r5   )r   r   s   "r   r   r   *   s     3 3# 3u 3r   c                V    V P                  V P                  P                  V4      4      # r&   )r0   r   readliner9   s   &&r   rA   EchoingStdin.readline*   s     zz$++..q122r   c                D   < V ^8  d   QhRS[ P                  S[,          /# r   r   )r   Listr-   )r   r   s   "r   r   r   -   s     @ @166%= @r   c                |    V P                   P                  4        Uu. uF  qP                  V4      NK  	  up# u upi r&   )r   	readlinesr0   r(   s   & r   rG   EchoingStdin.readlines-   s/    '+{{'<'<'>?'>!

1'>???s   9c                D   < V ^8  d   QhRS[ P                  S[,          /# rD   )r   Iteratorr-   )r   r   s   "r   r   r   0   s     8 8!**U+ 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&   )r0   ).0r"   r   s   & r   	<genexpr>(EchoingStdin.__iter__.<locals>.<genexpr>1   s     7;aDJJqMM;s   !)iterr   r   s   fr   __iter__EchoingStdin.__iter__0   s    74;;777r   c                    < V ^8  d   QhRS[ /# rD   r#   )r   r   s   "r   r   r   3   s     ! !# !r   c                ,    \        V P                  4      # r&   )reprr   rQ   s   &r   __repr__EchoingStdin.__repr__3   s    DKK  r   r   N))__name__
__module____qualname____firstlineno__r   r)   r0   r8   r=   rA   rG   rR   rX   __static_attributes____classdictcell__r   s   @r   r   r      sa      
' ' / /0 03 3@ @8 8! !r   r   c                |    V ^8  d   QhR\         P                  \        ,          R\         P                  R,          /# )r   streamr   N)r   Optionalr   rJ   )r   s   "r   r   r   8   s,      

<0 QZZ5E r   c              #   F   "   V f   R x  R # RV n         R x  RV n         R # 5i)NTF)r   )rc   s   &r   _pause_echorf   7   s     ~s   !c                   v   a a ] tR t^At oV3R lV 3R llt]V3R lR l4       t]V3R lR l4       tRtVt	V ;t
# )_NamedTextIOWrapperc          
      ^   < V ^8  d   QhRS[ P                  RS[RS[RS[ P                  RR/# )r   buffernamemodekwargsr   N)r   r   r#   r$   )r   r   s   "r   r    _NamedTextIOWrapper.__annotate__B   s=      jj(+36BC%%	r   c                B   < \         SV `  ! V3/ VB  W n        W0n        R # r&   )superr   _name_mode)r   rj   rk   rl   rm   	__class__s   &&&&,r   r   _NamedTextIOWrapper.__init__B   s!     	*6*

r   c                    < V ^8  d   QhRS[ /# rD   rU   )r   r   s   "r   r   rn   J         c r   c                    V P                   # r&   )rq   rQ   s   &r   rk   _NamedTextIOWrapper.nameI       zzr   c                    < V ^8  d   QhRS[ /# rD   rU   )r   r   s   "r   r   rn   N   rv   r   c                    V P                   # r&   )rr   rQ   s   &r   rl   _NamedTextIOWrapper.modeM   ry   r   )rr   rq   )r[   r\   r]   r^   r   propertyrk   rl   r_   r`   __classcell__)rs   r   s   @@r   rh   rh   A   s<           r   rh   c                    V ^8  d   QhR\         P                  \         P                  \        \        \         P
                  \         P                  ,          3,          ,          R\        R\         P                  /# )r   r   charsetr   )r   rd   Unionr#   r-   IOr$   r   )r   s   "r   r   r   R   sM      ::aggc5!$$quu+567BEZZr   c                 V   \        V R 4      '       dU   \        \        P                  ! \        P                  \        P
                  ,          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      # )r8   z.Could not find binary reader for input stream.r   )hasattrr   r   castr   r$   	TypeError
isinstancer#   encodeioBytesIO)r   r   r,   s   && r   make_input_streamr   R   s|     uf QUUU!;<>IHII}	E3		W%::er   c                      a  ] tR t^ft o RtRV 3R lR llt]V 3R lR l4       t]V 3R lR l4       t]V 3R	 lR
 l4       t	V 3R lR lt
RtV tR# )Resultz3Holds the captured result of an invoked CLI script.Nc                  < V ^8  d   QhRRRS[ RS[P                  S[ ,          RS[P                  RS[RS[P                  S[,          RS[P                  S[P                  S[P                  S[,          S[S[3,          ,          /# )	r   runner	CliRunnerstdout_bytesstderr_bytesreturn_value	exit_code	exceptionexc_info)	r-   r   rd   r$   r6   BaseExceptionTupleTyper   )r   r   s   "r   r   Result.__annotate__i   s     ! !! ! jj'	!
 ee! ! ::m,! **GGAFF=)=-GH
!r   c                Z    Wn         W n        W0n        W@n        WPn        W`n        Wpn        R # r&   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   s   &&&&&&&&r   r   Result.__init__i   s,     (( )"" r   c                    < V ^8  d   QhRS[ /# rD   rU   )r   r   s   "r   r   r      s       r   c                    V P                   # )z(The (standard) output as unicode string.)stdoutrQ   s   &r   r   Result.output   s     {{r   c                    < V ^8  d   QhRS[ /# rD   rU   )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.replace

)r   decoder   r   r   rQ   s   &r   r   Result.stdout   s9       ''(;(;YGOOD
 	
r   c                    < V ^8  d   QhRS[ /# rD   rU   )r   r   s   "r   r   r      s     
 
 
r   c                    V P                   f   \        R4      hV P                   P                  V P                  P                  R4      P                  RR4      # )z%The standard error as unicode string.zstderr not separately capturedr   r   r   )r   
ValueErrorr   r   r   r   rQ   s   &r   stderrResult.stderr   sQ     $=>>  ''(;(;YGOOD
 	
r   c                    < V ^8  d   QhRS[ /# rD   rU   )r   r   s   "r   r   r      s     4 4# 4r   c                    V P                   '       d   \        V P                   4      MR pR\        V 4      P                   RV R2# )okay< >)r   rW   typer[   )r   exc_strs   & r   rX   Result.__repr__   s:    *....$t~~&f4:&&'q	33r   )r   r   r   r   r   r   r   r&   )r[   r\   r]   r^   __doc__r   r}   r   r   r   rX   r_   r`   ra   s   @r   r   r   f   sX     =! !:   
 
 
 
4 4r   r   c                      a  ] tR t^t o RtRV 3R lR lltV 3R lR ltRV 3R lR llt]P                  RV 3R	 lR
 ll4       t
RV 3R lR llt]P                  RV 3R lR ll4       tRtV tR# )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 mix_stderr: if this is set to `False`, then stdout and stderr are
                   preserved as independent streams.  This is useful for
                   Unix-philosophy apps that have predictable stdout and
                   noisy stderr, such that each may be measured
                   independently
Nc          
         < V ^8  d   QhRS[ RS[P                  S[P                  S[ S[P                  S[ ,          3,          ,          RS[RS[RR/# )r   r   env
echo_stdin
mix_stderrr   N)r#   r   rd   Mappingbool)r   r   s   "r   r   CliRunner.__annotate__   s\     
% 
%
% ZZ		#qzz#"678
% 	
%
 
% 

%r   c                L    Wn         T;'       g    / V n        W0n        W@n        R # r&   )r   r   r   r   )r   r   r   r   r   s   &&&&&r   r   CliRunner.__init__   s      47II2$$r   c                $   < V ^8  d   QhRRRS[ /# )r   clir	   r   rU   )r   r   s   "r   r   r      s     " " "3 "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)rk   )r   r   s   &&r   get_default_prog_nameCliRunner.get_default_prog_name   s    
 xx!!6!r   c                   < V ^8  d   QhRS[ P                  S[ P                  S[S[ P                  S[,          3,          ,          RS[ P                  S[S[ P                  S[,          3,          /# )r   	overridesr   )r   rd   r   r#   )r   r   s   "r   r   r      sR      AIIc1::c?.B$CD	
3

3'	(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   r,   s   && r   make_envCliRunner.make_env   s%     $((^IIi 	r   c                  < V ^8  d   QhRS[ P                  S[ P                  S[S[S[ P
                  S[ P                  ,          3,          ,          RS[ P                  S[ P                  S[S[ P                  S[,          3,          ,          RS[RS[ P                  S[ P                  S[P                  S[ P                  S[P                  ,          3,          ,          /# )r   r   r   colorr   )r   rd   r   r#   r-   r   r$   r   r   rJ   r   r   r   )r   r   s   "r   r   r      s     O7 O7zz!''#uadd155k"9:;O7 ZZ		#qzz#"678O7 	O7
 
AGGBJJ

2::(>>?	@O7r   c              #    aa"   \        WP                  4      pRp\        P                  p\        P                  p\        P
                  p\        P                  p	^P\        n        V P                  V4      p\        P                  ! 4       p
V P                  '       d0   \        P                  ! \        P                  \        WJ4      4      ;rE\!        W@P                  RRR7      ;\        n        oV P                  '       d   ^Sn        \!        WP                  RRR7      \        n        RpV P$                  '       d   \        P                  \        n        M8\        P                  ! 4       p\!        V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\0        P2                  p\4        P2                  pV\(        n        V\(        n        V\(        n        V\0        n        V\4        n        / p VP7                  4        FS  w  pp\8        P:                  P=                  V4      VV&   Vf    \8        P:                  V K@  V\8        P:                  V&   KU  	  W3x  VP7                  4        F1  w  ppVf    \8        P:                  V K  V\8        P:                  V&   K3  	  V\        n        V\        n        V\        n        V\(        n        V\(        n        V\(        n        V\0        n        V\4        n        V	\        n        R#   \>         d     EK  i ; i  \>         d     K  i ; i  TP7                  4        FC  w  ppTf'    \8        P:                  T K    \>         d     K,  i ; iT\8        P:                  T&   KE  	  T\        n        T\        n        T\        n        T\(        n        T\(        n        T\(        n        T\0        n        T\4        n        T	\        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.

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

.. versionchanged:: 4.0
    Added the ``color`` parameter.
Nz<stdin>r)encodingrk   rl   z<stdout>wz<stderr>backslashreplace)r   rk   rl   errorsc                Z    V ^8  d   QhR\         P                  \        ,          R\        /# r   promptr   r   rd   r#   )r   s   "r   r   )CliRunner.isolation.<locals>.__annotate__  s"     	 	!**S/ 	S 	r   c                   < \         P                  P                  T ;'       g    R 4       SP                  4       P	                  R4      p\         P                  P                  V R24       \         P                  P                  4        V# ) r   r   )sysr   r/   rA   rstripflush)r   val
text_inputs   & r   visible_input*CliRunner.isolation.<locals>.visible_input  sa    JJV\\r*%%'..v6CJJuBZ(JJJr   c                Z    V ^8  d   QhR\         P                  \        ,          R\        /# r   r   )r   s   "r   r   r     s"     	8 	8C 	8C 	8r   c                    < \         P                  P                  T ;'       g    R  R24       \         P                  P                  4        SP	                  4       P                  R4      # )r   r   r   )r   r   r/   r   rA   r   )r   r   s   &r   hidden_input)CliRunner.isolation.<locals>.hidden_input  sL    JJ"~R01JJ&&(//77r   c                0    V ^8  d   QhR\         R\        /# )r   echor   )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# )   )r   stdinr8   r   r/   r   )r   chars   & r   _getchar%CliRunner.isolation.<locals>._getchar$  s>    99>>!$D

  &JJKr   c                    V ^8  d   QhR\         P                  \         P                  \         P                  ,          ,          R\         P                  \        ,          R\        /# )r   rc   r   r   )r   rd   r   r$   r   )r   s   "r   r   r   0  sB     	 	JJqttAEE{+	;<::d;K		r   c                 (   < Vf   S'       * # V'       * # r&    )rc   r   default_colors   &&r   should_strip_ansi.CliRunner.isolation.<locals>.should_strip_ansi0  s     }(((9r   r&   )NN) r   r   r   r   r   r   r   FORCED_WIDTHr   r   r   r   r   r   r   r   rh   _CHUNK_SIZEr   rf   r   visible_prompt_funchidden_prompt_funcr   r   r   r   itemsosenvironget	Exception)r   r   r   r   bytes_input
echo_input	old_stdin
old_stdout
old_stderrold_forced_widthbytes_outputbytes_errorr   r   r   r   old_visible_prompt_funcold_hidden_prompt_funcold__getchar_funcold_should_strip_ansiold__compat_should_strip_ansiold_envkeyvaluer   r   s   &&&&                    @@r   	isolationCliRunner.isolation   s    6 (||<
II	ZZ
ZZ
%22"$
mmC zz|???'(vv

LC( K "5,,YS"
 	
	J ??? &'J"(<<js

 ???CJ**,K,)CJ 
Z	 	 	 
!	 
Z	 	8 	8 
!	8
 
Z	 	 
!	 	 	 #)"<"<!'!:!:"OO % 7 7(/(A(A%%2"$0!""3$5!	7!iik
U!zz~~c2=JJsO ',BJJsO *  --%mmo
U=JJsO ',BJJsO . $CJ#CJ!CI)@F&(>F%/FO&;E#(EG%&6J#- %  % 	 &mmo
U=JJsO$  ',BJJsO . $CJ#CJ!CI)@F&(>F%/FO&;E#(EG%&6J#s   I)Q(.<N) +N<N) Q(5NA>Q(NN) NN) N&"Q(%N&&Q()Q%OQ%O'	#Q%&O'	'A>Q%%Q(c                  < V ^8  d   QhRRRS[ P                  S[ P                  S[S[ P                  S[,          3,          ,          RS[ P                  S[ P                  S[S[S[ P                  S[ P                  ,          3,          ,          RS[ P                  S[ P                  S[S[ P                  S[,          3,          ,          RS[	RS[	RS[ P                  R	S[
/# )
r   r   r	   argsr   r   catch_exceptionsr   extrar   )r   rd   r   r#   Sequencer-   r   r$   r   r   r   )r   r   s   "r   r   r   a  s     c
 c
c
 jjajjo!567c
 zz!''#uadd155k"9:;	c

 ZZ		#qzz#"678c
 c
 c
 c
 
c
r   c           
        RpV P                  W4VR7      ;_uu_ 4       p	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&                  P-                  4        V	^ ,          P/                  4       pV P0                  '       d   RpMV	^,          P/                  4       p RRR4       \3        V XXX
XXVR7      #   \         d    T P                  T4      p Li ; i  \         d   p\        P                  ! 4       p\        P                  ! \        P                  \        P                  \         \        P"                  3,          ,          TP$                  4      pTf   ^ pT^ 8w  d   Tp\        T\         4      '       gJ   \        P&                  P)                  \        T4      4       \        P&                  P)                  R4       ^pTp Rp?ELRp?i\*         d.   pT'       g   h Tp^p\        P                  ! 4       p Rp?ELRp?ii ; i  \        P&                  P-                  4        T	^ ,          P/                  4       pT P0                  '       d   Rpi T	^,          P/                  4       pi ; i  + '       g   i     EL; i)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``.
:param extra: the keyword arguments to pass to :meth:`main`.
:param color: whether the output should contain color codes. The
              application can still override this explicitly.

.. versionchanged:: 8.0
    The result object has the ``return_value`` attribute with
    the value returned from the invoked command.

.. versionchanged:: 4.0
    Added the ``color`` parameter.

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

.. versionchanged:: 3.0
    The result object has the ``exc_info`` attribute with the
    traceback if available.
N)r   r   r   	prog_namer  r   r   r   )r  r   r#   shlexsplitpopKeyErrorr   main
SystemExitr   r   r   r   rd   r   r6   r$   coder   r/   r   r   getvaluer   r   )r   r   r  r   r   r  r   r  r   
outstreamsr   r   r   r  ee_coder   r   s   &&&&&&&,          r   invokeCliRunner.invokea  s)   X ^^%^>>*L37II$$${{4(<!IIk2	6"xxVTZZRV9VPUV2 

  "#A//1???!F']335FY ?\ %
 	
I  < 66s;	<
  #<<>

1773:+> ?H>FQ; !I!&#..JJ$$S[1JJ$$T*F"	 *'		<<>* 

  "#A//1???!F']335FY ?>>sz   3J;D $ D"A"J; DJ;DJ;"I-C$HII$I%"IIIIA#J88J;;K	c                   < V ^8  d   QhRS[ P                  S[ P                  S[R3,          ,          RS[ P                  S[,          /# )r   temp_dirzos.PathLike[str]r   )r   rd   r   r#   rJ   )r   r   s   "r   r   r     s=      

17730B+B#CD	
Cr   c              #    "   \         P                  ! 4       p\        P                  ! VR7      p\         P                  ! V4        Vx  \         P                  ! V4       Vf    \
        P                  ! V4       R# R#   \         d     R# i ; i  \         P                  ! T4       Tf*    \
        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)r   getcwdtempfilemkdtempchdirshutilrmtreeOSError)r   r'  cwddts   &&  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-CCCCCCC)r   r   r   r   )zutf-8NFTr&   )NNF)NNNTF)r[   r\   r]   r^   r   r   r   r   
contextlibcontextmanagerr  r$  r3  r_   r`   ra   s   @r   r   r      sw     $
% 
%" "  O7 O7 O7bc
 c
J   r   r   )r5  r   r   r  r.  r   r+  typingr   typesr   r   r   r   r   r   r   TYPE_CHECKINGcorer	   r   r6  rf   TextIOWrapperrh   r   r   r   r   r   r   <module>r<     s     	 	   
        (???!! !D  "** "(74 74tC Cr   