[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.146.107.49: ~ $


��W��@s�ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
mZmZmZddlmZmZmZmZmZdd	lmZmZdd
lmZmZddlmZmZddl m!Z!m"Z"dd
l#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)e*�Z+dZ,dZ-ddd�Z.ddd�Z/dd�Z0dd�Z1eddd��Z2dd�Z3Gdd�de*�Z4Gd d!�d!e*�Z5Gd"d#�d#e5�Z6Gd$d%�d%e6�Z7Gd&d'�d'e7�Z8Gd(d)�d)e7�Z9Gd*d+�d+e*�Z:Gd,d-�d-e:�Z;Gd.d/�d/e:�Z<dd0l=m>Z>m?Z?dS)1�N)�contextmanager)�repeat)�update_wrapper�)�convert_type�IntRange�BOOL)�make_str�make_default_short_help�echo�get_os_args)�ClickException�
UsageError�BadParameter�Abort�MissingParameter)�prompt�confirm)�
HelpFormatter�join_options)�OptionParser�	split_opt)�push_context�pop_context)�PY2�isidentifier�	iteritems)�_check_for_unicode_literals�_verify_python3_envzCOMMAND [ARGS]...z*COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...cCsz|dkr(d|jdd�j�}tjj|�}|sDdSddlm}|||||�rvtjd�dS)z1Internal handler for the bash completion support.Nz_%s_COMPLETE�-�_r)�bashcomplete)	�replace�upper�os�environ�get�
_bashcompleter!�sys�exit)�cmd�	prog_name�complete_varZcomplete_instrr!�r-�/core.pyr'sr'Fc	Csn|jst|t�rdS|r-d}nd}td||j|||jj|jj|jf��dS)NzcIt is not possible to add multi commands as children to another multi command that is in chain modezdFound a multi command as subcommand to a multi command that is in chain mode.  This is not supporteda%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)�chain�
isinstance�MultiCommand�RuntimeError�name�	__class__�__name__)Zbase_command�cmd_namer*�registerZhintr-r-r.�_check_multicommand(s		r8cCstttt|�|���S)N)�list�zipr�iter)�iterableZ
batch_sizer-r-r.�batch=sr=cCswt|dd�}t|dd�}|dkrgddlm}|td|�dd�|||�S||||�S)N�__code__�co_argcount�r)�warnz}Invoked legacy parameter callback "%s".  The new signature for such callbacks starting with click 2.0 is (ctx, param, value).�
stacklevel)�getattr�warningsrA�Warning)�callback�ctx�param�value�code�argsrAr-r-r.�invoke_param_callbackAs	
rLccs�y	dVWn�tk
ro}zD|jdkr6||_|dk	rZ|jdkrZ||_�WYdd}~Xn@tk
r�}z |jdkr�||_�WYdd}~XnXdS)zPContext manager that attaches extra information to exceptions that
    fly.
    N)rrGrHr)rGrH�er-r-r.�augment_usage_errorsPs				rNcs"�fdd�}t|d|�S)z�Given 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.
    csBy�j|�}Wntk
r3td�}YnX|j|fS)N�inf)�index�
ValueError�float�is_eager)�item�idx)�invocation_orderr-r.�sort_keyhs

z,iter_params_for_processing.<locals>.sort_key�key)�sorted)rVZdeclaration_orderrWr-)rVr.�iter_params_for_processingcsrZc@sHeZdZdZdddddddddddddddd�Zdd�Zdd	�Zed
dd��Ze	d
d��Z
dd�Zdd�Zdd�Z
e	dd��Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�ZdS).�ContextaCThe 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.
    NFcCs�||_||_||_i|_g|_g|_|dkrW|dk	rW|j}||_t|di�|_|dkr�|dk	r�|j	dk	r�|j	j
|�}||_	d|_|dkr�|dk	r�|j}||_|dkr|dk	r|j
}||_
|
dkr)|j}
|
|_|dkrG|j}||_|dkre|j}||_|
dkr�|dk	r�|j}
n	dg}
|
|_|dkr�|dk	r�|j}||_|	|_|dkr,|dk	r;|jdk	r;|jdk	r;d|j|jj�f}n|j�|_||_|dkre|dk	re|j}||_g|_d|_dS)N�metaz--helpz%s_%sr)�parent�command�	info_name�paramsrK�protected_args�objrC�_meta�default_mapr&�invoked_subcommand�terminal_width�max_content_width�allow_extra_args�allow_interspersed_args�ignore_unknown_options�help_option_names�token_normalize_func�resilient_parsing�auto_envvar_prefixr#�color�_close_callbacks�_depth)�selfr^r]r_rbrnrdrfrgrmrhrirjrkrlror-r-r.�__init__�sj																															zContext.__init__cCs|jd7_t|�|S)Nr)rqr)rrr-r-r.�	__enter__Bs
zContext.__enter__cCs3|jd8_|jdkr(|j�t�dS)Nrr)rq�closer)rr�exc_type�	exc_value�tbr-r-r.�__exit__Gs
zContext.__exit__TccsK|s|jd7_z|�}|VWdQRXWd|sF|jd8_XdS)aIThis 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.
        rN)rq)rr�cleanup�rvr-r-r.�scopeMs	z
