Yc@s~ddlZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z ddl mZmZmZmZddlmZmZmZmZmZdd lmZmZdd lmZmZdd lmZm Z dd l!m"Z"m#Z#dd l$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*e+Z,dZ-dZ.e/dZ0e1dZ2dZ3dZ4ee/dZ5dZ6de+fdYZ7de+fdYZ8de8fdYZ9de9fdYZ:de:fd YZ;d!e:fd"YZ<d#e+fd$YZ=d%e=fd&YZ>d'e=fd(YZ?dd)l@mAZAmBZBdS(*iN(tcontextmanager(trepeat(tupdate_wrapperi(t convert_typetIntRangetBOOL(tmake_strtmake_default_short_helptechot get_os_args(tClickExceptiont UsageErrort BadParametertAborttMissingParameter(tprompttconfirm(t HelpFormattert join_options(t OptionParsert split_opt(t push_contextt pop_context(tPY2t isidentifiert iteritems(t_check_for_unicode_literalst_verify_python3_envsCOMMAND [ARGS]...s*COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...cCs|dkr+d|jddj}ntjj|}|sGdSddlm}|||||r|tj dndS(s1Internal handler for the bash completion support.s _%s_COMPLETEt-t_Ni(t bashcomplete( tNonetreplacetuppertostenvirontgett _bashcompleteRtsystexit(tcmdt prog_namet complete_vartcomplete_instrR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR%s c Csn|j st|t rdS|r-d}nd}td||j|||jj|jj|jfdS(NscIt is not possible to add multi commands as children to another multi command that is in chain modesdFound a multi command as subcommand to a multi command that is in chain mode. This is not supporteds%s. Command "%s" is set to chain and "%s" was added as subcommand but it in itself is a multi command. ("%s" is a %s within a chained %s named "%s"). This restriction was supposed to be lifted in 6.0 but the fix was flawed. This will be fixed in Click 7.0(tchaint isinstancet MultiCommandt RuntimeErrortnamet __class__t__name__(t base_commandtcmd_nameR(tregisterthint((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt_check_multicommand)s    cCstttt||S(N(tlisttzipRtiter(titerablet batch_size((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytbatch>scCswt|dd}t|dd}|dkrgddlm}|td|dd|||S||||S(Nt__code__t co_argcountii(twarns}Invoked legacy parameter callback "%s". The new signature for such callbacks starting with click 2.0 is (ctx, param, value).t stacklevel(tgetattrRtwarningsR@tWarning(tcallbacktctxtparamtvaluetcodetargsR@((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytinvoke_param_callbackBs   ccsy dVWntk rc}|jdkr6||_n|dk r]|jdkr]||_nn1tk r}|jdkr||_nnXdS(sPContext manager that attaches extra information to exceptions that fly. N(R RFRRGR (RFRGte((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytaugment_usage_errorsQs    csfd}t|d|S(sGiven a sequence of parameters in the order as should be considered for processing and an iterable of parameters that exist, this returns a list in the correct order as they should be processed. csAyj|}Wntk r2td}nX|j |fS(Ntinf(tindext ValueErrortfloattis_eager(titemtidx(tinvocation_order(s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytsort_keyis  tkey(tsorted(RUtdeclaration_orderRV((RUs]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytiter_params_for_processingdstContextcBseZdZdddddddedddddddZdZdZee dZ e dZ dZ dZdZe d Zd Zd Zd Zd ZdZdZddZdZdZdZdZRS(sCThe context is a special internal object that holds state relevant for the script execution at every single level. It's normally invisible to commands unless they opt-in to getting access to it. The context is useful as it can pass internal objects around and can control special execution features such as reading data from environment variables. A context can be used as context manager in which case it will call :meth:`close` on teardown. .. versionadded:: 2.0 Added the `resilient_parsing`, `help_option_names`, `token_normalize_func` parameters. .. versionadded:: 3.0 Added the `allow_extra_args` and `allow_interspersed_args` parameters. .. versionadded:: 4.0 Added the `color`, `ignore_unknown_options`, and `max_content_width` parameters. :param command: the command class for this context. :param parent: the parent context. :param info_name: the info name for this invocation. Generally this is the most descriptive name for the script or command. For the toplevel script it is usually the name of the script, for commands below it it's the name of the script. :param obj: an arbitrary object of user data. :param auto_envvar_prefix: the prefix to use for automatic environment variables. If this is `None` then reading from environment variables is disabled. This does not affect manually set environment variables which are always read. :param default_map: a dictionary (like object) with default values for parameters. :param terminal_width: the width of the terminal. The default is inherit from parent context. If no context defines the terminal width then auto detection will be applied. :param max_content_width: the maximum width for content rendered by Click (this currently only affects help pages). This defaults to 80 characters if not overridden. In other words: even if the terminal is larger than that, Click will not format things wider than 80 characters by default. In addition to that, formatters might add some safety mapping on the right. :param resilient_parsing: if this flag is enabled then Click will parse without any interactivity or callback invocation. This is useful for implementing things such as completion support. :param allow_extra_args: if this is set to `True` then extra arguments at the end will not raise an error and will be kept on the context. The default is to inherit from the command. :param allow_interspersed_args: if this is set to `False` then options and arguments cannot be mixed. The default is to inherit from the command. :param ignore_unknown_options: instructs click to ignore options it does not know and keeps them for later processing. :param help_option_names: optionally a list of strings that define how the default help parameter is named. The default is ``['--help']``. :param token_normalize_func: an optional function that is used to normalize tokens (options, choices, etc.). This for instance can be used to implement case insensitive behavior. :param color: controls if the terminal supports ANSI colors or not. The default is autodetection. This is only needed if ANSI codes are used in texts that Click prints which is by default not the case. This for instance would affect help output. cCs||_||_||_i|_g|_g|_|dkrZ|dk rZ|j}n||_t|di|_ |dkr|dk r|j dk r|j j |}n||_ d|_ |dkr|dk r|j }n||_ |dkr|dk r|j}n||_| dkr8|j} n| |_| dkrY|j} n| |_| dkrz|j} n| |_| dkr|dk r|j} qdg} n| |_|dkr|dk r|j}n||_| |_|dkrJ|dk rY|jdk rY|jdk rYd|j|jjf}qYn|j|_||_|dkr|dk r|j}n||_g|_d|_dS(Ntmetas--helps%s_%si(tparenttcommandt info_nametparamsRJtprotected_argsRtobjRBt_metat default_mapR$tinvoked_subcommandtterminal_widthtmax_content_widthtallow_extra_argstallow_interspersed_argstignore_unknown_optionsthelp_option_namesttoken_normalize_functresilient_parsingtauto_envvar_prefixR!tcolort_close_callbackst_depth(tselfR^R]R_RbRnRdRfRgRmRhRiRjRkRlRo((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt__init__sj                                      cCs|jd7_t||S(Ni(RqR(Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt __enter__Cs cCs6|jd8_|jdkr+|jntdS(Nii(RqtcloseR(Rrtexc_typet exc_valuettb((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt__exit__Hs ccsP|s|jd7_nz| }|VWdQXWd|sK|jd8_nXdS(sIThis helper method can be used with the context object to promote it to the current thread local (see :func:`get_current_context`). The default behavior of this is to invoke the cleanup functions which can be disabled by setting `cleanup` to `False`. The cleanup functions are typically used for things such as closing file handles. If the cleanup is intended the context object can also be directly used as a context manager. Example usage:: with ctx.scope(): assert get_current_context() is ctx This is equivalent:: with ctx: assert get_current_context() is ctx .. versionadded:: 5.0 :param cleanup: controls if the cleanup functions should be run or not. The default is to run these functions. In some situations the context only wants to be temporarily pushed in which case this can be disabled. Nested pushes automatically defer the cleanup. iN(Rq(Rrtcleanuptrv((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytscopeNs cCs|jS(sThis is a dictionary which is shared with all the contexts that are nested. It exists so that click utiltiies can store some state here if they need to. It is however the responsibility of that code to manage this dictionary well. The keys are supposed to be unique dotted strings. For instance module paths are a good choice for it. What is stored in there is irrelevant for the operation of click. However what is important is that code that places data here adheres to the general semantics of the system. Example usage:: LANG_KEY = __name__ + '.lang' def set_language(value): ctx = get_current_context() ctx.meta[LANG_KEY] = value def get_language(): return get_current_context().meta.get(LANG_KEY, 'en_US') .. versionadded:: 5.0 (Rc(Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR\tscCstd|jd|jS(s4Creates the formatter for the help and usage output.twidtht max_width(RRfRg(Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytmake_formatterscCs|jj||S(stThis decorator remembers a function as callback that should be executed when the context tears down. This is most useful to bind resource handling to the script execution. For instance, file objects opened by the :class:`File` type will register their close callbacks here. :param f: the function to execute on teardown. (Rptappend(Rrtf((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt call_on_closes cCs(x|jD] }|q Wg|_dS(sInvokes all close callbacks.N(Rp(Rrtcb((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRus cCsQd}|jdk r!|j}n|jdk rG|jjd|}n|jS(sThe computed command path. This is used for the ``usage`` information on the help page. It's automatically created by combining the info names of the chain of contexts to the root. tt N(R_RR]t command_pathtlstrip(RrR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs  cCs)|}x|jdk r$|j}q W|S(sFinds the outermost context.N(R]R(Rrtnode((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt find_roots cCs?|}x2|dk r:t|j|r.|jS|j}q WdS(s)Finds the closest object of a given type.N(RR-RbR](Rrt object_typeR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt find_objects cCs2|j|}|dkr.||_}n|S(sLike :meth:`find_object` but sets the innermost object to a new instance of `object_type` if it does not exist. N(RRRb(RrRR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt ensure_objects cCsA|jdk r=|jj|}t|r9|}n|SdS(s}Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available. N(RdRR$tcallable(RrR0R{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytlookup_defaults   cCst||dS(sAborts the execution of the program with a specific error message. :param message: the error message to fail with. N(R (Rrtmessage((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytfailscCs tdS(sAborts the script.N(R (Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytabortsicCstj|dS(s-Exits the application with a given exit code.N(R&R'(RrRI((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR'scCs|jj|S(saHelper method to get formatted usage string for the current context and command. (R^t get_usage(Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRscCs|jj|S(s^Helper method to get formatted help page for the current context and command. (R^tget_help(Rr((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRsc Os|d \}}|}t|tr|}|j}t|d|jd|}|dkrjtdnxE|jD]7}|j|krt|jrt|j |||j_COMPLETE"`` with prog name in uppercase. :param standalone_mode: the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to `False` they will be propagated to the caller and the return value of this function is the return value of :meth:`invoke`. :param extra: extra keyword arguments are forwarded to the context constructor. See :class:`Context` for more information. iNtfileisAborted!(RRRRR R8RR"tpathtbasenameR&targvt__file__R%RRR'tEOFErrortKeyboardInterruptRtstderrR R tshowt exit_codetIOErrorterrnotEPIPE( RrRJR)R*tstandalone_modeRRFR{RL((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytmain~sD%      %    cOs|j||S(sAlias for :meth:`main`.(R(RrRJR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt__call__sN(R2RRRRhRRiRjRRsRRRRRRR(((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR,s       QRc BseZdZdddddddedZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZRS(sCommands are the basic building block of command line interfaces in Click. A basic command handles command line parsing and might dispatch more parsing to commands nested below it. .. versionchanged:: 2.0 Added the `context_settings` parameter. :param name: the name of the command to use unless a group overrides it. :param context_settings: an optional dictionary with defaults that are passed to the context object. :param callback: the callback to invoke. This is optional. :param params: the parameters to register with this command. This can be either :class:`Option` or :class:`Argument` objects. :param help: the help string to use for this command. :param epilog: like the help string but it's printed at the end of the help page after everything else. :param short_help: the short help to use for this command. This is shown on the command listing of the parent command. :param add_help_option: by default each command registers a ``--help`` option. This can be disabled by this parameter. s [OPTIONS]c Cs}tj|||||_|p%g|_||_||_||_|dkrg|rgt|}n||_ | |_ dS(N( RRsRER`thelptepilogtoptions_metavarRRt short_helptadd_help_option( RrR0RRER`RRRRR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRss     cCs/|j}|j|||jjdS(Ns (Rt format_usagetgetvaluetrstrip(RrRFt formatter((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs cCs8|j}|j|}|dk r4||g}n|S(N(R`tget_help_optionR(RrRFR{t help_option((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt get_paramss   cCs/|j|}|j|jdj|dS(s)Writes the usage line into the formatter.RN(tcollect_usage_piecest write_usageRtjoin(RrRFRtpieces((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR scCs@|jg}x-|j|D]}|j|j|qW|S(shReturns all the pieces that go into the usage line and returns it as a list of strings. (RRtextendtget_usage_pieces(RrRFR{RG((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs cCsGt|j}x1|jD]&}|j|j|j|jqW|S(s&Returns the names for the help option.(tsetRkR`tdifference_updatetoptstsecondary_opts(RrRFt all_namesRG((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytget_help_option_namess c CsU|j|}| s |j r$dSd}t|dtdtdtd|ddS( sReturns the help option object.NcSs:|r6|j r6t|jd|j|jndS(NRo(RmRRRoR'(RFRGRH((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt show_help'stis_flagRRRRERsShow this message and exit.(RRtOptionRR(RrRFt help_optionsR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR!s  cCsRt|}|j|_|j|_x'|j|D]}|j||q4W|S(s6Creates the underlying option parser for this command.(RRiRjRt add_to_parser(RrRFtparserRG((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt make_parser0s    cCs/|j}|j|||jjdS(sFormats the help into a string and returns it. This creates a formatter and will call into the following formatting methods: s (Rt format_helpRR(RrRFR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR9s cCsD|j|||j|||j|||j||dS(sWrites the help into the formatter if it exists. This calls into the following methods: - :meth:`format_usage` - :meth:`format_help_text` - :meth:`format_options` - :meth:`format_epilog` N(Rtformat_help_texttformat_optionst format_epilog(RrRFR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRAs cCs=|jr9|j|j|j|jWdQXndS(s3Writes the help text to the formatter if it exists.N(Rtwrite_paragrapht indentationt write_text(RrRFR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRPs   cCs{g}xB|j|D]1}|j|}|dk r|j|qqW|rw|jd|j|WdQXndS(s8Writes all the options into the formatter if they exist.tOptionsN(Rtget_help_recordRRtsectiontwrite_dl(RrRFRRRGR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRWs cCs=|jr9|j|j|j|jWdQXndS(s2Writes the epilog into the formatter if it exists.N(RRRR(RrRFR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRcs   cCs|j|}|jd|\}}}x;t||j|D]!}|j|||\}}qCW|r|j r|j r|jdt|dkrdpddj t t |fn||_ |S(NRJs$Got unexpected extra argument%s (%s)itsRR( RRRZRthandle_parse_resultRhRmRtlenRtmapRRJ(RrRFRJRRt param_orderRGRH((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRjs   cCs)|jdk r%|j|j|jSdS(seGiven a context, this invokes the attached callback (if it exists) in the right way. N(RERRR`(RrRF((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRzsN(R2RRRRRsRRRRRRRRRRRRRR(((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs$           R.cBseZdZeZeZd ed d ed dZdZ dZ edZ dZ dZ dZdZd Zd ZRS( sA multi command is the basic implementation of a command that dispatches to subcommands. The most common version is the :class:`Group`. :param invoke_without_command: this controls how the multi command itself is invoked. By default it's only invoked if a subcommand is provided. :param no_args_is_help: this controls what happens if no arguments are provided. This option is enabled by default if `invoke_without_command` is disabled or disabled if it's enabled. If enabled this will add ``--help`` as argument if no arguments are passed. :param subcommand_metavar: the string that is used in the documentation to indicate the subcommand place. :param chain: if this is set to `True` chaining of multiple subcommands is enabled. This restricts the form of commands in that they cannot have optional arguments but it allows multiple commands to be chained together. :param result_callback: the result callback to attach to this multi command. c Kstj||||dkr)| }n||_||_|dkr_|rVt}q_t}n||_||_||_ |jrx<|j D].}t |t r|j rtdqqWndS(Ns<Multi commands in chain mode cannot have optional arguments.(RRsRtno_args_is_helptinvoke_without_commandtSUBCOMMANDS_METAVARtSUBCOMMAND_METAVARtsubcommand_metavarR,tresult_callbackR`R-tArgumenttrequiredR/( RrR0RRRR,RtattrsRG((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRss            cCs&tj||}|j|j|S(N(RRRR(RrRFR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRscCs'tj||||j||dS(N(RRtformat_commands(RrRFR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRscsfd}|S(smAdds a result callback to the chain command. By default if a result callback is already registered this will chain them but this can be disabled with the `replace` parameter. The result callback is invoked with the return value of the subcommand (or the list of return values from all subcommands if chaining is enabled) as well as the parameters as they would be passed to the main callback. Example:: @click.group() @click.option('-i', '--input', default=23) def cli(input): return 42 @cli.resultcallback() def process_result(result, input): return result + input .. versionadded:: 3.0 :param replace: if set to `True` an already existing result callback will be removed. csTjdksr(_Sfd}t|_}|S(Ncs|||||S(N((t_MultiCommand__valueRJR(Rt old_callback(s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytfunctions(RRR(RRR{(R Rr(RRs]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt decorators  ((RrR R((R Rrs]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytresultcallbacks cCsg}x]|j|D]L}|j||}|dkr@qn|jpLd}|j||fqW|r|jd|j|WdQXndS(seExtra format methods for multi methods that adds all the commands after the options. RtCommandsN(t list_commandst get_commandRRRRR(RrRFRtrowst subcommandR(R((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs cCs| r@|jr@|j r@t|jd|j|jntj|||}|jrs||_ g|_ n$|r|d |d|_ |_ n|j S(NRoi( RRmRRRoR'RRR,RaRJ(RrRFRJtrest((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRs    c sfd}jswjrgjs=tjStj|gSWdQXnjdnjj}g_g_js!tj|\}}}|_tj|j ||d}|||j j|SWdQXWdQXn|r4dp7d_tjg}xi|rj|\}}}|j ||ddt dt }|j||jg}|_qVWg}x4|D],}||j|j j|WdQXqW||SWdQXdS(Ncs1jdk r-jj|j}n|S(N(RRRR`(RH(RFRr(s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt_process_resultssMissing command.R]t*RhRi(RaRR,RRRRJtresolve_commandReRR^RRRR( RrRFRRJR4R(tsub_ctxtcontextsR{((RFRrs]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRsH       %    #cCst|d}|}|j||}|dkrg|jdk rg|j|}|j||}n|dkrt|dr|j||jn|jd|n|||dfS(NisNo such command "%s".i(RRRRlRRRJR(RrRFRJR4toriginal_cmd_nameR(((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRGs cCs tdS(s{Given a context and a command name, this returns a :class:`Command` object if it exists or returns `None`. N(R(RrRFR4((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRascCsgS(sTReturns a list of subcommand names in the order they should appear. ((RrRF((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRgsN(R2RRRRhRRiRRsRRRRRRRRR(((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR.s   %   D  tGroupcBsMeZdZdddZddZdZdZdZdZ RS(sA group allows a command to have subcommands attached. This is the most common way to implement nesting in Click. :param commands: a dictionary of commands. cKs&tj||||pi|_dS(N(R.Rstcommands(RrR0RR((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRsuscCsQ|p |j}|dkr*tdnt|||dt||j| 1.c3s*|] }j|pdVqdS(N((R(t.0tx(RFRr(s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pys 9scsBdkrj|Stfd|p:dDS(Nic3s"|]}|dVqdS(iN((RR(t_converttlevel(s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pys ?s((Rttuple(RHR (RRFRr(R s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR<s (((RRRRRR!tbool(RrRFRH((RRFRrs]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyR-s  #cCs |dk r|j||SdS(saGiven a value and context this runs the logic to convert the value as necessary. N(RR(RrRFRH((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyt process_valueBs cCs<|dkrtS|jdks(|jr8|dkr8tStS(Ni((RRRRR(RrRH((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytvalue_is_missingMs  $cCsd|j||}|dkr0|j|}n|jr`|j|r`td|d|n|S(NRFRG(R#RRRR$R(RrRFRH((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytfull_process_valueTs  cCs{|jdkrdSt|jttfrdxI|jD](}tjj|}|dk r5|Sq5Wntjj|jSdS(N(RRR-R!R8R"R#R$(RrRFRR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pytresolve_envvar_value_s  cCsC|j|}|dk r?|jdkr?|jj|}n|S(Ni(R&RRRtsplit_envvar_value(RrRFR{((s]/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/click/click/core.pyRjsc Cst|d||j||}y|j||}Wn&tk rc|jsZnd}nX|jdk ryt|j|||}Wqtk r|jsqqXnWdQX|jr||j |j