Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/click/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/click/__pycache__/shell_completion.cpython-39.pyc
a

��Sh�H�@sUddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZeejeejfeeeed
�dd�ZGdd�d�ZdZdZdZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�Zejdej ed�Z!eeed�Z"ej#eej efe$d <d6e!ej%ee!d!�d"d#�Z&eej%ej ed$�d%d&�Z'e	ee(d'�d(d)�Z)e	ee(d*�d+d,�Z*e	ej+eee(d-�d.d/�Z,eejeejfeej+ee	d0�d1d2�Z-e	ej+eeej.ej/eefefd3�d4d5�Z0dS)7�N)�gettext�)�Argument)�BaseCommand)�Context)�MultiCommand)�Option)�	Parameter)�ParameterSource)�split_arg_string)�echo)�cli�ctx_args�	prog_name�complete_var�instruction�returnc	Csf|�d�\}}}t|�}|dur$dS|||||�}|dkrJt|���dS|dkrbt|���dSdS)aPerform shell completion for the given CLI program.

    :param cli: Command being called.
    :param ctx_args: Extra arguments to pass to
        ``cli.make_context``.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.
    :param instruction: Value of ``complete_var`` with the completion
        instruction and shell, in the form ``instruction_shell``.
    :return: Status code to exit with.
    �_Nr�sourcer�complete)�	partition�get_completion_classrrr)	r
rrrr�shellrZcomp_cls�comp�r�@/usr/local/lib/python3.9/site-packages/click/shell_completion.py�shell_completesrc@sHeZdZdZdZdejeejeejdd�dd�Z	eejd�d	d
�Z
dS)�CompletionItema)Represents a completion value and metadata about the value. The
    default metadata is ``type`` to indicate special shell handling,
    and ``help`` if a shell supports showing a help string next to the
    value.

    Arbitrary parameters can be passed when creating the object, and
    accessed using ``item.attr``. If an attribute wasn't passed,
    accessing it returns ``None``.

    :param value: The completion suggestion.
    :param type: Tells the shell script to provide special completion
        support for the type. Click uses ``"dir"`` and ``"file"``.
    :param help: String shown next to the value if supported.
    :param kwargs: Arbitrary metadata. The built-in implementations
        don't use this, but custom type completions paired with custom
        shell support could use it.
    ��value�type�help�_info�plainN)rr r!�kwargsrcKs||_||_||_||_dS�Nr)�selfrr r!r$rrr�__init__LszCompletionItem.__init__)�namercCs|j�|�Sr%)r"�get)r&r(rrr�__getattr__XszCompletionItem.__getattr__)r#N)�__name__�
__module__�__qualname__�__doc__�	__slots__�t�Any�str�Optionalr'r*rrrrr7s��ra�%(complete_func)s() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD %(complete_var)s=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            COMPREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMPREPLY=()
            compopt -o default
        elif [[ $type == 'plain' ]]; then
            COMPREPLY+=($value)
        fi
    done

    return 0
}

%(complete_func)s_setup() {
    complete -o nosort -F %(complete_func)s %(prog_name)s
}

%(complete_func)s_setup;
a�#compdef %(prog_name)s

%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    (( ! $+commands[%(prog_name)s] )) && return 1

    response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) %(complete_var)s=zsh_complete %(prog_name)s)}")

    for type key descr in ${response}; do
        if [[ "$type" == "plain" ]]; then
            if [[ "$descr" == "_" ]]; then
                completions+=("$key")
            else
                completions_with_descriptions+=("$key":"$descr")
            fi
        elif [[ "$type" == "dir" ]]; then
            _path_files -/
        elif [[ "$type" == "file" ]]; then
            _path_files -f
        fi
    done

    if [ -n "$completions_with_descriptions" ]; then
        _describe -V unsorted completions_with_descriptions -U
    fi

    if [ -n "$completions" ]; then
        compadd -U -V unsorted -a completions
    fi
}

if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
    # autoload from fpath, call function directly
    %(complete_func)s "$@"
else
    # eval/source/. command, register function for later
    compdef %(complete_func)s %(prog_name)s
fi
affunction %(complete_func)s;
    set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(prog_name)s);

    for completion in $response;
        set -l metadata (string split "," $completion);

        if test $metadata[1] = "dir";
            __fish_complete_directories $metadata[2];
        else if test $metadata[1] = "file";
            __fish_complete_path $metadata[2];
        else if test $metadata[1] = "plain";
            echo $metadata[2];
        end;
    end;
end;