Context.scopecCs|jS)a�This 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)rrr-r-r.r\sszContext.metacCstd|jd|j�S)z4Creates the formatter for the help and usage output.�widthZ	max_width)rrfrg)rrr-r-r.�make_formatter�szContext.make_formattercCs|jj|�|S)atThis 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.
        )rp�append)rr�fr-r-r.�
call_on_close�s	zContext.call_on_closecCs(x|jD]
}|�q
Wg|_dS)zInvokes all close callbacks.N)rp)rr�cbr-r-r.ru�sz
Context.closecCsKd}|jdk	r|j}|jdk	rA|jjd|}|j�S)z�The 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.
        �N� )r_r]�command_path�lstrip)rrr{r-r-r.r��s	zContext.command_pathcCs)|}x|jdk	r$|j}q	W|S)zFinds the outermost context.N)r])rr�noder-r-r.�	find_root�s
zContext.find_rootcCs?|}x2|dk	r:t|j|�r.|jS|j}q	WdS)z)Finds the closest object of a given type.N)r0rbr])rr�object_typer�r-r-r.�find_object�s
zContext.find_objectcCs/|j|�}|dkr+|�|_}|S)z�Like :meth:`find_object` but sets the innermost object to a
        new instance of `object_type` if it does not exist.
        N)r�rb)rrr�r{r-r-r.�
ensure_object�szContext.ensure_objectcCs>|jdk	r:|jj|�}t|�r6|�}|SdS)z}Looks up the default for a parameter name.  This by default
        looks into the :attr:`default_map` if available.
        N)rdr&�callable)rrr3r{r-r-r.�lookup_default�s
	zContext.lookup_defaultcCst||��dS)z�Aborts the execution of the program with a specific error
        message.

        :param message: the error message to fail with.
        N)r)rr�messager-r-r.�fail�szContext.failcCs
t��dS)zAborts the script.N)r)rrr-r-r.�abort�sz
Context.abortrcCstj|�dS)z-Exits the application with a given exit code.N)r(r))rrrJr-r-r.r)�szContext.exitcCs|jj|�S)zaHelper method to get formatted usage string for the current
        context and command.
        )r^�	get_usage)rrr-r-r.r��szContext.get_usagecCs|jj|�S)z^Helper method to get formatted help page for the current
        context and command.
        )r^�get_help)rrr-r-r.r��szContext.get_helpcOs�|dd�\}}|}t|t�r�|}|j}t|d|jd|�}|dkrmtd��x?|jD]4}|j|krw|jrw|j|�||j<qwW|dd�}t	|�� |�|||�SWdQRXWdQRXdS)a"Invokes a command callback in exactly the way it expects.  There
        are two ways to invoke this method:

        1.  the first argument can be a callback and all other arguments and
            keyword arguments are forwarded directly to the function.
        2.  the first argument is a click command object.  In that case all
            arguments are forwarded as well but proper click parameters
            (options and click arguments) must be keyword arguments and Click
            will fill in defaults.

        Note that before Click 3.2 keyword arguments were not properly filled
        in against the intention of this code and no context was created.  For
        more information about this change and why it was done in a bugfix
        release see :ref:`upgrade-to-3.2`.
        N�r_r]z?The given command does not have a callback that can be invoked.)
r0�CommandrFr[r3�	TypeErrorr`�expose_value�get_defaultrN)rK�kwargsrrrFrGZ	other_cmdrHr-r-r.�invoke�s	
zContext.invokecOsr|dd�\}}t|t�s1td��x.|jD]#}||kr;|j|||<q;W|j||�S)z�Similar to :meth:`invoke` but fills in default keyword
        arguments from the current context if the other command expects
        it.  This cannot invoke callbacks directly, only other commands.
        Nr�zCallback is not a command.)r0r�r�r`r�)rKr�rrr*rHr-r-r.�forwardszContext.forward)r5�
__module__�__qualname__�__doc__rsrtryrr|�propertyr\r~r�rur�r�r�r�r�r�r�r)r�r�r�r�r-r-r-r.r[rs8M	{%
	
'r[c@s�eZdZdZdZdZdZddd�Zdd�Zd	d
�Z	ddd�Z
d
d�Zdd�Zdddddd�Z
dd�ZdS)�BaseCommanda�The base command implements the minimal API contract of commands.
    Most code will never use this as it does not implement a lot of useful
    functionality but it can act as the direct subclass of alternative
    parsing methods that do not depend on the Click parser.

    For instance, this can be used to bridge Click and other systems like
    argparse or docopt.

    Because base commands do not implement a lot of the API that other
    parts of Click take for granted, they are not supported for all
    operations.  For instance, they cannot be used with the decorators
    usually and they have no built-in callback system.

    .. 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.
    FTNcCs(||_|dkri}||_dS)N)r3�context_settings)rrr3r�r-r-r.rsGs	zBaseCommand.__init__cCstd��dS)NzBase commands cannot get usage)�NotImplementedError)rrrGr-r-r.r�RszBaseCommand.get_usagecCstd��dS)NzBase commands cannot get help)r�)rrrGr-r-r.r�UszBaseCommand.get_helpc
