
    5h?                        S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	J
r
  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \R"                  (       a  SS	KJr   " S
 S5      r\ R*                  S\R,                  \   S\R.                  S   4S j5       r " S S\R2                  5      rS\R,                  \R6                  \\\R<                  \R>                     4      S\S\R@                  4S jr! " S S5      r" " S S5      r#g)    N)TracebackType   )_compat)
formatting)termui)utils)_find_binary_reader)BaseCommandc                   *   \ rS rSrS\R
                  S\R
                  SS4S jrS\S\R                  4S jr	S	\
S\
4S
 jrSS\S\
4S jjrSS\S\
4S jjrSS\S\
4S jjrS\R                   \
   4S jrS\R$                  \
   4S jrS\4S jrSrg)EchoingStdin   inputoutputreturnNc                 *    Xl         X l        SU l        g )NF_input_output_paused)selfr   r   s      X/var/www/html/cementerio_25MayoBackend/env/lib/python3.13/site-packages/click/testing.py__init__EchoingStdin.__init__   s        xc                 .    [        U R                  U5      $ N)getattrr   r   r   s     r   __getattr__EchoingStdin.__getattr__   s    t{{A&&r   rvc                 ^    U R                   (       d  U R                  R                  U5        U$ r   )r   r   write)r   r"   s     r   _echoEchoingStdin._echo   s     ||LLr"	r   nc                 V    U R                  U R                  R                  U5      5      $ r   )r%   r   readr   r'   s     r   r)   EchoingStdin.read$   s     zz$++**1-..r   c                 V    U R                  U R                  R                  U5      5      $ r   )r%   r   read1r*   s     r   r-   EchoingStdin.read1'   s     zz$++++A.//r   c                 V    U R                  U R                  R                  U5      5      $ r   )r%   r   readliner*   s     r   r0   EchoingStdin.readline*   s     zz$++..q122r   c                 |    U R                   R                  5        Vs/ sH  oR                  U5      PM     sn$ s  snf r   )r   	readlinesr%   r   s     r   r3   EchoingStdin.readlines-   s/    '+{{'<'<'>?'>!

1'>???s   9c                 B   ^  [        U 4S jT R                   5       5      $ )Nc              3   D   >#    U H  nTR                  U5      v   M     g 7fr   )r%   ).0r   r   s     r   	<genexpr>(EchoingStdin.__iter__.<locals>.<genexpr>1   s     7;aDJJqMM;s    )iterr   r   s   `r   __iter__EchoingStdin.__iter__0   s    74;;777r   c                 ,    [        U R                  5      $ r   )reprr   r;   s    r   __repr__EchoingStdin.__repr__3   s    DKK  r   r   ))__name__
__module____qualname____firstlineno__tBinaryIOr   strAnyr    bytesr%   intr)   r-   r0   Listr3   Iteratorr<   r@   __static_attributes__ r   r   r   r      s    ajj !**  
'S 'QUU ' % /c /5 /0s 0E 03# 3u 3@166%= @8!**U+ 8!# !r   r   streamr   c              #   @   #    U c  S v   g SU l         S v   SU l         g 7f)NTF)r   )rQ   s    r   _pause_echorS   7   s     ~s   c            
          ^  \ rS rSrS\R
                  S\S\S\R                  SS4
U 4S jjr\	S\4S	 j5       r
\	S\4S
 j5       rSrU =r$ )_NamedTextIOWrapperA   buffernamemodekwargsr   Nc                 @   > [         TU ]  " U40 UD6  X l        X0l        g r   )superr   _name_mode)r   rW   rX   rY   rZ   	__class__s        r   r   _NamedTextIOWrapper.__init__B   s!     	*6*

