
    &`i<e                        d 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mZmZmZmZmZ ddlZddlZddlZej        dk    rddlZnddlZ G d d          Z	 ddlZdd	lmZ  ej                     n"# e$ r  G d
 d          Z e            ZY nw xY w G d d          Z e            Z ej         d           d Z!ddddde"dede#dee"ef         dee"e$e$f         defdZ%d Z& G d d          Z' G d dej(                  Z) e'            Z* ej+        dd ej,        e*j-        d          d d!"           ej+        d#d ej,        g d$d          d d%"           ej+        d&d'dd()          gZ.d*ed+efd,Z/dS )-a/  Logger implementing the Command Line Interface.

A replacement for the standard Python `logging` API
designed for implementing a better CLI UX for the cluster launcher.

Supports color, bold text, italics, underlines, etc.
(depending on TTY features)
as well as indentation and other structured output.
    N)contextmanager)wraps)AnyCallableDictListOptionalTuplewin32c                   6    e Zd Zd Zd Zed             Zd ZdS )_ColorfulMockc                 N    d | _         | | _        d | _        d | _        d | _        d S )Nc                     | S N )xs    v/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/autoscaler/_private/cli_logger.py<lambda>z(_ColorfulMock.__init__.<locals>.<lambda>"   s    !     )identitycolorful	colormode	NO_COLORSANSI_8_COLORSselfs    r   __init__z_ColorfulMock.__init__    s.    #!r   c                     d S r   r   r   s    r   disablez_ColorfulMock.disable*       r   c              #   <   K    G d d          } |            V  d S )Nc                       e Zd Zd ZdS )/_ColorfulMock.with_style.<locals>.IdentityClassc                     d S )Nc                     | S r   r   )ys    r   r   zM_ColorfulMock.with_style.<locals>.IdentityClass.__getattr__.<locals>.<lambda>1   s     r   r   r   names     r   __getattr__z;_ColorfulMock.with_style.<locals>.IdentityClass.__getattr__0   s
    "{"r   N)__name__
__module____qualname__r)   r   r   r   IdentityClassr#   /   s#        # # # # #r   r-   r   )r   r   r-   s      r   
with_stylez_ColorfulMock.with_style-   sH      	# 	# 	# 	# 	# 	# 	# 	# moor   c                 *    |dk    r| j         S | j        S )Nr.   )r.   r   r'   s     r   r)   z_ColorfulMock.__getattr__5   s    <?"}r   N)r*   r+   r,   r   r   r   r.   r)   r   r   r   r   r      s\        " " "     ^    r   r   )ColorfulStringc                       e Zd ZdS )r0   N)r*   r+   r,   r   r   r   r0   r0   F   s        r   r0   c                       e Zd Zg dZd ZdS )_ColorfulProxy)r   resetbolditalic
underlineddimmed
dodgerBlue	limeGreenredorangeskyBluemagentayellowc                     t          t          |          }t          |          r#|t          j        vrt          d|z   dz             |S )NzUsage of the colorful method 'zh' is forbidden by the proxy to keep a consistent color scheme. Check `cli_logger.py` for allowed methods)getattr_cfcallabler3   _proxy_allowlist
ValueError)r   r(   ress      r   r)   z_ColorfulProxy.__getattr__d   sW    c4  C== 	T)HHH047 ;< <  
 
r   N)r*   r+   r,   rD   r)   r   r   r   r3   r3   Q   s5          $    r   r3   F)stripc                      t          j                    } | }d}|j        j        t          k    r!|j        }|dz  }|j        j        t          k    !|j        t          j        	                    |j        j                  dS )zGet the info from the caller frame.

    Used to override the logging function and line number with the correct
    ones. See the comment on _patched_makeRecord for more info.
    r      )linenofilename)
inspectcurrentframef_codeco_filename__file__f_backf_linenoospathbasename)framecallerlevelss      r   _external_caller_inforY   t   s|      ""EFF
-
#x
/
/! -
#x
/
/ /G$$V]%>??  r   )	no_format_tags	_numberedmsgargsrZ   r[   r\   kwargsc          	         t          | t                    st          | t                    rd}|g }|                                D ]!\  }}	|	du r||gz  }|	du r||dz   |	z   gz  }"|rXt                              t                              d                    d                    |                                        }d}
|U|\  }}}t                              |d         t          |          z   d	z   t          |          z   |d
         z             dz   }
|r|
| z   |z   S |
 | j        |i |z   |z   S |rt          d          | g|}d |D             }d                    |          S )aw  Formats a message for printing.

    Renders `msg` using the built-in `str.format` and the passed-in
    `*args` and `**kwargs`.

    Args:
        *args (Any): `.format` arguments for `msg`.
        no_format (bool):
            If `no_format` is `True`,
            `.format` will not be called on the message.

            Useful if the output is user-provided or may otherwise
            contain an unexpected formatting string (e.g. "{}").
        _tags (Dict[str, Any]):
            key-value pairs to display at the end of
            the message in square brackets.

            If a tag is set to `True`, it is printed without the value,
            the presence of the tag treated as a "flag".

            E.g. `_format_msg("hello", _tags=dict(from=mom, signed=True))`
                 `hello [from=Mom, signed]`
        _numbered (Tuple[str, int, int]):
            `(brackets, i, n)`

            The `brackets` string is composed of two "bracket" characters,
            `i` is the index, `n` is the total.

            The string `{i}/{n}` surrounded by the "brackets" is
            prepended to the message.

            This is used to number steps in a procedure, with different
            brackets specifying different major tasks.

            E.g. `_format_msg("hello", _numbered=("[]", 0, 5))`
                 `[0/5] hello`

    Returns:
        The formatted message.
     NTF=z [{}], r   /rI    z&We do not support printing kwargs yet.c                 ,    g | ]}t          |          S r   )str.0r   s     r   
<listcomp>z_format_msg.<locals>.<listcomp>   s    


a3q66


r   )

isinstancerg   r0   itemscfr4   r8   formatjoinrE   )r]   rZ   r[   r\   r^   r_   tags_str	tags_listkvnumbering_strcharsinrF   s                  r   _format_msgrx      s   b #s Fz#~>> FI + +199!$I::a#gk]*		 U88BIIgnnTYYy=Q=Q.R.R$S$STT #KE1aIIeAhQ&7#&=A&Fq&QRRUXXM 	2 3&11zsz4:6:::XEE CABBB,,C

3


C99S>>r   c                  b    	 t           j                                        S # t          $ r Y dS w xY w)z/More robust check for interactive terminal/tty.F)sys	__stdin__isatty	Exceptionr   r   r   _isattyr~      sA     }##%%%    uus     
..c                      e Zd ZU dZeed<   eed<   eed<   dZeed<   d Z	dAd	Z
dBd
Zed             Zd Zed             Zd Zed             Zd Zd Zd Z	 	 	 dCdedededefdZd ZdededefdZdededefdZdedededefd Zdededefd!Zd" Zdededefd#Zdededefd$Zdededefd%Zdd&dedededefd'Z d( Z!dd&dedededefd)Z"d* Z#d+ Z$ddd,dededededef
d-Z%dDdefd.Z&	 dAdd/de'e         ded0edefd1Z(d2edededefd3Z)e*+                    d4          fd5e,e         d6efd7Z-d8d8dd9d:ededed;ed<ed=e'e.         defd>Z/defd?Z0d@ Z1dS )E
_CliLoggerav  Singleton class for CLI logging.

    Without calling 'cli_logger.configure', the CLILogger will default
    to 'record' style logging.

    Attributes:
        color_mode (str):
            Can be "true", "false", or "auto".

            Enables or disables `colorful`.

            If `color_mode` is "auto", is set to `not stdout.isatty()`
        indent_level (int):
            The current indentation level.

            All messages will be indented by prepending `"  " * indent_level`
        vebosity (int):
            Output verbosity.

            Low verbosity will disable `verbose` and `very_verbose` messages.
    
color_modeindent_levelinteractive)autorecordpretty_autodetected_cf_colormodec                     d| _         d| _        d| _        d| _        d| _        d| _        d| _        t          j        j	        | _
        |                                  d S )Nr   Fr   r   )r   
_verbosity_verbosity_overriden_color_mode
_log_styler   r   rm   r   r   r   
set_formatr   s    r   r   z_CliLogger.__init__  s\    $)!!" 
 +-+*?'r   Nc                 L    |sddl m} |}t          j        |          | _        d S )Nr   )LOGGER_FORMAT)!ray.autoscaler._private.constantsr   logging	Formatter
_formatter)r   format_tmplr   s      r   r   z_CliLogger.set_format  s7     	(GGGGGG'K!+K88r   c                     ||                      |           ||                     |           ||                     |           |                                  dS )z*Configures the logger according to values.N)_set_log_style_set_color_mode_set_verbositydetect_colors)r   	log_styler   	verbositys       r   	configurez_CliLogger.configure%  sh     	***!  ,,, 	***r   c                     | j         S r   )r   r   s    r   r   z_CliLogger.log_style2  s
    r   c                    |                                 | _        t                      | _        | j        dk    rt                      | _        dS | j        dk    rd| _        |                     d           dS | j        dk    r	d| _        dS dS )z(Configures interactivity and formatting.r   r   Ffalser   TN)lowerr   r~   r   r   r   r   r   s     r   r   z_CliLogger._set_log_style6  s    ''))"99?f$$!))DKKK_((DK  )))))_((DKKK )(r   c                     | j         S r   )r   r   s    r   r   z_CliLogger.color_modeC  s    r   c                 `    |                                 | _        |                                  d S r   )r   r   r   r   s     r   r   z_CliLogger._set_color_modeG  s*    7799r   c                 >    | j         r| j        S | j        sdS | j        S )Ni  )r   r   r   r   s    r   r   z_CliLogger.verbosityK  s,    $ 	?" 	3r   c                 "    || _         d| _        d S )NT)r   r   r   s     r   r   z_CliLogger._set_verbosityS  s    $(!!!r   c                 *   | j         dk    r?| j        t          j        k    r| j        t          _        nt          j        t          _        dS | j         dk    rt                                           dS | j         dk    rdS t          d| j         z             )zUpdate color output settings.

        Parse the `color_mode` string and optionally disable or force-enable
        color output
        (8-color ANSI if no terminal detected to be safe) in colorful.
        trueNr   r   zInvalid log color setting: )r   r   rm   r   r   r   r   rE   r   s    r   r   z_CliLogger.detect_colorsW  s     ?f$$.",>>#>!/F?g%%JJLLLF?f$$F6HIIIr   c                 0    |                      d           dS )zPrint a line feed.ra   Nprintr   s    r   newlinez_CliLogger.newlinem  s    