Ksx3t|j�D]"\}}||kr|||<qWt|d|d||�}|jdd��|j||�WdQRX|S)aThis function when given an info name and arguments will kick
        off the parsing and create a new :class:`Context`.  It does not
        invoke the actual command callback though.

        :param info_name: the info name for this invokation.  Generally this
                          is the most descriptive name for the script or
                          command.  For the toplevel script it's usually
                          the name of the script, for commands below it it's
                          the name of the script.
        :param args: the arguments to parse as list of strings.
        :param parent: the parent context if available.
        :param extra: extra keyword arguments forwarded to the context
                      constructor.
        r_r]rzFN)rr�r[r|�
parse_args)rrr_rKr]�extrarXrIrGr-r-r.�make_contextXszBaseCommand.make_contextcCstd��dS)z�Given a context and a list of arguments this creates the parser
        and parses the arguments, then modifies the context as necessary.
        This is automatically invoked by :meth:`make_context`.
        z1Base commands do not know how to parse arguments.N)r�)rrrGrKr-r-r.r�oszBaseCommand.parse_argscCstd��dS)z{Given a context, this invokes the command.  The default
        implementation is raising a not implemented error.
        z*Base commands are not invokable by defaultN)r�)rrrGr-r-r.r�wszBaseCommand.invokec	Ks�tst�nt�|dkr/t�}nt|�}|dkruttjjt	j
rit	j
dplt��}t|||�y�yF|j
|||��*}|j|�}|s�|S|j�WdQRXWnxttfk
rtdt	j�t��YnHtk
rH}z(|s�|j�t	j|j�WYdd}~XnXWn;tk
r�|sc�tddt	j�t	jd�YnXdS)a1This is the way to invoke a script with all the bells and
        whistles as a command line application.  This will always terminate
        the application after a call.  If this is not wanted, ``SystemExit``
        needs to be caught.

        This method is also available by directly calling the instance of
        a :class:`Command`.

        .. versionadded:: 3.0
           Added the `standalone_mode` flag to control the standalone mode.

        :param args: the arguments that should be used for parsing.  If not
                     provided, ``sys.argv[1:]`` is used.
        :param prog_name: the program name that should be used.  By default
                          the program name is constructed by taking the file
                          name from ``sys.argv[0]``.
        :param complete_var: the environment variable that controls the
                             bash completion support.  The default is
                             ``"_<prog_name>_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.
        Nr�filezAborted!r)rrrrr9r	r$�path�basenamer(�argv�__file__r'r�r�r)�EOFError�KeyboardInterruptr�stderrrr
ZshowZ	exit_code)	rrrKr+r,Zstandalone_moder�rGr{rMr-r-r.�main}s<%
"

'
zBaseCommand.maincOs|j||�S)zAlias for :meth:`main`.)r�)rrrKr�r-r-r.�__call__�szBaseCommand.__call__)r5r�r�r�rhrirjrsr�r�r�r�r�r�r�r-r-r-r.r�+s	Lr�c
@s�eZdZdZdddddddddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�ZdS)#r�a�Commands 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.
    Nz	[OPTIONS]Tc

Csztj|||�||_|p%g|_||_||_||_|dkrd|rdt|�}||_|	|_	dS)N)
r�rsrFr`�help�epilog�options_metavarr
�
short_help�add_help_option)
rrr3r�rFr`r�r�r�r�r�r-r-r.rs�s					zCommand.__init__cCs/|j�}|j||�|j�jd�S)N�
)r~�format_usage�getvalue�rstrip)rrrG�	formatterr-r-r.r��szCommand.get_usagecCs5|j}|j|�}|dk	r1||g}|S)N)r`�get_help_option)rrrGr{Zhelp_optionr-r-r.�
get_params�s
	
zCommand.get_paramscCs/|j|�}|j|jdj|��dS)z)Writes the usage line into the formatter.r�N)�collect_usage_piecesZwrite_usager��join)rrrGr��piecesr-r-r.r�szCommand.format_usagecCs@|jg}x-|j|�D]}|j|j|��qW|S)zhReturns all the pieces that go into the usage line and returns
        it as a list of strings.
        )r�r��extend�get_usage_pieces)rrrGr{rHr-r-r.r�
szCommand.collect_usage_piecescCsGt|j�}x1|jD]&}|j|j�|j|j�qW|S)z&Returns the names for the help option.)�setrkr`�difference_update�opts�secondary_opts)rrrGZ	all_namesrHr-r-r.�get_help_option_namess
zCommand.get_help_option_namescCsX|j|�}|s |jr$dSdd�}t|ddddddd	|d
d�S)zReturns the help option object.NcSs7|r3|jr3t|j�d|j�|j�dS)Nro)rmrr�ror))rGrHrIr-r-r.�	show_help!sz*Command.get_help_option.<locals>.show_help�is_flagTrSr�FrFr�zShow this message and exit.)r�r��Option)rrrGZhelp_optionsr�r-r-r.r�szCommand.get_help_optioncCsRt|�}|j|_|j|_x'|j|�D]}|j||�q4W|S)z6Creates the underlying option parser for this command.)rrirjr��
add_to_parser)rrrG�parserrHr-r-r.�make_parser*szCommand.make_parsercCs/|j�}|j||�|j�jd�S)z�Formats the help into a string and returns it.  This creates a
        formatter and will call into the following formatting methods:
        r�)r~�format_helpr�r�)rrrGr�r-r-r.r�3szCommand.get_helpcCsD|j||�|j||�|j||�|j||�dS)z�Writes 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)r��format_help_text�format_options�
format_epilog)rrrGr�r-r-r.r�;s
zCommand.format_helpc	Cs;|jr7|j�|j��|j|j�WdQRXdS)z3Writes the help text to the formatter if it exists.N)r��write_paragraph�indentation�
write_text)rrrGr�r-r-r.r�Js	

zCommand.format_help_textc	Csvg}x?|j|�D].}|j|�}|dk	r|j|�qW|rr|jd��|j|�WdQRXdS)z8Writes all the options into the formatter if they exist.NZOptions)r��get_help_recordr�section�write_dl)rrrGr�r�rHr{r-r-r.r�QszCommand.format_optionsc	Cs;|jr7|j�|j��|j|j�WdQRXdS)z2Writes the epilog into the formatter if it exists.N)r�r�r�r�)rrrGr�r-r-r.r�]s	

zCommand.format_epilogcCs�|j|�}|jd|�\}}}x;t||j|��D]!}|j|||�\}}qCW|r�|jr�|jr�|jdt|�dkr�dp�ddj	t
t|��f�||_|S)NrKz$Got unexpected extra argument%s (%s)r�sr�r�)
r�r�rZr��handle_parse_resultrhrmr��lenr��mapr	rK)rrrGrKr�r�Zparam_orderrHrIr-r-r.r�ds		zCommand.parse_argscCs)|jdk	r%|j|j|j�SdS)zeGiven a context, this invokes the attached callback (if it exists)
        in the right way.
        N)rFr�r`)rrrGr-r-r.r�tszCommand.invoke)r5r�r�r�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r-r-r-r.r��s$		r�c@s�eZdZdZdZdZdddddddd�Zdd�Zd	d
�Zddd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r1aA 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.
    TFNc	Ks�tj|||�|dkr&|}||_||_|dkrY|rSt}nt}||_||_||_|jr�x6|j	D]+}t
|t�r�|jr�t
d��q�WdS)Nz<Multi commands in chain mode cannot have optional arguments.)r�rs�no_args_is_help�invoke_without_command�SUBCOMMANDS_METAVAR�SUBCOMMAND_METAVAR�subcommand_metavarr/�result_callbackr`r0�Argument�requiredr2)	rrr3r�r�r�r/r��attrsrHr-r-r.rs�s 							zMultiCommand.__init__cCs&tj||�}|j|j�|S)N)r�r�rr�)rrrGr{r-r-r.r��sz!MultiCommand.collect_usage_piecescCs'tj|||�|j||�dS)N)r�r��format_commands)rrrGr�r-r-r.r��szMultiCommand.format_optionscs��fdd�}|S)amAdds 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.
        csW�j��dks�r(��_�S��fdd�}t|���_}|S)Ncs��|||�||�S)Nr-)Z_MultiCommand__valuerKr�)r��old_callbackr-r.�function�sz@MultiCommand.resultcallback.<locals>.decorator.<locals>.function)r�r)r�r�r{)r"rr)r�r�r.�	decorator�s		z.MultiCommand.resultcallback.<locals>.decoratorr-)rrr"r�r-)r"rrr.�resultcallback�s
zMultiCommand.resultcallbackc	Cs�g}xZ|j|�D]I}|j||�}|dkr=q|jpId}|j||f�qW|r�|jd��|j|�WdQRXdS)zeExtra format methods for multi methods that adds all the commands
        after the options.
        Nr�ZCommands)�
list_commands�get_commandr�rr�r�)rrrGr�ZrowsZ
subcommandr*r�r-r-r.r��szMultiCommand.format_commandscCs�|r=|jr=|jr=t|j�d|j�|j�tj|||�}|jrp||_	g|_
n-|r�|dd�|dd�|_	|_
|j
S)Nror)r�rmrr�ror)r�r�r/rarK)rrrGrK�restr-r-r.r��s
		'zMultiCommand.parse_argsc	's��fdd�}�jsu�jrh�js@tj���S��tj���|g�SWdQRX�jd��j�j}g�_g�_�js��u�j�|�\}}}|�_tj���|j	||d��}|�||j