complete --no-files --command %(prog_name)s --arguments "(%(complete_func)s)";
c@s�eZdZUdZejeed<ejeed<eej	eej
feedd�dd�Zeed�d	d
��Z
ejeej
fd�dd�Zed�d
d�Zejejeefd�dd�Zejeeejed�dd�Zeed�dd�Zed�dd�ZdS)�
ShellCompletea�Base class for providing shell completion support. A subclass for
    a given shell will override attributes and methods to implement the
    completion instructions (``source`` and ``complete``).

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.

    .. versionadded:: 8.0
    r(�source_templateN)r
rrrrcCs||_||_||_||_dSr%)r
rrr)r&r
rrrrrrr'�szShellComplete.__init__�rcCs*tjdd|j�dd�tjd�}d|�d�S)zQThe name of the shell function defined by the completion
        script.
        z\W*��-r)�flagsZ_completion)�re�subr�replace�ASCII)r&�	safe_namerrr�	func_name�szShellComplete.func_namecCs|j|j|jd�S)z�Vars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )Z
complete_funcrr)r?rr�r&rrr�source_vars�s�zShellComplete.source_varscCs|j|��S)z�Produce the shell script that defines the completion
        function. By default this ``%``-style formats
        :attr:`source_template` with the dict returned by
        :meth:`source_vars`.
        )r5rAr@rrrr�szShellComplete.sourcecCst�dS)z�Use the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        N��NotImplementedErrorr@rrr�get_completion_argssz!ShellComplete.get_completion_args)�args�
incompletercCs0t|j|j|j|�}t|||�\}}|�||�S)aTDetermine the context and last complete command or parameter
        from the complete args. Call that object's ``shell_complete``
        method to get the completions for the incomplete value.

        :param args: List of complete args before the incomplete value.
        :param incomplete: Value being completed. May be empty.
        )�_resolve_contextr
rr�_resolve_incompleter)r&rErF�ctx�objrrr�get_completionss
zShellComplete.get_completions��itemrcCst�dS)z�Format a completion item into the form recognized by the
        shell script. This must be implemented by subclasses.

        :param item: Completion item to format.
        NrB�r&rMrrr�format_completionszShellComplete.format_completioncs4���\}}��||�}�fdd�|D�}d�|�S)z�Produce the completion data to send back to the shell.

        By default this calls :meth:`get_completion_args`, gets the
        completions, then calls :meth:`format_completion` for each
        completion.
        csg|]}��|��qSr)rO)�.0rMr@rr�
<listcomp>&�z*ShellComplete.complete.<locals>.<listcomp>�
)rDrK�join)r&rErFZcompletions�outrr@rrszShellComplete.complete)r+r,r-r.r0�ClassVarr2�__annotations__r�MutableMappingr1r'�propertyr?�DictrAr�Tuple�ListrDrrKrOrrrrrr4�s&
�
�r4csneZdZdZdZeZedd�dd��Ze	d��fdd�Z
ejej
e	e	fd�d	d
�Zee	d�dd
�Z�ZS)�BashCompletezShell completion for Bash.�bashNr6cCs�ddl}ddl}|�d�}|dur(d}n*|j|dddg|jd�}t�d|j���}|dur�|�	�\}}|dks~|dkr�|dkr�t
td	�d
d�nt
td�d
d�dS)
Nrr^z--norcz-czecho "${BASH_VERSION}")�stdoutz^(\d+)\.(\d+)\.\d+�4zCShell completion is not supported for Bash versions older than 4.4.T)�errz@Couldn't detect Bash version, shell completion is not supported.)�shutil�
subprocess�which�run�PIPEr:�searchr_�decode�groupsrr)rbrcZbash_exe�match�output�major�minorrrr�_check_version0s.