2r   INFOTr]   
_level_str	_linefeedendc           	         | j         rd| j        z  |z   }np|                                dk    rdS t                      }t	          j        dd|d         |d         |i d          }||_        | j                            |          }|d	v rt          j
        }nt          j        }|s+|                    |           |                                 dS d
|i}	t          |fd|i|	 dS )zProxy for printing messages.

        Args:
            msg: Message to print.
            linefeed (bool):
                If `linefeed` is `False` no linefeed is printed at the
                end of the message.
        z  ra   Nclir   rK   rJ   )r(   levelpathnamerJ   r]   r^   exc_info)WARNINGERRORPANICr   file)r   r   rG   rY   r   	LogRecord	levelnamer   rn   rz   stderrstdoutwriteflushr   )
r   r]   r   r   r   rendered_messagecaller_infor   streamr_   s
             r   _printz_CliLogger._printq  s    ; 	>#d&77#=yy{{b  /11K& 
 %Z0"8,  F   *F#55f== 666ZFFZF 	LL)***LLNNNF66V6v66666r   c                 :    |  G fdd          } |            S )z8Context manager that starts an indented block of output.c                   $    e Zd Z fdZ fdZdS )3_CliLogger.indented.<locals>.IndentedContextManagerc                 (    xj         dz  c_         d S NrI   r   )r   