j|��SWdQRXWdQRX���|r1dp4d�_tj���g}xi|r��j�|�\}}}|j	||d�dddd	�}|j|�|jg}|_qSWg}x5|D]-}|�|j|j
j|��WdQRXq�W||�SWdQRXdS)
Ncs.�jdk	r*�j�j|�j�}|S)N)r�r�r`)rI)rGrrr-r.�_process_result�sz,MultiCommand.invoke.<locals>._process_resultzMissing command.r]�*rhTriF)rar�r/r�r�r�rK�resolve_commandrer�r^r)	rrrGr�rKr6r*Zsub_ctxZcontextsr{r-)rGrrr.r��sH			
				$		

$zMultiCommand.invokecCs�t|d�}|}|j||�}|dkrd|jdk	rd|j|�}|j||�}|dkr�t|�dr�|j||j�|jd|�|||dd�fS)NrzNo such command "%s".r)r	r�rlrr�rKr�)rrrGrKr6Zoriginal_cmd_namer*r-r-r.r�AszMultiCommand.resolve_commandcCs
t��dS)z{Given a context and a command name, this returns a
        :class:`Command` object if it exists or returns `None`.
        N)r�)rrrGr6r-r-r.r�[szMultiCommand.get_commandcCsgS)zTReturns a list of subcommand names in the order they should
        appear.
        r-)rrrGr-r-r.r�aszMultiCommand.list_commands)r5r�r�r�rhrirsr�r�r�r�r�r�r�r�r�r-r-r-r.r1|s%Dr1c@sgeZdZdZdddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�Groupz�A 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.
    NcKs&tj|||�|pi|_dS)N)r1rs�commands)rrr3r�r�r-r-r.rsoszGroup.__init__cCsN|p|j}|dkr'td��t|||dd�||j|<dS)z�Registers another :class:`Command` with this group.  If the name
        is not provided, the name of the command is used.
        NzCommand has no name.r7T)r3r�r8r�)rrr*r3r-r-r.�add_commandts
zGroup.add_commandcs���fdd�}|S)aA shortcut decorator for declaring and attaching a command to
        the group.  This takes the same arguments as :func:`command` but
        immediately registers the created command with this instance by
        calling into :meth:`add_command`.
        cs&t���|�}�j|�|S)N)r^r�)r�r*)rKr�rrr-r.r��s
z Group.command.<locals>.decoratorr-)rrrKr�r�r-)rKr�rrr.r^~sz
Group.commandcs���fdd�}|S)z�A shortcut decorator for declaring and attaching a group to
        the group.  This takes the same arguments as :func:`group` but
        immediately registers the created command with this instance by
        calling into :meth:`add_command`.
        cs&t���|�}�j|�|S)N)�groupr�)r�r*)rKr�rrr-r.r��s
zGroup.group.<locals>.decoratorr-)rrrKr�r�r-)rKr�rrr.r��szGroup.groupcCs|jj|�S)N)r�r&)rrrGr6r-r-r.r��szGroup.get_commandcCs
t|j�S)N)rYr�)rrrGr-r-r.r��szGroup.list_commands)
r5r�r�r�rsr�r^r�r�r�r-r-r-r.r�hs
r�c@sLeZdZdZdddd�Zdd�Zdd�Zd	d
�ZdS)�CommandCollectionaA command collection is a multi command that merges multiple multi
    commands together into one.  This is a straightforward implementation
    that accepts a list of different multi commands as sources and
    provides all the commands for each of them.
    NcKs&tj|||�|pg|_dS)N)r1rs�sources)rrr3r�r�r-r-r.rs�szCommandCollection.__init__cCs|jj|�dS)z1Adds a new multi command to the chain dispatcher.N)r�r)rrZ	multi_cmdr-r-r.�
add_source�szCommandCollection.add_sourcecCsSxL|jD]A}|j||�}|dk	r
|jrGt|||�|Sq
WdS)N)r�r�r/r8)rrrGr6�sourcer{r-r-r.r��s	zCommandCollection.get_commandcCs=t�}x'|jD]}|j|j|��qWt|�S)N)r�r��updater�rY)rrrGr{r�r-r-r.r��s	zCommandCollection.list_commands)r5r�r�r�rsr�r�r�r-r-r-r.r��s
r�c@s�eZdZdZdZdddddddddddd�
Zedd	��Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)$�	Parametera!	A parameter to a command comes in two versions: they are either
    :class:`Option`\s or :class:`Argument`\s.  Other subclasses are currently
    not supported by design as some of the internals for parsing are
    intentionally not finalized.

    Some settings are supported by both options and arguments.

    .. versionchanged:: 2.0
       Changed signature for parameter callback to also be passed the
       parameter.  In Click 2.0, the old callback format will still work,
       but it will raise a warning to give you change to migrate the
       code easier.

    :param param_decls: the parameter declarations for this option or
                        argument.  This is a list of flags or argument
                        names.
    :param type: the type that should be used.  Either a :class:`ParamType`
                 or a Python type.  The later is converted into the former
                 automatically if supported.
    :param required: controls if this is optional or not.
    :param default: the default value if omitted.  This can also be a callable,
                    in which case it's invoked when the default is needed
                    without any arguments.
    :param callback: a callback that should be executed after the parameter
                     was matched.  This is called as ``fn(ctx, param,
                     value)`` and needs to return the value.  Before Click
                     2.0, the signature was ``(ctx, value)``.
    :param nargs: the number of arguments to match.  If not ``1`` the return
                  value is a tuple instead of single value.  The default for
                  nargs is ``1`` (except if the type is a tuple, then it's
                  the arity of the tuple).
    :param metavar: how the value is represented in the help page.
    :param expose_value: if this is `True` then the value is passed onwards
                         to the command callback and stored on the context,
                         otherwise it's skipped.
    :param is_eager: eager values are processed before non eager ones.  This
                     should not be set for arguments or it will inverse the
                     order of processing.
    :param envvar: a string or list of strings that are environment variables
                   that should be checked.
    Z	parameterNFTcCs�|j|pf|�\|_|_|_t||�|_|dkri|jjrc|jj}nd}||_||_	||_
d|_||_||_
|	|_||_|
|_dS)NrF)�_parse_declsr3r�r�r�type�is_compositeZarityr�rF�nargs�multipler��defaultrS�metavar�envvar)rr�param_declsr�r�r�rFr�r�r�rSr�r-r-r.rs�s*								zParameter.__init__cCs|jS)z�Returns the human readable name of this parameter.  This is the
        same as the name for options, but the metavar for arguments.
        )r3)rrr-r-r.�human_readable_nameszParameter.human_readable_namecCsc|jdk	r|jS|jj|�}|dkrF|jjj�}|jdkr_|d7}|S)Nrz...)r�r�Zget_metavarr3r#r�)rrr�r-r-r.�make_metavar	s
zParameter.make_metavarcCs7t|j�r|j�}n	|j}|j||�S)z;Given a context variable this calculates the default value.)r�r��type_cast_value)rrrGr{r-r-r.r�s	zParameter.get_defaultcCsdS)Nr-)rrr�rGr-r-r.r�szParameter.add_to_parsercCsO|j|j�}|dkr0|j|j�}|dkrK|j|�}|S)N)r&r3r��value_from_envvar)rrrGr�rIr-r-r.�
consume_valueszParameter.consume_valuecs��jjrv�jdkr.td�j���jr]t��fdd�|pUfD��S�j|plf���S���fdd���|�jdkt�j��S)z�Given a value this runs it properly through the type system.
        This automatically handles things like `nargs` and `multiple` as
        well as composite types.
        rz�Attempted to invoke composite type but nargs has been set to %s.  This is not supported; nargs needs to be set to a fixed value > 1.c3s*|] }�j|pf���VqdS)N)r�)�.0�x)rGrrr-r.�	<genexpr>3sz,Parameter.type_cast_value.<locals>.<genexpr>csE�dkr�j|���St��fdd�|p=fD��S)Nrc3s"|]}�|�d�VqdS)rNr-)rr)�_convert�levelr-r.r9sz>Parameter.type_cast_value.<locals>._convert.<locals>.<genexpr>)r��tuple)rIr	)rrGrr)r	r.r6sz+Parameter.type_cast_value.<locals>._convert)r�r�r�r�r�r
�bool)rrrGrIr-)rrGrrr.r's
	&zParameter.type_cast_valuecCs |dk	r|j||�SdS)zaGiven a value and context this runs the logic to convert the
        value as necessary.
        N)r)rrrGrIr-r-r.�
process_value<szParameter.process_valuecCs<|dkrdS|jdks(|jr8|fkr8dSdS)NTrF)r�r�)rrrIr-r-r.�value_is_missingGs
$zParameter.value_is_missingcCs^|j||�}|dkr-|j|�}|jrZ|j|�rZtd|d|��|S)NrGrH)rr�r�r
r)rrrGrIr-r-r.�full_process_valueNszParameter.full_process_valuecCs{|jdkrdSt|jttf�rdxI|jD](}tjj|�}|dk	r5|Sq5Wntjj|j�SdS)N)r�r0r
r9r$r%r&)rrrGr�r{r-r-r.�resolve_envvar_valueYszParameter.resolve_envvar_valuecCs@|j|�}|dk	r<|jdkr<|jj|�}|S)Nr)rr�r��split_envvar_value)rrrGr{r-r-r.rdszParameter.value_from_envvarcCs�t|d|���|j||�}y|j||�}Wn$tk
ra|jsW�d}YnX|jdk	r�yt|j|||�}Wntk
r�|js��YnXWdQRX|jr�||j|j	<||fS)NrH)
rNrr�	ExceptionrmrFrLr�r`r3)rrrGr�rKrIr-r-r.r�js$
	
		zParameter.handle_parse_resultcCsdS)Nr-)rrrGr-r-r.r�szParameter.get_help_recordcCsgS)Nr-)rrrGr-r-r.r��szParameter.get_usage_pieces)r5r�r�r��param_type_namersr�rrr�r�rrrr
