L i&ddlmZddlmZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZej"rdd lmZdd lmZdd lmZd$d ZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZ Gd d!e!Z"Gd"d#e!Z#y)%) annotationsN)gettext)ngettext)get_text_stderr)resolve_color_default)echo)format_filename)Command)Context) ParametercZ|(t|tsdjd|DS|S)Nz / c32K|]}t|ywN)repr).0xs V/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/click/exceptions.py z$_join_param_hints..s6a$q'6s) isinstancestrjoin) param_hints r_join_param_hintsrs,jS&Azz6:666 cBeZdZdZdZdfd ZddZddZd d dZxZ S) ClickExceptionz8An exception that Click can handle and show to the user.rcPt||t|_||_yr)super__init__r show_colormessage)selfr" __class__s rr zClickException.__init__ s# !(='> rc|jSrr"r#s rformat_messagezClickException.format_message' ||rc|jSrr&r's r__str__zClickException.__str__*r)rc| t}ttdj|j ||j y)NError: {message}r&filecolor)rr _formatr(r!r#r/s rshowzClickException.show-sA <"$D  ! ( (1D1D1F ( G// r)r"rreturnNoner5rrr/zt.IO[t.Any] | Noner5r6) __name__ __module__ __qualname____doc__ exit_coder r(r+r4 __classcell__r$s@rrrs&BI  rrc4eZdZdZdZddfd ZdddZxZS) 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. ct||||_|jr|jj|_yd|_yr)rr ctxcommandcmd)r#r"rDr$s rr zUsageError.__init__Cs4 !7;xx488#3#3Trc6| t}d}d}|j{|jjj|jLt dj |jj |jjd}|d}|jA|jj}t|jjd|||tt dj |j||y) Nz"Try '{command} {option}' for help.r)rEoption r.r-r&) rrDrEget_help_optionr1r2 command_pathhelp_option_namesr0r get_usager()r#r/r0hints rr4zUsageError.showHs <"$D HH   00:F9:AA--dhh6P6PQR6SBDV2;D 88 HHNNE DHH&&()D62U K  ! ( (1D1D1F ( G rr)r"rrDContext | Noner5r6r8)r9r:r;r<r=r r4r>r?s@rrArA8sIJ   rrAcFeZdZdZ d dfd 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. cBt|||||_||_yr)rr paramr)r#r"rDrTrr$s rr zBadParameter.__init__qs" #& $rc@|j |j}nW|j&|jj|j}n%t dj |j St dj t||j S)NzInvalid value: {message}r&z)Invalid value for {param_hint}: {message})rr")rrTget_error_hintrDr1r2r"r)r#rs rr(zBadParameter.format_message|s ?? &J ZZ #22488r?s@rrRrR_sM(#"&6: % % % % 4 %  %  rrRcVeZdZdZ d dfd 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'``. c@t||xsd|||||_y)NrH)rr param_type)r#r"rDrTrr^r$s rr zMissingParameter.__init__s# BUJ?$rc|j |j}n4|j&|jj|j}nd}t |}|rd|nd}|j }|"|j|jj }|j}|jJ|jjj|j|j}|r |r |d|z }n|}|rd|nd}|dk(r td}n=|dk(r td}n,|d k(r td }ntd j| }||d |S)N rH)rTrDz. argumentzMissing argumentrIzMissing option parameterzMissing parameterzMissing {param_type})r^.) rrTrVrDrr^param_type_namer"typeget_missing_messager1r2)r#rr^msg msg_extramissings rr(zMissingParameter.format_messagesP ?? &:>//J ZZ #22488>*>U U<< r)NNNNN) r" str | NonerDrPrTrXrrYr^rmr5r6r7)r9r:r;r<r r(r+r>r?s@rr\r\sc #""&6:!% % % % % 4 %  %  %&.P rr\cFeZdZdZ d dfd ZddZxZS) NoSuchOptionzfRaised if click attempted to handle an option that does not exist. .. versionadded:: 4.0 c||tdj|}t| ||||_||_y)NzNo such option: {name})rl)r1r2rr option_name possibilities)r#rqr"rrrDr$s rr zNoSuchOption.__init__sB ?0188k8JG #&&*rc|js |jSdjt|j}t ddt |jj ||}|jd|S)Nz, zDid you mean {possibility}?z#(Possible options: {possibilities})) possibilityrrr`)rrr"rsortedrlenr2)r#possibility_strsuggests rr(zNoSuchOption.format_messagesv!!<< ))F4+=+=$>? ) 1 "" #  &_O& L  ,,q **rrW) rqrr"rmrrzcabc.Sequence[str] | NonerDrPr5r6r7rZr?s@rrorosM#37" + + +1 +  +  + +rroc6eZdZdZ d dfd 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. c4t|||||_yr)rr rq)r#rqr"rDr$s rr zBadOptionUsage.__init__s #&&rr)rqrr"rrDrPr5r6)r9r:r;r<r r>r?s@rrzrzs9EI''),'3A' ''rrzceZdZdZy)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 Nr9r:r;r<rrr}r}srr}c*eZdZdfd ZdddZxZS)NoArgsIsHelpErrorcH|t||j|y)N)rD)rr get_help)r#rDr$s rr zNoArgsIsHelpError.__init__ s  S1rcft|j|d|jjy)NT)r/errr0)r r(rDr0r3s rr4zNoArgsIsHelpError.shows! T "4txx~~Nr)rDr r5r6rr8)r9r:r;r r4r>r?s@rrr s2OOrrc.eZdZdZddfd ZddZxZS) FileErrorz"Raised if a file cannot be opened.cl| td}t| |t||_||_y)Nz unknown error)r1rr r ui_filenamefilename)r#rrOr$s rr zFileError.__init__s3 <_%D  / 9  rcbtdj|j|jS)Nz+Could not open file {filename!r}: {message})rr")r1r2rr"r's rr(zFileError.format_message s0>?FF%%t||G  rr)rrrOrmr5r6r7rZr?s@rrrs,! rrceZdZdZy)Abortz=An internal signalling exception that signals Click to abort.Nr~rrrrr&sGrrceZdZdZdZdddZy)ExitzAn exception that indicates that the application should exit with some status code. :param code: the status code to exit with. r=c||_yrr)r#codes rr z Exit.__init__3s "rN)r)rintr5r6)r9r:r;r< __slots__r rrrrr*s I#rr)rrYr5rm)$ __future__rcollections.abcabccabctypingtrr1r_compatrglobalsrutilsr r TYPE_CHECKINGcorer r r r ExceptionrrArRr\rorzr}rr RuntimeErrorrrrrrrs" $*"?? Y <$ $ N' :' TD |D N+:+D'Z'"zO O  "HLH #< #r