cli_loggers    r   	__enter__z=_CliLogger.indented.<locals>.IndentedContextManager.__enter__      ''1,''''r   c                 (    xj         dz  c_         d S r   r   r   typevaluetbr   s       r   __exit__z<_CliLogger.indented.<locals>.IndentedContextManager.__exit__  r   r   Nr*   r+   r,   r   r   )r   s   r   IndentedContextManagerr     sG        - - - - -- - - - - - -r   r   r   )r   r   r   s     @r   indentedz_CliLogger.indented  sK    
	- 	- 	- 	- 	- 	- 	- 	- 	- 	- &%'''r   r^   r_   c                 |     | j         t                              |          g|R i | |                                 S )zwPrint a group title in a special color and start an indented block.

        For arguments, see `_format_msg`.
        )r   rm   r9   r   r   r]   r^   r_   s       r   groupz_CliLogger.group  s@    
 	
2==%%7777777}}r   c                 F    |  G fdd          } |            S )a  Context manager for printing multi-line error messages.

        Displays a start sequence "!!! {optional message}"
        and a matching end sequence "!!!".

        The string "!!!" can be used as a "tombstone" for searching.

        For arguments, see `_format_msg`.
        c                   *    e Zd Z fdZfdZdS )A_CliLogger.verbatim_error_ctx.<locals>.VerbatimErorContextManagerc                 b     j         t                              d          dz   gR i  d S )Nz!!! z{}errorrm   r5   )r   r^   r   r_   r]   s    r   r   zK_CliLogger.verbatim_error_ctx.<locals>.VerbatimErorContextManager.__enter__  s=     
 4!7NtNNNvNNNNNr   c                 b                         t                              d                     d S )Nz!!!r   r   s       r   r   zJ_CliLogger.verbatim_error_ctx.<locals>.VerbatimErorContextManager.__exit__  s'      00000r   Nr   )r^   r   r_   r]   s   r   VerbatimErorContextManagerr     s^        O O O O O O O O1 1 1 1 1 1 1r   r   r   )r   r]   r^   r_   r   r   s    ``` @r   verbatim_error_ctxz_CliLogger.verbatim_error_ctx  s_     
	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 *)+++r   keyc                     |                      t                              |          dz   t          t                              |          g|R i |z              dS )zDisplays a key-value pair with special formatting.

        Args:
            key: Label that is prepended to the message.

        For other arguments, see `_format_msg`.
        z: N)r   rm   r=   rx   r5   )r   r   r]   r^   r_   s        r   labeled_valuez_CliLogger.labeled_value  sS     	BJJsOOd*[-W-W-W-WPV-W-WWXXXXXr   c                 F    | j         dk    r | j        |g|R ddi| dS dS )z[Prints a message if verbosity is not 0.

        For arguments, see `_format_msg`.
        r   r   VINFONr   r   r   s       r   verbosez_CliLogger.verbose  sF    
 >ADJs@T@@@g@@@@@@ r   c                 F    | j         dk    r | j        |g|R ddi| dS dS )zePrints a formatted warning if verbosity is not 0.

        For arguments, see `_format_msg`.
        r   r   VWARNN)r   _warningr   s       r   verbose_warningz_CliLogger.verbose_warning  sF    
 >ADM#CCCCCFCCCCC r   c                 F    | j         dk    r | j        |g|R ddi| dS dS )zXLogs an error if verbosity is not 0.

        For arguments, see `_format_msg`.
        r   r   VERRN)r   _errorr   s       r   verbose_errorz_CliLogger.verbose_error  sF    
 >ADK@d@@@v@@@@@@ r   c                 F    | j         dk    r | j        |g|R ddi| dS dS )zOPrints if verbosity is > 1.

        For arguments, see `_format_msg`.
        rI   r   VVINFONr   r   s       r   very_verbosez_CliLogger.very_verbose  sF    
 >ADJsATAAAhA&AAAAA r   c                 \     | j         t                              |          g|R ddi| dS )zWPrints a formatted success message.

        For arguments, see `_format_msg`.
        r   SUCCN)r   rm   r:   r   s       r   successz_CliLogger.success  s=    
 	