rrrr�r�r�r-r-r-r.r��s&)	
	r�c@s�eZdZdZdZdddddddddddddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)r�a+Options are usually optional values on the command line and
    have some extra features that arguments don't have.

    All other parameters are passed onwards to the parameter constructor.

    :param show_default: controls if the default value should be shown on the
                         help page.  Normally, defaults are not shown.
    :param prompt: if set to `True` or a non empty string then the user will
                   be prompted for input if not set.  If set to `True` the
                   prompt will be the option name capitalized.
    :param confirmation_prompt: if set then the value will need to be confirmed
                                if it was prompted for.
    :param hide_input: if this is `True` then the input on the prompt will be
                       hidden from the user.  This is useful for password
                       input.
    :param is_flag: forces this option to act as a flag.  The default is
                    auto detection.
    :param flag_value: which value should be used for this flag if it's
                       enabled.  This is set to a boolean automatically if
                       the option string contains a slash to mark two options.
    :param multiple: if this is set to `True` then the argument is accepted
                     multiple times and recorded.  This is similar to ``nargs``
                     in how it works but supports arbitrary number of
                     arguments.
    :param count: this flag makes an option increment an integer.
    :param allow_from_autoenv: if this is enabled then the value of this
                               parameter will be pulled from an environment
                               variable in case a prefix is defined on the
                               context.
    :param help: the help string.
    ZoptionNFTc
