
    :)di                        d dl mZ d dlmZmZmZmZmZmZm	Z	 d dl
Z
d dlmZ d dlmZ d dlmZ erd dlmZ d dlmZ  G d	 d
e
j                  ZdddZdS )    )annotations)TYPE_CHECKINGAnyLiteralMappingOptionalTypeUnionN)get_current_context)RichHelpConfiguration)RichHelpFormatter)TracebackType)Consolec                       e Zd ZU dZeZded<   dZded<   dZded<   d	Z	d
ed<   d	Z
d
ed<   ddddddd$ fdZd%d&dZerd' fdZd( fd#Z xZS  xZS ))RichContextz2Click Context class endowed with Rich superpowers.zType[RichHelpFormatter]formatter_classNOptional['Console']console(Optional[Literal['html', 'svg', 'text']]export_console_asFboolerrors_in_output_formathelp_to_stderr)rich_consolerich_help_configr   r   r   argsr   r   r   9Optional[Union[Mapping[str, Any], RichHelpConfiguration]]Optional[bool]kwargsreturnNonec               V    t                      j        |i | |                    dd          }|t          |d          r|j        | _        n|p| j        | _        |t          |d          r|j        | _        n|p| j        | _        |t          |d          r|j        | _        n|p| j        | _        |t          |d          r|j        }||| _        |8t          |d          r|j        | _        dS t          j
                    | _        dS t          |t                    ryt          |d          rQt          r|J |j        j                                        }	|	                    |           t          di |	| _        dS t          j
        di || _        dS || _        dS )a  
        Create Rich Context instance.

        Args:
        ----
            *args: Args that get passed to click.Context.
            rich_console: Rich Console. Defaults to None.
            rich_help_config: Rich help configuration.  Defaults to None.
            export_console_as: Arg is passed to RichHelpFormatter().
            errors_in_output_format: Arg is passed to RichHelpFormatter().
            help_to_stderr: If set, help is printed to stderr.
            **kwargs: Kwargs that get passed to click.Context.

        parentNr   r   r   help_config )super__init__pophasattrr   r   r   r   r$   r   load_from_globals
isinstancer   r   __dict__copyupdate)selfr   r   r   r   r   r   r   r#   kw	__class__s             ^/var/www/menimich/repos/protonApp/venv/lib/python3.11/site-packages/rich_click/rich_context.pyr'   zRichContext.__init__   s   0 	$)&)))(.

8T(B(B!gf6F&G&G!"("7D"0"GD4GD$9L)M)M$%+%=D""%6%P$:PD""*wv?R/S/S*+1+ID((+B+bdFbD(GFI$>$>!>L#'DL#v}-- M#)#5   #8#J#L#L   ('22 
	0v}-- _  .!---'05577		*+++#8#>#>2#>#>   #8#J#^#^M]#^#^   /D    
error_moder   c                    |                      | j        | j        | j        | j        |r| j        r| j        nd          }|S )zCreate the Rich Help Formatter.N)width	max_widthconfigr   r   )r   terminal_widthmax_content_widthr$   r   r   r   )r/   r4   	formatters      r2   make_formatterzRichContext.make_formatter\   sT    ((%,#L=Gq4Kgqt55mq ) 
 
	 r3   'RichContext'c                D    t                                                      S N)r&   	__enter__)r/   r1   s    r2   r@   zRichContext.__enter__i   s    77$$&&&r3   exc_typeOptional[Type[BaseException]]	exc_valueOptional[BaseException]tbOptional[TracebackType]c                N    t                                          |||           d S r?   )r&   __exit__)r/   rA   rC   rE   r1   s       r2   rH   zRichContext.__exit__l   s'     GGXy"55555r3   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   F)r4   r   r    r   )r    r=   )rA   rB   rC   rD   rE   rF   r    r!   )__name__
__module____qualname____doc__r   r   __annotations__r   r   r   r   r'   r<   r   r@   rH   __classcell__)r1   s   @r2   r   r      s+        <</@O@@@@#'G''''BFFFFF$))))) N    
 -1VZFJ26)-?0 ?0 ?0 ?0 ?0 ?0 ?0 ?0B	 	 	 	 	  6	' 	' 	' 	' 	' 	'	6 	6 	6 	6 	6 	6 	6 	6 	6 	66 6 6 6r3   r   Fsilentr   r    Optional[RichContext]c                "    t          |           S )a  
    Return the current click context.  This can be used as a way to
    access the current context object from anywhere.  This is a more implicit
    alternative to the :func:`pass_context` decorator.  This function is
    primarily useful for helpers such as :func:`echo` which might be
    interested in changing its behavior based on the current context.

    To push the current context, :meth:`Context.scope` can be used.

    .. versionadded:: 5.0

    :param silent: if set to `True` the return value is `None` if no context
                   is available.  The default behavior is to raise a
                   :exc:`RuntimeError`.
    rP   )click_get_current_contextrS   s    r2   r   r   u   s      %F3333r3   rI   )rP   r   r    rQ   )
__future__r   typingr   r   r   r   r   r	   r
   clickclick.globalsr   rT   "rich_click.rich_help_configurationr   rich_click.rich_help_formatterr   typesr   rich.consoler   Contextr   r%   r3   r2   <module>r^      s   " " " " " " N N N N N N N N N N N N N N N N N N  J J J J J J D D D D D D < < < < < <  %######$$$$$$`6 `6 `6 `6 `6%- `6 `6 `6F4 4 4 4 4 4 4r3   