XjV.ddlmZddlmZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZej"rdd lmZdd lmZdd lmZd'd Zd(dZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZ Gdd eZ!Gd!d"eZ"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|ywNrepr).0xs d/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/click/exceptions.py z$_join_param_hints..s6a$q'6) isinstancestrjoin) param_hints r_join_param_hintsrs,jS&Azz6:666 cdjdt|D}tddt|j ||S)Nz, c32K|]}t|ywrr)rps rrz(_format_possibilities..sGAQGrzDid you mean {possibility}?z'(Did you mean one of: {possibilities}?)) possibility possibilities)rsortedrlenformat)r"possibility_strs r_format_possibilitiesr'sGiiG 1FGGO %1 M  ffH IrcbeZdZUdZdZded<ded<ded<d fd Zdd Zdd Zddd Z xZ S)ClickExceptionz8An exception that Click can handle and show to the user.rt.ClassVar[int] exit_codezt.Final[bool | None] show_color t.Final[str]messagecPt||t|_||_yr)super__init__rr,r.)selfr. __class__s rr1zClickException.__init__,s# !01 rc|jSrr.r2s rformat_messagezClickException.format_message3 ||rc|jSrr5r6s r__str__zClickException.__str__6r8rc| t}ttdj|j ||j y)NError: {message}r5filecolor)rr _r%r7r,r2r>s rshowzClickException.show9sA <"$D  ! ( (1D1D1F ( G// r)r.rreturnNonerCrrr>zt.IO[t.Any] | NonerCrD) __name__ __module__ __qualname____doc__r+__annotations__r1r7r:rB __classcell__r3s@rr)r)#s7B"#I"$$   rr)cTeZdZUdZdZded<ded<ded<d d fd Zd d d 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. r*r+Context | Nonectxzt.Final[Command | None]cmdct||||_|jr|jj|_yd|_yr)r0r1rRcommandrS)r2r.rRr3s rr1zUsageError.__init__Rs4 !'+xx488##Trc| t}d}d}|j|jjj|js|jjj |j}t dj |jjt|t}|d}|jA|jj}t|jjd|||tt dj |j||y) Nz"Try '{command} {option}' for help.)key)rUoption r=r<r5)rrRrUget_help_optionget_help_option_namesr@r% command_pathmaxr$r?r get_usager7)r2r>r?hint help_namess rrBzUsageError.showWs  <"$D HH   00:F))??IJ9:AA--:3/BDV2;D 88 HHNNE DHH&&()D62U K  ! ( (1D1D1F ( G rr)r.rrRrQrCrDrF) rGrHrIrJr+rKr1rBrLrMs@rrOrODs/"#I"   :   rrOc\eZdZUdZded<ded< d d fd Zd dZxZS) 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. Parameter | Noneparamcabc.Sequence[str] | str | NonercBt|||||_||_yr)r0r1rer)r2r.rRrerr3s rr1zBadParameter.__init__s" #& $rc@|j |j}nW|j&|jj|j}n%t dj |j St dj t||j S)NzInvalid value: {message}r5z)Invalid value for {param_hint}: {message})rr.)rreget_error_hintrRr@r%r.r)r2rs rr7zBadParameter.format_messages ?? &J ZZ #22488//J ZZ #22488>*>U U<< r)NNNNN) r. str | NonerRrQrerdrrfrnr~rCrDrE) rGrHrIrJrKr1r7r:rLrMs@rrmrmsk $##""&6:!% % % % % 4 %  %  %&.P rrmc\eZdZUdZded<ded< d d fd Zd dZxZS) NoSuchOptionzbRaised if Click attempted to handle an option that does not exist. .. versionadded:: 4.0 r- option_namet.Final[list[str] | None]r"c|tdj|}t| ||||_|rddlm}|||}||_yd}||_y)NzNo such option {name!r}.r}rget_close_matches)r@r%r0r1rdifflibrr")r2rr.r"rRrpossibilities_r3s rr1zNoSuchOption.__init__se ?23:: :LG #&&  1.{MJN,"N+rcz|js |jS|jdt|jSNrqr"r.r'r6s rr7zNoSuchOption.format_message7!!<< ,,q!6t7I7I!J KLLrrj) rrr.r~r"cabc.Iterable[str] | NonerRrQrCrDrErkrMs@rrrs\ ,, #37" ,,,1 ,  ,  ,*Mrrc\eZdZUdZded<ded< d d fd Zd dZxZS) NoSuchCommandzdRaised if Click attempted to handle a command that does not exist. .. versionadded:: 8.4.0 r- command_namerr"c|tdj|}t| ||||_|rddlm}|||}||_yd}||_y)NzNo such command {name!r}.rrr)r@r%r0r1rrrr")r2rr.r"rRrrr3s rr1zNoSuchCommand.__init__se ?34;;;NG #&(  1.|]KN,"N+rcz|js |jS|jdt|jSrrr6s rr7zNoSuchCommand.format_message*rrrj) rrr.r~r"rrRrQrCrDrErkrMs@rrr s\ ,, #37" ,,,1 ,  ,  ,*MrrcBeZdZUdZded< 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. r-rc4t|||||_yr)r0r1r)r2rr.rRr3s rr1zBadOptionUsage.__init__<s #&&rr)rrr.rrRrQrCrD)rGrHrIrJrKr1rLrMs@rrr0sAEI''),'3A' ''rrceZdZdZy)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 NrGrHrIrJrrrrCsrrc6eZdZUded<dfd ZdddZxZS)NoArgsIsHelpErrorr rRcDt||j|y)N)rR)r0r1get_help)r2rRr3s rr1zNoArgsIsHelpError.__init__Os S1rcft|j|d|jjy)NT)r>errr?)r r7rRr?rAs rrBzNoArgsIsHelpError.showRs! T "4txx~~Nr)rRr rCrDrrF)rGrHrIrKr1rBrLrMs@rrrLs L2OOrrcDeZdZUdZded<ded<ddfd Zd dZxZS) FileErrorz"Raised if a file cannot be opened.r- ui_filenamefilenamecl| td}t| |t||_||_y)Nz unknown error)r@r0r1r rr)r2rr`r3s rr1zFileError.__init__\s3 <_%D *84  rcbtdj|j|jS)Nz+Could not open file {filename!r}: {message})rr.)r@r%rr.r6s rr7zFileError.format_messageds0>?FF%%t||G  rr)rrr`r~rCrDrErkrMs@rrrVs,! rrceZdZdZy)Abortz=An internal signalling exception that signals Click to abort.NrrrrrrjsGrrc*eZdZUdZdZded<dddZy) ExitzAn exception that indicates that the application should exit with some status code. :param code: the status code to exit with. r+z t.Final[int]r+c||_yrr)r2codes rr1z Exit.__init__ys rN)r)rintrCrD)rGrHrIrJ __slots__rKr1rrrrrns Irr)rrfrCr~)r"z list[str]rCr)& __future__rcollections.abcabccabctypingtrr@r_compatrglobalsrutilsr r TYPE_CHECKINGcorer r r rr' Exceptionr)rOrcrmrrrrrr RuntimeErrorrrrrrrs" $*"??I Y B+ + \* :* ZF |F R!M:!MH!MJ!MH'Z'&zO O  (HLH < r