2<<$$ItIIII&IIIIIr   )r   c                ~    |t          d           | j        t                              |          g|R d|i| dS )zWPrints a formatted warning message.

        For arguments, see `_format_msg`.
        NLog level not set.r   )rE   r   rm   r<   r   r]   r   r^   r_   s        r   r   z_CliLogger._warning  sP    
 1222
299S>>JDJJJZJ6JJJJJr   c                 $     | j         |ddi| d S )Nr   WARN)r   r   r^   r_   s      r   warningz_CliLogger.warning  s$    t99&99999r   c                ~    |t          d           | j        t                              |          g|R d|i| dS )zUPrints a formatted error message.

        For arguments, see `_format_msg`.
        Nr   r   )rE   r   rm   r;   r   s        r   r   z_CliLogger._error  sP    
 1222
266#;;GGGG*GGGGGGr   c                 $     | j         |ddi| d S )Nr   ERRr   r   s      r   r   z_CliLogger.error  s$    T6e6v66666r   c                 $     | j         |ddi| d S )Nr   r   r   r   s      r   panicz_CliLogger.panic  s$    T8g888888r   r   r   c                R    |                      t          |g|R i |||           dS )zEPrints a message.

        For arguments, see `_format_msg`.
        r  N)r   rx   )r   r]   r   r   r^   r_   s         r   r   z_CliLogger.print   s;     	K5d555f55*RUVVVVVr   c                 ,     | j         |g|R d|i| d S )NrZ   r   )r   r]   rZ   r^   r_   s        r   infoz_CliLogger.info.  s/    