Ksl|
jdt�tk}tj||d||
�|dkr[|jjdd�j�}n|dkrpd}n|}||_||_||_	|dkr�|dk	r�d}nt
|j�}|r�|r�d|_|dkr�|j}||_
||_|j
r:t|jt
�r:|dkr:t|_d|_n	d|_|	|_|	r|dkrptdd�|_|rd|_||_|
|_||_||_|jdkr�td	��|jr�|j
r�|jr�td
��|jr|jrtd��|jr2|j	r2|jdk	r2td��|jrh|jrStd
��n|j
rhtd��dS)Nr�r�Tr r�F�minrzOptions cannot have nargs < 0z+Cannot prompt for flags that are not bools.z*Got secondary option for non boolean flag.z5Hidden input does not work with boolean flag prompts.z6Options cannot be multiple and count at the same time.z3Options cannot be count and flags at the same time.)r&�_missingr�rsr3r"�
capitalizer�confirmation_prompt�
hide_inputrr�r�r��
flag_valuer0rr��is_bool_flag�countrr��allow_from_autoenvr��show_defaultr�r�)rrr�rrrrr�rr�rrr�r�r�Zdefault_is_missingZprompt_textr-r-r.rs�sb						
													zOption.__init__cCs�g}g}d}g}x�|D]�}t|�rR|dk	rItd��|}q|dd�dkrndpqd}||kr�|j|d�\}	}
|	j�}	|	r�|jt|	��|j|	�|
j�}
|
r|j|
j��q|jt|��|j|�qW|dkrp|rp|jddd��|ddjdd	�j	�}t|�spd}|dkr�|s�d||fStd
��|r�|r�td|��|||fS)
NzName defined twicer�/�;rXcSst|d�S)Nr)r�)rr-r-r.�<lambda>	sz%Option._parse_decls.<locals>.<lambda>rr z#Could not determine name for optionzhNo options defined but a name was passed (%s). Did you mean to declare an argument instead of an option?���)
rr��splitr�rrr��sortr"�lower)rr�declsr�r�r�r3Zpossible_namesZdeclZ
split_char�first�secondr-r-r.r��sD
	"
 

zOption._parse_declscCsd|jd|jd|i}|jr0d}n|jrBd}nd}|jr�|jdd�|jr�|jr�|j|j	d|dd	d
|�|j|jd|dd	d|�q|j|j	d|dd	|j
|�n||d<|j|j	|�dS)N�destr�rbrrZstore�actionZ_const�constTF)r3r�r�rr��poprr�Z
add_optionr�r)rrr�rGr�r(r-r-r.r�s(							


zOption.add_to_parsercs+g���fdd�}|�j�g}�jrL|j|�j���jpXd}g}�jdk	r��jr�|jdt�jttf�r�dj	dd��jD��n�jf��j
r�|jd�|rd	|r�|d
p�ddj	|�f}�rdpdj	|�|fS)
NcsWt|�\}}|r+dg�dd�<�jrS�jrS|d�j�7}|S)NTr�)rr�rr)r�r{Zany_slashes)�any_prefix_is_slashrrr-r.�_write_opts:sz+Option.get_help_record.<locals>._write_optsr�zdefault: %sz, css|]}d|VqdS)z%sNr-)r�dr-r-r.rJsz)Option.get_help_record.<locals>.<genexpr>r�z%s[%s]z  z; z / )r�r�rr�r�rr0r9r
r�r�)rrrGr,r{r�r�r-)r+rrr.r�7s 		7	
)zOption.get_help_recordcCs`|jrP|jrPx6|jjD](}|j|jkr |jr |jSq WdStj||�S)N)	r�rr^r`r3r�rr�r�)rrrGrHr-r-r.r�TszOption.get_defaultcsb�j��}�jr(t�j|�St�jd|d�jd�jd��fdd��S)z�This is an alternative flow that can be activated in the full
        value processing if a value does not exist.  It will prompt the
        user until a valid value exists and then returns the processed
        value as result.
        r�rrZ