r   c                     U R                   $ r   )r]   r;   s    r   rX   _NamedTextIOWrapper.nameI       zzr   c                     U R                   $ r   )r^   r;   s    r   rY   _NamedTextIOWrapper.modeM   rc   r   )r^   r]   )rC   rD   rE   rF   rG   rH   rI   rJ   r   propertyrX   rY   rO   __classcell__)r_   s   @r   rU   rU   A   sn    jj(+36BC%%	 c   c  r   rU   r   charsetc                 F   [        U S5      (       aO  [        [        R                  " [        R                  [        R
                     U 5      5      nUb  U$ [        S5      eU c  Sn O&[        U [        5      (       a  U R                  U5      n [        R                  " U 5      $ )Nr)   z.Could not find binary reader for input stream.r   )hasattrr	   rG   castIOrJ   	TypeError
isinstancerI   encodeioBytesIO)r   rh   r"   s      r   make_input_streamrr   R   s|     uf QUUU!;<>IHII}	E3		W%::er   c                   6   \ rS rSrSr SSSS\S\R                  \   S\R                  S	\	S
\R                  \
   S\R                  \R                  \R                  \
   \
\4      4S jjr\S\4S j5       r\S\4S j5       r\S\4S j5       rS\4S jrSrg)Resultf   z3Holds the captured result of an invoked CLI script.Nrunner	CliRunnerstdout_bytesstderr_bytesreturn_value	exit_code	exceptionexc_infoc                 X    Xl         X l        X0l        X@l        XPl        X`l        Xpl        g r   rv   rx   ry   rz   r{   r|   r}   )r   rv   rx   ry   rz   r{   r|   r}   s           r   r   Result.__init__i   s,     (( )"" r   r   c                     U R                   $ )z(The (standard) output as unicode string.)stdoutr;   s    r   r   Result.output   s     {{r   c                     U R                   R                  U R                  R                  S5      R	                  SS5      $ )z&The standard output as unicode string.replace

)rx   decoderv   rh   r   r;   s    r   r   Result.stdout   s9       ''(;(;YGOOD
 	
r   c                     U R                   c  [        S5      eU R                   R                  U R                  R                  S5      R                  SS5      $ )z%The standard error as unicode string.zstderr not separately capturedr   r   r   )ry   
ValueErrorr   rv   rh   r   r;   s    r   stderrResult.stderr   sQ     $=>>  ''(;(;YGOOD
 	
r   c                     U R                   (       a  [        U R                   5      OSnS[        U 5      R                   SU S3$ )Nokay< >)r|   r?   typerC   )r   exc_strs     r   r@   Result.__repr__   s8    *...$t~~&f4:&&'q	33r   )r}   r|   r{   rz   rv   ry   rx   r   )rC   rD   rE   rF   __doc__rK   rG   OptionalrJ   rL   BaseExceptionTupleTyper   r   rf   rI   r   r   r   r@   rO   rP   r   r   rt   rt   f   s    = !! ! jj'	!
 ee! ! ::m,! **GGAFF=)=-GH
!:    
 
 
 
 
 
4# 4r   rt   c                      \ rS rSrSr    SS\S\R                  \R                  \\R                  \   4      S\	S\	SS4
S	 jjr
S
SS\4S jr SS\R                  \R                  \\R                  \   4      S\R                  \\R                  \   4   4S jjr\R                     SS\R                  \R                  \\\R"                  \R$                     4      S\R                  \R                  \\R                  \   4      S\	S\R&                  \R(                  \R,                  \R                  \R,                     4      4S jj5       r     SS
SS\R                  \R                  \\R0                  \   4      S\R                  \R                  \\\R"                  \R$                     4      S\R                  \R                  \\R                  \   4      S\	S\	S\R$                  S\4S jjr\R                   SS\R                  \R                  \S4      S\R&                  \   4S jj5       rSrg)rw      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
Nrh   env
echo_stdin
mix_stderrr   c                 H    Xl         U=(       d    0 U l        X0l        X@l        g r   )rh   r   r   r   )r   rh   r   r   r   s        r   r   CliRunner.__init__   s     47I2$$r   clir
   c                 ,    UR                   =(       d    S$ )zGiven a command object it will return the default program name
for it.  The default is the `name` attribute or ``"root"`` if not
set.
root)rX   )r   r   s     r   get_default_prog_nameCliRunner.get_default_prog_name   s    
 xx!6!r   	overridesc                 `    [        U R                  5      nU(       a  UR                  U5        U$ )z8Returns the environment overrides for invoking a script.)dictr   update)r   r   r"   s      r   make_envCliRunner.make_env   s%     $((^IIi 	r   r   colorc              #   	  ^^#    [        XR                  5      nSn[        R                  n[        R                  n[        R
                  n[        R                  n	S[        l        U R                  U5      n[        R                  " 5       n
U R                  (       a/  [        R                  " [        R                  [        XJ5      5      =pE[!        X@R                  SSS9=[        l        mU R                  (       a  STl        [!        XR                  SSS9[        l        SnU R$                  (       a  [        R                  [        l        O5[        R                  " 5       n[!        UU R                  S	SS
S9[        l        ['        U5      SS[        R(                  [*           S[*        4U4S jjj5       n['        U5      SS[        R(                  [*           S[*        4U4S jjj5       n['        U5      S[,        S[*        4S j5       nUm SS[        R(                  [        R.                  [        R0                        S[        R(                  [,           S[,        4U4S jjjn[2        R4                  n[2        R6                  n[2        R8                  n[:        R<                  n[>        R<                  nU[2        l        U[2        l        U[2        l        U[:        l        U[>        l        0 n URA                  5        HR  u  nn[B        RD                  RG                  U5      UU'   Uc   [B        RD                  U	 M?  U[B        RD                  U'   MT     X4v   URA                  5        H0  u  nnUc   [B        RD                  U	 M  U[B        RD                  U'   M2     U[        l        U[        l        U[        l        U[2        l        U[2        l        U[2        l        U[:        l        U[>        l        U	[        l        g! [H         a     GM  f = f! [H         a     M  f = f! URA                  5        HA  u  nnUc%   [B        RD                  U	 M  ! [H         a     M*  f = fU[B        RD                  U'   MC     U[        l        U[        l        U[        l        U[2        l        U[2        l        U[2        l        U[:        l        U[>        l        U	[        l        f = f7f)a  A context manager that sets up the isolation for invoking of a
command line tool.  This sets up stdin with the given input data
and `os.environ` with the overrides from the given dictionary.
This also rebinds some internals in Click to be mocked (like the
prompt functionality).

This is automatically done in the :meth:`invoke` method.

:param input: the input stream to put into sys.stdin.
:param env: the environment overrides as dictionary.
:param color: whether the output should contain color codes. The
              application can still override this explicitly.

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

.. versionchanged:: 4.0
    Added the ``color`` parameter.
NP   z<stdin>r)encodingrX   rY   r   z<stdout>wz<stderr>backslashreplace)r   rX   rY   errorspromptr   c                   > [         R                  R                  U =(       d    S5        TR                  5       R	                  S5      n[         R                  R                  U S35        [         R                  R                  5         U$ )N r   r   )sysr   r$   r0   rstripflush)r   val
text_inputs     r   visible_input*CliRunner.isolation.<locals>.visible_input  s_    JJV\r*%%'..v6CJJuBZ(JJJr   c                    > [         R                  R                  U =(       d    S S35        [         R                  R                  5         TR	                  5       R                  S5      $ )Nr   r   r   )r   r   r$   r   r0   r   )r   r   s    r   hidden_input)CliRunner.isolation.<locals>.hidden_input  sJ    JJ"~R01JJ&&(//77r   echoc                     [         R                  R                  S5      nU (       a  [         R                  R	                  U5        [         R                  R                  5         U$ )Nr   )r   stdinr)   r   r$   r   )r   chars     r   _getchar%CliRunner.isolation.<locals>._getchar$  s>    99>>!$D

  &JJKr   rQ   r   c                 &   > Uc  T(       + $ U(       + $ r   rP   )rQ   r   default_colors     r   should_strip_ansi.CliRunner.isolation.<locals>.should_strip_ansi0  s     }(((9r   r   )NN)%rr   rh   r   r   r   r   r   FORCED_WIDTHr   rp   rq   r   rG   rk   rH   r   rU   _CHUNK_SIZEr   rS   r   rI   boolrl   rJ   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	 	!**S/ 	S 	 
!	 
Z	 	8C 	8C 	8 
!	8
 
Z	 	4 	C 	 
!	  OS	JJqttAEE{+	;<::d;K		 	 #)"<"<!'!:!:"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   K/S'4;P* 0PP* S'9P
A=S'
PP* PP* 
P'#S'&P''S'*S$QS$
Q&	"S$%Q&	&A>S$$S'argscatch_exceptionsextrac           
      6   SnU R                  X4US9 n	Sn
SnSn[        U[        5      (       a  [        R                  " U5      n UR                  S5      n UR                  " SU=(       d    SUS.UD6n
[        R&                  R-                  5         U	S   R/                  5       nU R0                  (       a  SnOU	S   R/                  5       n SSS5        [3        U WWW
WWUS	9$ ! [         a    U R                  U5      n Nf = f! [         a  n[        R                  " 5       n[        R                  " [        R                  [        R                  [         [        R"                  4      UR$                  5      nUc  SnUS:w  a  Un[        U[         5      (       dI  [        R&                  R)                  [        U5      5        [        R&                  R)                  S5        SnUn SnAGNzSnAf[*         a,  nU(       d  e UnSn[        R                  " 5       n SnAGNSnAff = f! [        R&                  R-                  5         U	S   R/                  5       nU R0                  (       a  Snf U	S   R/                  5       nf = f! , (       d  f       GN= f)
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   r   	prog_namerP   )r   r   r   r   r   )r   rn   rI   shlexsplitpopKeyErrorr   main
SystemExitr   r}   rG   rk   r   UnionrL   rJ   coder   r$   r   r   getvaluer   rt   )r   r   r   r   r   r   r   r   r}   
outstreamsrz   r|   r{   r   ee_coder   r   s                     r   invokeCliRunner.invokea  s   X ^^%^>*L37II$$${{4(<!IIk2	6"xxVTZR9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 ?>st   2J	C&D6AJ	&DJ	DJ	
H)CG0*H,0H)=!H$H,$H))H,,AJJ		
Jtemp_dirzos.PathLike[str]c              #     #    [         R                  " 5       n[        R                  " US9n[         R                  " U5         Uv   [         R                  " U5        Uc   [
        R                  " U5        gg! [         a     gf = f! [         R                  " U5        Uc(   [
        R                  " U5        f ! [         a     f f = ff = f7f)a  A context manager that creates a temporary directory and
changes the current working directory to it. This isolates tests
that affect the contents of the CWD to prevent them from
interfering with each other.

:param temp_dir: Create the temporary directory under this
    directory. If given, the created directory is not removed
    when exiting.

.. versionchanged:: 8.0
    Added the ``temp_dir`` parameter.
)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!A9 7C9
BCBC	C$B;:C;
CCCCC)rh   r   r   r   )zutf-8NFTr   )NNF)NNNTF)rC   rD   rE   rF   r   rI   rG   r   Mappingr   r   r   r   
contextlibcontextmanagerr   rK   rl   rJ   rN   r   rp   rq   r   Sequencert   r   r  rO   rP   r   r   rw   rw      s   ( ;? 
%
% ZZ		#qzz#"678
% 	
%
 
% 

%" "3 " HLAIIc1::c?.B$CD	
3

3'	(  ?C;?	O7zz!''#uadd155k"9:;O7 ZZ		#qzz#"678O7 	O7
 
AGGBJJ

2::(>>?	@O7 O7h ;?>B;?!%c
c
 jjajjo!567c
 zz!''#uadd155k"9:;	c

 ZZ		#qzz#"678c
 c
 c
 c
 
c
J GK

17730B+B#CD	
C r   rw   )$r
  rp   r   r   r  r   r   typingrG   typesr   r   r   r   r   r   r	   TYPE_CHECKINGcorer
   r   r  r   rN   rS   TextIOWrapperrU   r   rI   rK   rl   rJ   rH   rr   rt   rw   rP   r   r   <module>r     s     	 	   
        (??!! !D 

<0 QZZ5E  "** "::aggc5!$$quu+567BEZZ(74 74tC Cr   