3=d===)=f=====r   )excr  c                    | | j         |g|R ddi| ||t          j        }| j        rt          }|d} ||          )zPrints an error and aborts execution.

        Print an error and throw an exception to terminate the program
        (the exception will not print a message).
        Nr   r   z!Exiting due to cli_logger.abort())r   clickClickExceptionr   SilentClickException)r   r]   r  r^   r_   exc_clss         r   abortz_CliLogger.abort1  si     ?DKAdAAAwA&AAA?I&; 	+*G;5Cgcllr   valc                 b    |s,d}| j         st                      } | j        |g|R d|i| dS dS )zHandle assertion without throwing a scary exception.

        Args:
            val: Value to check.

        For other arguments, see `_format_msg`.
        Nr  )r   AssertionErrorr  )r   r  r]   r^   r_   r  s         r   doassertz_CliLogger.doassertG  s_      		6C; '$&& DJs5T555s5f55555		6 		6r   rc   xs	separatorc                 @    |                     d |D                       S )z<Render a list of bolded values using a non-bolded separator.c                 \    g | ])}t          t                              |                    *S r   )rg   rm   r5   rh   s     r   rj   z*_CliLogger.render_list.<locals>.<listcomp>\  s(    ;;;1s2771::;;;r   )ro   )r   r  r  s      r   render_listz_CliLogger.render_listZ  s#    ~~;;;;;<<<r   F)_abort_default
_timeout_syesr  r  r  c          
      0   |}|}	| j         s&|s$|                     d           t          d          |	rd}
nd}
t                              d|
z   dz             dz   }t          |g|R i |}|r|                    d          s|dz  }t          |                    d          d	                   }||z   }|r5| 	                    |d
z   t          
                    d          z              dS | 	                    |d           d}g d}g d}	 	 | t          j                                        }nKt          j        dk    rt          j                    }d}	 t          j                    |z
  |k    r|                                  d}nt#          j                    rnt#          j                    }|dv r|                                  |dz   }nR|dk    r|r|dd	         }t)          ddd           n,||z   }t)          |dd           nt          j        d           n]t-          j        t          j        gg g |          \  }}}|s|                                  d}nt          j                                        }|                                }|dk    r|	}n|                                }||v rd}n||v rd}nd|z  }|                     d|t                              |                                          |                     |d          |                     |d                     | 	                    ||z   d           8n&# t6          $ r |                                  |	}Y nw xY w|s&|r$| 	                    d           t9          d          |S )a  Display a confirmation dialog.

        Valid answers are "y/yes/true/1" and "n/no/false/0".

        Args:
            yes: If `yes` is `True` the dialog will default to "yes"
                        and continue without waiting for user input.
            _abort (bool):
                If `_abort` is `True`,
                "no" means aborting the program.
            _default (bool):
                The default action to take if the user just presses enter
                with no input.
            _timeout_s (float):
                If user has no input within _timeout_s seconds, the default
                action is taken. None means no timeout.
        z^This command requires user confirmation. When running non-interactively, supply --yes to skip.z&Non-interactive confirm without --yes.zY/nzy/Nz	Confirm [z]:re   
zy z[automatic, due to --yes]TF)r   N)r&   r  r   1)rw   nor   0r   ra   )r  z )r   r   g?z'{}Invalid answer: {}. Expected {} or {}rd   z
Exiting...z:Exiting due to the response to confirm(should_abort=True).)r   r   rE   rm   r7   rx   endswithlensplitr   r8   rz   stdinreadlineplatformtimer   msvcrtkbhitgetwchr   sleepselectr   rG   r5   r  KeyboardInterruptr  )r   r  r]   r  r  r  r^   r_   should_abortdefaultyn_strconfirm_strr   msg_lencomplete_strrF   yes_answers
no_answersans
start_timechready_indents                           r   confirmz_CliLogger.confirm^  s   6  	G 	GJJH   EFFF 	FFFmmK&$84$?@@3F&s<T<<<V<< 	$CLL$6$6 	$#&,,T222677'+5 	KKt+bii8S.T.TTUUU4LE222///...
>	:C%),,..CC\W,,!%JC, IKK*4CC LLNNN"&C!#\^^ ,!'B!\11 $&)Dj %!#t#& !G*-crc(C$)'r$F$F$F$F&)Bh %bb = = = = = JsOOO),, #)-RZ"P"PKE1a  3"!i0022iikk$;;!Ciikk+%%C*$$Cw

