;i&ddlmZddlmZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZejrdd lmZdd lmZdd lmZd(dZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGd d!eZGd"d#eZ Gd$d%e!Z"Gd&d'e!Z#dS))) annotationsN)gettext)ngettext)get_text_stderr)resolve_color_default)echo)format_filename)Command)Context) Parameter param_hintcabc.Sequence[str] | str | Nonereturn str | Nonecr|4t|tsdd|DS|S)Nz / c34K|]}t|VdSN)repr).0xs DC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\click/exceptions.py z$_join_param_hints..s(66a$q''666666) isinstancestrjoin)rs r_join_param_hintsrs>jS&A&Azz66:666666 rcBeZdZdZdZdfd ZddZdd Zddd ZxZ S)ClickExceptionz8An exception that Click can handle and show to the user.rmessagerrNonec~t|t|_||_dSr)super__init__r show_colorr!)selfr! __class__s rr%zClickException.__init__ s5 !!!(='>'> rc|jSrr!r's rformat_messagezClickException.format_message' |rc|jSrr*r+s r__str__zClickException.__str__*r-rNfilet.IO[t.Any] | Nonec|t}ttd|||jdS)NError: {message}r*r0color)rr _formatr,r&r'r0s rshowzClickException.show-sd <"$$D  ! ! ( (1D1D1F1F ( G G/      r)r!rrr"rrrr0r1rr") __name__ __module__ __qualname____doc__ exit_coder%r,r/r9 __classcell__r(s@rr r sBBI         rr c4eZdZdZdZddfd Zddd ZxZS) 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. Nr!rctxContext | Nonerr"ct|||_|jr |jjnd|_dSr)r$r%rFcommandcmd)r'r!rFr(s rr%zUsageError.__init__Cs> !!!7;x#I48#3#3Trr0r1c|t}d}d}|jg|jj|jCt d|jj|jjd}|d}|j:|jj}t|j d|||tt d| ||dS) Nz"Try '{command} {option}' for help.r)rIoption r4r3r*) rrFrIget_help_optionr6r7 command_pathhelp_option_namesr5r get_usager,)r'r0r5hints rr9zUsageError.showHs <"$$D H  00::F9::AA-dh6PQR6SBD;;;D 8 HNE DH&&((22D22U K K K K  ! ! ( (1D1D1F1F ( G G      rr)r!rrFrGrr"r;)r<r=r>r?r@r%r9rArBs@rrDrD8ssIJJJJJJJ          rrDc4eZdZdZ ddfd ZddZxZS) 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. Nr!rrFrGparamParameter | Nonerrrr"cht||||_||_dSr)r$r%rVr)r'r!rFrVrr(s rr%zBadParameter.__init__qs1 #&&& $rc*|j|j}nO|j |j|j}n(t d|jSt dt||jS)NzInvalid value: {message}r*z)Invalid value for {param_hint}: {message})rr!)rrVget_error_hintrFr6r7r!r)r'rs rr,zBadParameter.format_message|s ? &JJ Z #2248<r?r%r,rArBs@rrUrU_sk(#"&6: % % % % % % %         rrUc@eZdZdZ ddfd ZddZddZxZS)MissingParameteraRaised 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'``. Nr!rrFrGrVrWrr param_typerr"cbt|pd|||||_dS)NrL)r$r%r_)r'r!rFrVrr_r(s rr%zMissingParameter.__init__s2 BUJ???$rrcX|j|j}n)|j |j|j}nd}t |}|rd|nd}|j}||j |jj}|j}|j:|jj |j|j}|r |r |d|z }n|}|rd|nd}|dkrtd}nO|dkrtd}n9|d krtd }n#td  | }||d |S)N rL)rVrFz. argumentzMissing argumentrMzMissing option parameterzMissing parameterzMissing {param_type})r_.) rrVrZrFrr_param_type_namer!typeget_missing_messager6r7)r'rr_msg msg_extramissings rr,zMissingParameter.format_messages} ? &:>/JJ Z #2248<>*>UU U< r)NNNNN) r!rrFrGrVrWrrr_rrr"r:)r<r=r>r?r%r,r/rArBs@rr^r^s  #""&6:!% % % % % % % %&.&.&.&.P        rr^c4eZdZdZ ddfd ZddZxZS) NoSuchOptionzfRaised if click attempted to handle an option that does not exist. .. versionadded:: 4.0 N option_namerr!r possibilitiescabc.Sequence[str] | NonerFrGrr"c|#td|}t||||_||_dS)NzNo such option: {name})rn)r6r7r$r%rqrr)r'rqr!rrrFr(s rr%zNoSuchOption.__init__sY ?01188k8JJG #&&&&*rc|js|jSdt|j}t ddt |j||}|jd|S)Nz, zDid you mean {possibility}?z#(Possible options: {possibilities})) possibilityrrrb)rrr!rsortedrlenr7)r'possibility_strsuggests rr,zNoSuchOption.format_messages! < ))F4+=$>$>?? ) 1 " # #   &_O& L L  ,*****rr[) rqrr!rrrrsrFrGrr"r:r\rBs@rrprpsk#37" + + + + + + + + + + + + + + +rrpc(eZdZdZ d d fd ZxZS) 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. Nrqrr!rFrGrr"cZt||||_dSr)r$r%rq)r'rqr!rFr(s rr%zBadOptionUsage.__init__s- #&&&&rr)rqrr!rrFrGrr")r<r=r>r?r%rArBs@rr|r|sSEI'''''''''''rr|ceZdZdZdS)BadArgumentUsagezRaised 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 Nr<r=r>r?rrrrsrrc*eZdZd fd Zd d d ZxZS) NoArgsIsHelpErrorrFr rr"cv|t||dS)N)rF)r$r%get_help)r'rFr(s rr%zNoArgsIsHelpError.__init__ s4  S11111rNr0r1cdt||d|jjdS)NT)r0errr5)r r,rFr5r8s rr9zNoArgsIsHelpError.shows/ T " "4tx~NNNNNNr)rFr rr"rr;)r<r=r>r%r9rArBs@rrr s_222222OOOOOOOOOrrc.eZdZdZd d fd Zd d ZxZS) FileErrorz"Raised if a file cannot be opened.NfilenamerrSrrr"c|td}t|t||_||_dS)Nz unknown error)r6r$r%r ui_filenamer)r'rrSr(s rr%zFileError.__init__sH <_%%D  / 9 9  rc^td|j|jS)Nz+Could not open file {filename!r}: {message})rr!)r6r7rr!r+s rr,zFileError.format_message s3>??FF%t|G   rr)rrrSrrr"r:r\rBs@rrrs\,,!!!!!!!        rrceZdZdZdS)Abortz=An internal signalling exception that signals Click to abort.Nrrrrrr&sGGGGrrc eZdZdZdZd d dZd S) ExitzAn exception that indicates that the application should exit with some status code. :param code: the status code to exit with. r@rcodeintrr"c||_dSrr)r'rs rr%z Exit.__init__3s "rN)r)rrrr")r<r=r>r? __slots__r%rrrrr*s> I#######rr)rrrr)$ __future__rcollections.abcabccabctypingtrr6r_compatrglobalsrutilsr r TYPE_CHECKINGcorer r r r Exceptionr rDrUr^rpr|rrr RuntimeErrorrrrrrrs"""""" $$$$$$******""""""?      Y   <$ $ $ $ $ $ $ $ N' ' ' ' ' :' ' ' TD D D D D |D D D N+++++:+++D'''''Z'''"zOOOOO OOO        "HHHHHLHHH # # # # #< # # # # #r