o �J�h�&�@sPddlmZddlmZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZejrIdd lmZdd lmZdd lmZd)dd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�ZGd#d$�d$e�Z Gd%d&�d&e!�Z"Gd'd(�d(e!�Z#dS)*�)� annotationsN)�gettext)�ngettext�)�get_text_stderr)�resolve_color_default)�echo)�format_filename)�Command)�Context)� Parameter� param_hint�cabc.Sequence[str] | str | None�return� str | NonecCs*|durt|t�sd�dd�|D��S|S)Nz / css�|]}t|�VqdS�N)�repr)�.0�x�r�NC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\click\exceptions.py� <genexpr>s�z$_join_param_hints.<locals>.<genexpr>)� isinstance�str�join)r rrr�_join_param_hintssrcsFeZdZdZdZd�fdd� Zdd d �Zdd d �Zdddd�Z�Z S)�ClickExceptionz8An exception that Click can handle and show to the user.r�messagerr�Nonecst��|�t�|_||_dSr)�super�__init__r� show_colorr)�selfr�� __class__rrr s  zClickException.__init__cC�|jSr�r�r"rrr�format_message'�zClickException.format_messagecCr%rr&r'rrr�__str__*r)zClickException.__str__N�file�t.IO[t.Any] | NonecCs2|durt�}ttd�j|��d�||jd�dS)N�Error: {message}r&�r+�color)rr�_�formatr(r!�r"r+rrr�show-s �zClickException.show)rrrr�rrr�r+r,rr) �__name__� __module__� __qualname__�__doc__� exit_coder r(r*r3� __classcell__rrr#rrs  rcs4eZdZdZdZdd�fd d � Zdddd�Z�ZS)� UsageErrora+An internal exception that signals a usage error. This typically aborts any further handling. :param message: the error message to display. :param ctx: optionally the context that caused this error. Click will fill in the context automatically in some situations. �Nrr�ctx�Context | Nonerrcs0t��|�||_|jr|jj|_dSd|_dSr)rr r>�command�cmd)r"rr>r#rrr Cs zUsageError.__init__r+r,cCs�|durt�}d}d}|jdur.|jj�|j�dur.td�j|jj|jjdd�}|�d�}|jdurF|jj}t |j� ��d|��||d�t td�j|� �d�||d�dS) N�z"Try '{command} {option}' for help.r)r@�option� r.r-r&) rr>r@�get_help_optionr0r1� command_path�help_option_namesr/r� get_usager()r"r+r/�hintrrrr3Hs$ �   �zUsageError.showr)rrr>r?rrr5)r6r7r8r9r:r r3r;rrr#rr<8s r<c�4eZdZdZ   dd�fd d� Zddd�Z�ZS)� BadParametera An exception that formats out a standardized error message for a bad parameter. This is useful when thrown from a callback or type as Click will attach contextual information to it (for instance, which parameter it is). .. versionadded:: 2.0 :param param: the parameter object that caused this error. This can be left out, and Click will attach this info itself if possible. :param param_hint: a string that shows up as parameter name. This can be used as alternative to `param` in cases where custom validation should happen. If it is a string it's used as such, if it's a list then each item is quoted and separated. Nrrr>r?�param�Parameter | Noner rrrcst��||�||_||_dSr)rr rLr )r"rr>rLr r#rrr qs zBadParameter.__init__cCsV|jdur |j}n|jdur|j�|j�}n td�j|jd�Std�jt|�|jd�S)NzInvalid value: {message}r&z)Invalid value for {param_hint}: {message})r r)r rL�get_error_hintr>r0r1rr)r"r rrrr(|s   �zBadParameter.format_message�NNN) rrr>r?rLrMr rrrr4�r6r7r8r9r r(r;rrr#rrK_s� rKcsBeZdZdZ     dd�fd d� Zddd�Zddd�Z�ZS)�MissingParametera�Raised if click required an option or argument but it was not provided when invoking the script. .. versionadded:: 4.0 :param param_type: a string that indicates the type of the parameter. The default is to inherit the parameter type from the given `param`. Valid values are ``'parameter'``, ``'option'`` or ``'argument'``. Nrrr>r?rLrMr � param_typerrcs t��|pd|||�||_dS)NrB)rr rR)r"rr>rLr rRr#rrr �s zMissingParameter.__init__rcCs|jdur |j}n|jdur|j�|j�}nd}t|�}|r#d|��nd}|j}|dur5|jdur5|jj}|j}|jdurV|jjj |j|jd�}|rV|rT|d|��7}n|}|r]d|��nd}|dkrht d�}n|dkrqt d�}n|d krzt d �}nt d �j |d �}|�|�d |��S)N� rB)rLr>z. �argumentzMissing argumentrCzMissing option� parameterzMissing parameterzMissing {param_type})rR�.) r rLrNr>rrR�param_type_namer�type�get_missing_messager0r1)r"r rR�msgZ msg_extra�missingrrrr(�s8   �   zMissingParameter.format_messagecCs.|js|jr |jjnd}td�j|d�S|jS)NzMissing parameter: {param_name})� param_name)rrL�namer0r1)r"r\rrrr*�szMissingParameter.__str__)NNNNN) rrr>r?rLrMr rrRrrrr4)r6r7r8r9r r(r*r;rrr#rrQ�s � (rQcrJ)� NoSuchOptionzfRaised if click attempted to handle an option that does not exist. .. versionadded:: 4.0 N� option_namerrr� possibilities�cabc.Sequence[str] | Noner>r?rrcs6|dur td�j|d�}t��||�||_||_dS)NzNo such option: {name})r])r0r1rr r_r`)r"r_rr`r>r#rrr �s  zNoSuchOption.__init__cCsH|js|jSd�t|j��}tddt|j��j||d�}|j�d|��S)Nz, zDid you mean {possibility}?z#(Possible options: {possibilities}))Z possibilityr`rS)r`rr�sortedr�lenr1)r"Zpossibility_strZsuggestrrrr(�s��zNoSuchOption.format_messagerO) r_rrrr`rar>r?rrr4rPrrr#rr^�s �r^cs&eZdZdZ d d �fd d � Z�ZS)�BadOptionUsageaRaised if an option is generally supplied but the use of the option was incorrect. This is for instance raised if the number of arguments for an option is not correct. .. versionadded:: 4.0 :param option_name: the name of the option being used incorrectly. Nr_rrr>r?rrcst��||�||_dSr)rr r_)r"r_rr>r#rrr �s zBadOptionUsage.__init__r)r_rrrr>r?rr)r6r7r8r9r r;rrr#rrd�s �rdc@�eZdZdZdS)�BadArgumentUsagez�Raised if an argument is generally supplied but the use of the argument was incorrect. This is for instance raised if the number of values for an argument is not correct. .. versionadded:: 6.0 N�r6r7r8r9rrrrrf�rfcs*eZdZd �fdd� Zd dd d �Z�ZS)�NoArgsIsHelpErrorr>r rrcs|t�j|��|d�dS)N)r>)rr �get_help)r"r>r#rrr szNoArgsIsHelpError.__init__Nr+r,cCst|��|d|jjd�dS)NT)r+�errr/)rr(r>r/r2rrrr3szNoArgsIsHelpError.show)r>r rrrr5)r6r7r8r r3r;rrr#rri srics.eZdZdZd d�fd d � Zdd d �Z�ZS)� FileErrorz"Raised if a file cannot be opened.N�filenamerrIrrrcs0|durtd�}t��|�t|�|_||_dS)Nz unknown error)r0rr r � ui_filenamerm)r"rmrIr#rrr s    zFileError.__init__cCstd�j|j|jd�S)Nz+Could not open file {filename!r}: {message})rmr)r0r1rnrr'rrrr( s�zFileError.format_messager)rmrrIrrrr4rPrrr#rrlsrlc@re)�Abortz=An internal signalling exception that signals Click to abort.Nrgrrrrro&rhroc@s eZdZdZdZd d dd �Zd S) �Exitz�An exception that indicates that the application should exit with some status code. :param code: the status code to exit with. �r:r�code�intrrcCs ||_dSrrq)r"rrrrrr 3s z Exit.__init__N)r)rrrsrr)r6r7r8r9� __slots__r rrrrrp*srp)r rrr)$� __future__r�collections.abc�abc�cabc�typing�trr0r�_compatr�globalsr�utilsrr � TYPE_CHECKING�corer r r r� Exceptionrr<rKrQr^rdrfrirl� RuntimeErrorrorprrrr�<module>s2           '*G"  
Memory