value_proccs�j�|�S)N)r)r)rGrrr-r.rqsz)Option.prompt_for_value.<locals>.<lambda>)r�rrrrr)rrrGr�r-)rGrrr.�prompt_for_value`s			zOption.prompt_for_valuecCsjtj||�}|dk	r"|S|jrf|jdk	rfd|j|jj�f}tjj|�SdS)Nz%s_%s)	r�rrrnr3r#r$r%r&)rrrGr{r�r-r-r.rss	zOption.resolve_envvar_valuecCs�|j|�}|dkrdS|jdkt|j�}|dkr�|dk	r�|jj|�}|jr�|jdkr�t||j�}|S)Nrr)rr�rr�r�rr=)rrrGr{Zvalue_depthr-r-r.r|szOption.value_from_envvarcCsE|dkr2|jdk	r2|jr2|j|�Stj|||�S)N)rrmr.r�r)rrrGrIr-r-r.r�s

zOption.full_process_value)r5r�r�r�rrsr�r�r�r�r.rrrr-r-r-r.r��s		B,	r�c@smeZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)r�z�Arguments are positional parameters to a command.  They generally
    provide fewer features than options but can have infinite ``nargs``
    and are required by default.

    All parameters are passed onwards to the parameter constructor.
    ZargumentNcKs�|dkrB|jd�dk	r*d}n|jdd�dk}tj||d||�|jdk	r�|jdkr�td��dS)Nr�Fr�rrr�z>nargs=-1 in combination with a default value is not supported.)r&r�rsr�r�r�)rrr�r�r�r-r-r.rs�s	zArgument.__init__cCs#|jdk	r|jS|jj�S)N)r�r3r#)rrr-r-r.r�szArgument.human_readable_namecCsU|jdk	r|jS|jj�}|js8d|}|jdkrQ|d7}|S)Nz[%s]rz...)r�r3r#r�r�)rr�varr-r-r.r�s	

zArgument.make_metavarcCs�|s%|sdggfStd��t|�dkr`|d}}|jdd�j�}n7t|�dkr�|\}}ntdt|���||ggfS)Nz%Could not determine name for argumentrrrr r�z@Arguments take exactly one or two parameter declarations, got %d)r�r�r"r#)rrr$r�r3�argr-r-r.r��s
zArgument._parse_declscCs
|j�gS)N)r)rrrGr-r-r.r��szArgument.get_usage_piecescCs&|jd|jd|jd|�dS)Nr'r�rb)�add_argumentr3r�)rrr�rGr-r-r.r��szArgument.add_to_parser)r5r�r�r�rrsr�rrr�r�r�r-r-r-r.r��s
r�)r^r�)@r$r(�
contextlibr�	itertoolsr�	functoolsr�typesrrrZutilsr	r
rr�
exceptionsr
rrrrZtermuirrZ
formattingrrr�rr�globalsrrZ_compatrrrZ_unicodefunrr�objectrr�r�r'r8r=rLrNrZr[r�r�r1r�r�r�r�r�Z
decoratorsr^r�r-r-r-r.�<module>sF"(	
�����5��	<

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.opt-1.pyc File 2.8 KB 0644
__init__.cpython-35.pyc File 2.8 KB 0644
_bashcomplete.cpython-35.opt-1.pyc File 2.45 KB 0644
_bashcomplete.cpython-35.pyc File 2.45 KB 0644
_compat.cpython-35.opt-1.pyc File 16.31 KB 0644
_compat.cpython-35.pyc File 16.31 KB 0644
_termui_impl.cpython-35.opt-1.pyc File 14.07 KB 0644
_termui_impl.cpython-35.pyc File 14.07 KB 0644
_textwrap.cpython-35.opt-1.pyc File 1.33 KB 0644
_textwrap.cpython-35.pyc File 1.33 KB 0644
_unicodefun.cpython-35.opt-1.pyc File 3.37 KB 0644
_unicodefun.cpython-35.pyc File 3.37 KB 0644
_winconsole.cpython-35.opt-1.pyc File 7.9 KB 0644
_winconsole.cpython-35.pyc File 7.9 KB 0644
core.cpython-35.opt-1.pyc File 57.77 KB 0644
core.cpython-35.pyc File 58.27 KB 0644
decorators.cpython-35.opt-1.pyc File 11.7 KB 0644
decorators.cpython-35.pyc File 11.7 KB 0644
exceptions.cpython-35.opt-1.pyc File 7.97 KB 0644
exceptions.cpython-35.pyc File 7.97 KB 0644
formatting.cpython-35.opt-1.pyc File 8.81 KB 0644
formatting.cpython-35.pyc File 8.81 KB 0644
globals.cpython-35.opt-1.pyc File 1.82 KB 0644
globals.cpython-35.pyc File 1.82 KB 0644
parser.cpython-35.opt-1.pyc File 12.19 KB 0644
parser.cpython-35.pyc File 12.19 KB 0644
termui.cpython-35.opt-1.pyc File 19.07 KB 0644
termui.cpython-35.pyc File 19.07 KB 0644
testing.cpython-35.opt-1.pyc File 10.59 KB 0644
testing.cpython-35.pyc File 10.59 KB 0644
types.cpython-35.opt-1.pyc File 18.07 KB 0644
types.cpython-35.pyc File 18.23 KB 0644
utils.cpython-35.opt-1.pyc File 14.36 KB 0644
utils.cpython-35.pyc File 14.36 KB 0644