=GGCIIKK(($$[#66$$Z55   F[0EBBBu:Cv ! 	 	 	LLNNNCCC	  	| 	 KK%%%&L   
s   H9M  M+*M+c                    t                               |          }t          |g|R i |}|r|                    d          s|dz  }|                     |d           d}	 t
          j                                        }|                                }|	                                }n$# t          $ r |                                  Y nw xY w|S )zPrompt the user for some text input.

        Args:
            msg: The mesage to display to the user before the prompt.

        Returns:
            The string entered by the user.
        r  re   F)linefeedra   )rm   r7   rx   r#  r   rz   r&  r'  r   rG   r/  r   )r   r]   r^   r_   r5  r   rF   r8  s           r   promptz_CliLogger.prompt  s     }}S))&|EdEEEfEE 	$CLL$6$6 	$#$u555	)$$&&C))++C))++CC  	 	 	LLNNNNN	 
s   !AB( (C	C	c                 ~    t           j                                         t           j                                         d S r   )rz   r   r   r   r   s    r   r   z_CliLogger.flush   s0    

r   r   )NNN)r   TN)T)2r*   r+   r,   __doc__rg   __annotations__intboolVALID_LOG_STYLESr   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r	   r  r  rm   r4   r   r  floatr>  rA  r   r   r   r   r   r      s         , OOO3 ####   9 9 9 9      X       X      X) ) )J J J,   !57 5757 57 	57
 57 57 57 57n( ( ( S C    ,c ,# , , , , ,*Y Y3 Ys Yc Y Y Y YA3 As Ac A A A AD D DA AS AC A A A AB BC B3 B B B BJ3 Js Jc J J J J @D K K KC K K Ks K K K K: : : >B H H H# Hc Hs HS H H H H7 7 79 9 9 !W W WW W 	W
 W W W W W> > > > > > $(@D  C=03:=PS   ,6D 6s 63 6# 6 6 6 6& ;=((4.. = =d3i =C = = = = &*F F FF F 	F
 F F UOF F F F FP#    4    r   r   c                   0     e Zd ZdZdef fdZddZ xZS )r  a;  `ClickException` that does not print a message.

    Some of our tooling relies on catching ClickException in particular.

    However the default prints a message, which is undesirable since we expect
    our code to log errors manually using `cli_logger.error()` to allow for
    colors and other formatting.
    messagec                 X    t          t          |                               |           d S r   )superr  r   )r   rK  	__class__s     r   r   zSilentClickException.__init__  s(    "D))227;;;;;r   Nc                     d S r   r   )r   r   s     r   showzSilentClickException.show  r    r   r   )r*   r+   r,   rC  rg   r   rP  __classcell__)rN  s   @r   r  r    sb         < < < < < < <       r   r  z--log-style)case_sensitiver   zIf 'pretty', outputs with formatting and color. If 'record', outputs record-style without formatting. 'auto' defaults to 'pretty', and disables pretty logging if stdin is *not* a TTY.)requiredr   r1  helpz--log-color)r   r   r   zAUse color logging. Auto enables color logging if stdout is a TTY.z-vz	--verboseT)r1  countfreturnc                      t          t                    D ]} |            t                     d d d d fd
            }|S )N)r   	log_colorr   c                 L    t                               | ||            |i |S r   )r   r   )r   rY  r   r^   r_   rV  s        r   wrapperz*add_click_logging_options.<locals>.wrapper4  s0    Y	7;;;q$!&!!!r   )reversedCLICK_LOGGING_OPTIONSr   )rV  optionr[  s   `  r   add_click_logging_optionsr_  0  sk    011  F1II
1XX!%t " " " " " " X" Nr   )0rC  rL   r   rS   rz   r)  
contextlibr   	functoolsr   typingr   r   r   r   r	   r
   r	  coloramarayr(  r*  r.  r   r   rB   colorful.corer0   use_8_ansi_colorsModuleNotFoundErrorr3   rm   initrY   rg   rF  rE  rx   r~   r   r
  r  r   r^  ChoicerG  r]  r_  r   r   r   <module>rj     s      				 



  % % % % % %       = = = = = = = = = = = = = = = =   


<7MMMMMMM       :,,,,,,C   
        -//CCC        < ^ E      ,  &*O O O	OO O S>	O
 S#s]#O O O O Ox	 	 	S S S S S S S Sl    5/   " Z\\
 ELU\*5eLLL'   ELU\333EJJJQ   EL{D===) 0	 	h 	 	 	 	 	 	s   !A; ;BB