����zBashComplete._check_versioncs|��t���Sr%)rn�superrr@��	__class__rrrQszBashComplete.sourcecCsTttjd�}ttjd�}|d|�}z||}WntyJd}Yn0||fS�N�
COMP_WORDS�
COMP_CWORDrr7�r�os�environ�int�
IndexError�r&�cwords�cwordrErFrrrrDUs
z BashComplete.get_completion_argsrLcCs|j�d|j��S)N�,)r rrNrrrrOaszBashComplete.format_completion)r+r,r-r.r(�_SOURCE_BASHr5�staticmethodrnr2rr0r[r\rDrrO�
__classcell__rrrprr]*s r]c@sFeZdZdZdZeZejej	e
e
fd�dd�Zee
d�dd�Z
d	S)
�ZshCompletezShell completion for Zsh.�zshr6cCsTttjd�}ttjd�}|d|�}z||}WntyJd}Yn0||fSrrrurzrrrrDks
zZshComplete.get_completion_argsrLcCs$|j�d|j�d|jr|jnd��S)NrSr)r rr!rNrrrrOwszZshComplete.format_completionN)r+r,r-r.r(�_SOURCE_ZSHr5r0r[r\r2rDrrOrrrrr�es
r�c@sFeZdZdZdZeZejej	e
e
fd�dd�Zee
d�dd�Z
d	S)
�FishCompletezShell completion for Fish.�fishr6cCsHttjd�}tjd}|dd�}|r@|r@|d|kr@|��||fS)Nrsrtr���)rrvrw�pop)r&r{rFrErrrrD�s
z FishComplete.get_completion_argsrLcCs2|jr |j�d|j�d|j��S|j�d|j��S)Nr}�	)r!r rrNrrrrO�szFishComplete.format_completionN)r+r,r-r.r(�_SOURCE_FISHr5r0r[r\r2rDrrOrrrrr�{s
r��ShellCompleteType)�bound)r^r�r��_available_shells)�clsr(rcCs|dur|j}|t|<|S)amRegister a :class:`ShellComplete` subclass under the given name.
    The name will be provided by the completion instruction environment
    variable during completion.

    :param cls: The completion class that will handle completion for the
        shell.
    :param name: Name to register the class under. Defaults to the
        class's ``name`` attribute.
    N)r(r�)r�r(rrr�add_completion_class�sr�)rrcCs
t�|�S)z�Look up a registered :class:`ShellComplete` subclass by the name
    provided by the completion instruction environment variable. If the
    name isn't registered, returns ``None``.

    :param shell: Name the class is registered under.
    )r�r))rrrrr�sr)rI�paramrcCslt|t�sdS|jdusJ�|j�|j�}|jdkpj|�|j�tjupj|jdkojt|t	t
f�ojt|�|jkS)z�Determine if the given parameter is an argument that can still
    accept values.

    :param ctx: Invocation context for the command represented by the
        parsed complete args.
    :param param: Argument object being checked.
    FNr�r)�
isinstancerr(�paramsr)�nargsZget_parameter_sourcer
ZCOMMANDLINE�tuple�list�len)rIr�rrrr�_is_incomplete_argument�s

�
��r�)rIrrcCs|sdS|d}||jvS)z5Check if the value looks like the start of an option.Fr)Z
_opt_prefixes)rIr�crrr�_start_of_option�sr�)rIrEr�rcCsjt|t�sdS|js|jrdSd}tt|��D](\}}|d|jkrHqXt||�r.|}q.|duoh||jvS)z�Determine if the given parameter is an option that needs a value.

    :param args: List of complete args before the incomplete value.
    :param param: Option object being checked.
    FNr)	r�rZis_flag�count�	enumerate�reversedr�r��opts)rIrEr�Zlast_option�index�argrrr�_is_incomplete_option�s

r�)r
rrrErc	Cs�d|d<|j||��fi|��}|j|j}|r�|j}t|t�r�|js�|�||�\}}}|durd|S|j|||dd�}|j|j}q�|}|r�|�||�\}}}|dur�|S|j|||dddd�}|j}q�|}g|j�|j�}q,q�q,|S)a`Produce the context hierarchy starting with the command and
    traversing the complete arguments. This only follows the commands,
    it doesn't trigger input prompts or callbacks.

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param args: List of complete args before the incomplete value.
    T�resilient_parsingN)�parentr�F)r�Zallow_extra_args�allow_interspersed_argsr�)	Zmake_context�copyZprotected_argsrE�commandr�r�chainZresolve_command)	r
rrrErIr�r(�cmdZsub_ctxrrrrG�s<
�rG)rIrErFrcCs�|dkrd}n,d|vr:t||�r:|�d�\}}}|�|�d|vrVt||�rV|j|fS|j�|�}|D]}t|||�rf||fSqf|D]}t||�r�||fSq�|j|fS)ahFind the Click object that will handle the completion of the
    incomplete value. Return the object and the incomplete value.

    :param ctx: Invocation context for the command represented by
        the parsed complete args.
    :param args: List of complete args before the incomplete value.
    :param incomplete: Value being completed. May be empty.
    �=r7z--)r�r�appendr��
get_paramsr�r�)rIrErFr(rr�r�rrrrH/s


rH)N)1rvr:�typingr0rr�corerrrrrr	r
�parserr�utilsrrXr2r1rxrrr~r�r�r4r]r�r��TypeVar�Typer�r�rZrWr3r�r�boolr�r�r\r�rGr[�UnionrHrrrr�<module>sd
�&& ,j;��
�
	�:�

Yohohohohohooho | Sanrei Aya