Dd9$ddlZddlmZddlmZddlmZddlmZddlm Z ejrddl m Z dd l m Z dd l mZd ejej ej"eefd ejefd ZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGd d!eZy)"N)gettext)ngettext)get_text_stderr)echo)format_filename)Command)Context) Parameter param_hintreturncZ|(t|tsdjd|DS|S)Nz / c32K|]}t|ywN)repr).0xs 2/usr/lib/python3/dist-packages/click/exceptions.py z$_join_param_hints..s6a$q'6s) isinstancestrjoin)r s r_join_param_hintsrs.jS&Azz6:666 ceZdZdZdZdeddffd ZdefdZdefdZd d e je je jddfd Z xZS) ClickExceptionz8An exception that Click can handle and show to the user.rmessager Nc2t||||_yr)super__init__r)selfr __class__s rr zClickException.__init__s ! rc|jSrrr!s rformat_messagezClickException.format_message" ||rc|jSrr$r%s r__str__zClickException.__str__%r'rfilec| t}ttdj|j |y)NError: {message}r$)r*)rr_formatr&)r!r*s rshowzClickException.show(s6 <"$D Q! " ) )$2E2E2G ) HtTrr)__name__ __module__ __qualname____doc__ exit_coderr r&r)tOptionalIOAnyr/ __classcell__r"s@rrrscBIUADDK0UDUrrceZdZdZdZd dedejdddffd Zd d ejejejddfd Z xZ S) 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. Nrctxr r ct||||_|jr|jj|_yd|_yr)rr r>commandcmd)r!rr>r"s rr zUsageError.__init__:s4 !>Bhh$((*:*:Drr*c6| 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)r@option )r*colorr,r$) rr>r@get_help_optionr-r. command_pathhelp_option_namesrFr get_usager&)r!r*rFhints rr/zUsageError.show?s <"$D HH   00:F9:AA--dhh6P6PQR6SBDV2;D 88 HHNNE DHH&&()D62U K  ! ( (1D1D1F ( G rr) r0r1r2r3r4rr5r6r r7r8r/r9r:s@rr<r</s^IQQ!**Y*?Q4Q  ADDK0 D rr<c eZdZdZ d dedej ddej ddej ed df fd Zd efd ZxZ S) 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. Nrr>r paramr r r cBt|||||_||_yr)rr rNr )r!rr>rNr r"s rr zBadParameter.__init__hs" #& $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})r r)r rNget_error_hintr>r-r.rr)r!r s rr&zBadParameter.format_messagess ?? &J ZZ #22488r rNr r param_typer c@t||xsd|||||_y)NrC)rr rV)r!rr>rNr rVr"s rr zMissingParameter.__init__s# BUJ?$rc|j |j}n4|j&|jj|j}nd}t |}|rd|nd}|j }|"|j|jj }|j}|j>|jjj|j}|r |r |d|z }n|}|rd|nd}|dk(r td}n=|dk(r td}n,|dk(r td }ntd j| }||d |S) N rCz. argumentzMissing argumentrDzMissing option parameterzMissing parameterzMissing {param_type})rV.) r rNrQr>rrVparam_type_namertypeget_missing_messager-r.)r!r rVmsg msg_extramissings rr&zMissingParameter.format_messages@ ?? &*.//J ZZ #22488>*>U U<< r)NNNNN) r0r1r2r3r5r6rr r&r)r9r:s@rrUrUs $(%))-&*&* %C %ZZ " %zz+& % JJsO % JJsO %  %$.$.L  rrUc eZdZdZ d dedej edej ejedej dddf fd Zdefd Z xZ S) NoSuchOptionzfRaised if click attempted to handle an option that does not exist. .. versionadded:: 4.0 N option_namer possibilitiesr>r r c||tdj|}t| ||||_||_y)NzNo such option: {name})re)r-r.rr rhri)r!rhrrir>r"s rr zNoSuchOption.__init__sB ?0188k8JG #&&*rc|js |jSdjt|j}t ddt |jj ||}|jd|S)Nz, zDid you mean {possibility}?z#(Possible options: {possibilities})) possibilityrirY)rirrsortedrlenr.)r!possibility_strsuggests rr&zNoSuchOption.format_messagesv!!<< ))F4+=+=$>? ) 1 "" #  &_O& L  ,,q **rrR) r0r1r2r3rr5r6Sequencer r&r9r:s@rrgrgsv$(59%) + +C +zz!**S/2 + ZZ " +  + + +rrgc ReZdZdZ d dededej dddffd 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. Nrhrr>r r c4t|||||_yr)rr rh)r!rhrr>r"s rr zBadOptionUsage.__init__s #&&rr) r0r1r2r3rr5r6r r9r:s@rrsrssBLP''),'34::i3H' ''rrsceZdZdZy)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 Nr0r1r2r3rrrvrvsrrvcXeZdZdZddedej eddffd ZdefdZxZ S) FileErrorz"Raised if a file cannot be opened.NfilenamerKr cl| td}t| |t||_||_y)Nz unknown error)r-rr r ui_filenamer{)r!r{rKr"s rr zFileError.__init__s3 <_%D  / 9  rcbtdj|j|jS)Nz+Could not open file {filename!r}: {message})r{r)r-r.r}rr%s rr&zFileError.format_message s0>?FF%%t||G  rrrSr:s@rrzrzs4,!!AJJsO!t!  rrzceZdZdZy)Abortz=An internal signalling exception that signals Click to abort.NrwrxrrrrsGrrc&eZdZdZdZddeddfdZy)ExitzAn exception that indicates that the application should exit with some status code. :param code: the status code to exit with. r4coder Nc||_yrr)r!rs rr z Exit.__init__s "r)r)r0r1r2r3 __slots__intr rxrrrrs! I#S##rr) typingr5rr-r_compatrutilsrr TYPE_CHECKINGcorer r r r6Unionrqrr Exceptionrr<rMrUrgrsrvrz RuntimeErrorrrrxrrrs $"?? 1771::c?C#789ZZ_UYU.$ $ N' :' TB |B J+:+D'Z'"z  "HLH #< #r