CasperSecurity

Current Path : /lib/python3/dist-packages/click/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/click/__pycache__/shell_completion.cpython-310.pyc

o

�+caQF�@s,UddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZd
edejeejfdedededefdd�ZGdd�d�ZdZdZdZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!e�Zeeed"�Zejeej efe!d#<	d:d$ej ed%ej"eddfd&d'�Z#d(edej"ej efd)d*�Z$d+e	d,ede%fd-d.�Z&d/ede%fd0d1�Z'd2ej(ed,ede%fd3d4�Z)d
edejeejfded2ej(ede	f
d5d6�Z*d+e	d2ej(ed7edej+ej,eefeffd8d9�Z-dS);�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|�}|durdS|||||�}|dkr%t|���dS|dkr1t|���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�shellr�comp_cls�comp�r�8/usr/lib/python3/dist-packages/click/shell_completion.py�shell_completesrc@sVeZdZdZdZ		ddejdedejedejd	df
d
d�Z	ded	ejfd
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�plainNr r!r"�kwargsrcK�||_||_||_||_dS�Nr)�selfr r!r"r%rrr�__init__L�
zCompletionItem.__init__�namecCs|j�|�Sr')r#�get)r(r+rrr�__getattr__XszCompletionItem.__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
            COMREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMREPLY=()
            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
}

compdef %(complete_func)s %(prog_name)s;
a�function %(complete_func)s;
    set -l response;

    for value in (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(prog_name)s);
        set response $response $value;
    end;

    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<	dedej	eej
fdededd	f
d
d�Zedefdd
��Z
dej	eej
ffdd�Zdefdd�Zdejejeeffdd�Zdejededejefdd�Zdedefdd�Zdefdd�Zd	S)�
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_templater
rrrrNcCr&r')r
rrr)r(r
rrrrrrr)�r*zShellComplete.__init__cCs(t�dd|j�dd�tj�}d|�d�S)zQThe name of the shell function defined by the completion
        script.
        z\W*��-r�_completion)�re�subr�replace�ASCII)r(�	safe_namerrr�	func_name�szShellComplete.func_namecCs|j|j|jd�S)z�Vars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )�
complete_funcrr)rArr�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`.
        )r8rDrCrrrr�szShellComplete.sourcecC�t�)z�Use the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        ��NotImplementedErrorrCrrr�get_completion_args�sz!ShellComplete.get_completion_args�args�
incompletecCs0t|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(rIrJ�ctx�objrrr�get_completionss
zShellComplete.get_completions�itemcCrE)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.
        rF�r(rPrrr�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)rR)�.0rPrCrr�
<listcomp>$sz*ShellComplete.complete.<locals>.<listcomp>�
)rHrO�join)r(rIrJ�completions�outrrCrrs
zShellComplete.complete)r.r/r0r1r3�ClassVarr5�__annotations__r�Dictr4r)�propertyrArDr�Tuple�ListrHrrOrRrrrrrr7�s>
����
���
�r7csheZdZdZdZeZddd�Zdef�fdd�Z	de
je
jeeffd	d
�Z
dedefdd
�Z�ZS)�BashCompletezShell completion for Bash.�bashrNcCszddl}|jgd�|jd�}t�d|j���}|dur7|��\}}|dks-|dkr3|dkr5tt	d���dSdStt	d���)Nr)r`z-czecho ${BASH_VERSION})�stdoutz^(\d+)\.(\d+)\.\d+�4zCShell completion is not supported for Bash versions older than 4.4.z@Couldn't detect Bash version, shell completion is not supported.)
�
subprocess�run�PIPEr<�searchra�decode�groups�RuntimeErrorr)r(rc�output�match�major�minorrrr�_check_version.s"
�����zBashComplete._check_versioncs|��t���Sr')rn�superrrC��	__class__rrrEs
zBashComplete.sourcecC�Xttjd�}ttjd�}|d|�}z	||}W||fSty+d}Y||fSw�N�
COMP_WORDS�
COMP_CWORDrr9�r�os�environ�int�
IndexError�r(�cwords�cwordrIrJrrrrHI�
��z BashComplete.get_completion_argsrPcCs|j�d|j��S)N�,)r!r rQrrrrRUszBashComplete.format_completion)rN)r.r/r0r1r+�_SOURCE_BASHr8rnr5rr3r]r^rHrrR�
__classcell__rrrprr_(s
r_c@�HeZdZdZdZeZdejej	e
e
ffdd�Zdede
fdd�Z
d	S)
�ZshCompletezShell completion for Zsh.�zshrcCrrrsrvr{rrrrH_r~zZshComplete.get_completion_argsrPcCs(|j�d|j�d|jr|j��Sd��S)NrUr)r!r r"rQrrrrRks(zZshComplete.format_completionN)r.r/r0r1r+�_SOURCE_ZSHr8r3r]r^r5rHrrRrrrrr�Y�r�c@r�)
�FishCompletezShell completion for Fish.�fishrcCsHttjd�}tjd}|dd�}|r |r |d|kr |��||fS)Nrtrur���)rrwrx�pop)r(r|rJrIrrrrHus
z FishComplete.get_completion_argsrPcCs2|jr|j�d|j�d|j��S|j�d|j��S)Nr�	)r"r!r rQrrrrR�szFishComplete.format_completionN)r.r/r0r1r+�_SOURCE_FISHr8r3r]r^r5rHrrRrrrrr�or�r�)r`r�r��_available_shells�clsr+cCs|dur|j}|t|<dS)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�rcCs
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�s
rrM�paramcCsjt|t�sdS|jdusJ�|j|j}|jdkp4|�|j�tjup4|jdko4t|tt	f�o4t
|�|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+�params�nargs�get_parameter_sourcer
�COMMANDLINE�tuple�list�len)rMr�r rrr�_is_incomplete_argument�s

�
��r�r cCs"|sdS|d}|��o|dkS)z5Check if the value looks like the start of an option.Fr�/)�isalnum)r �crrr�_start_of_option�sr�rIcCsbt|t�sdS|jrdSd}tt|��D]\}}|d|jkr!nt|�r'|}q|duo0||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�r�is_flag�	enumerate�reversedr�r��opts)rIr��last_option�index�argrrr�_is_incomplete_option�s
�r�c	Cs�d|d<|j||��fi|��}|j|j}|rs|j}t|t�rn|jsB|�||�\}}}|dur2|S|j|||dd�}|j|j}n/|rc|�||�\}}}|durS|S|j|||dddd�}|j}|sD|}g|j�|j�}n	|S|s|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��allow_extra_args�allow_interspersed_argsr�)	�make_context�copy�protected_argsrI�commandr�r�chain�resolve_command)	r
rrrIrMr�r+�cmd�sub_ctxrrrrK�s@
���"rKrJcCs�|dkrd}nd|vrt|�r|�d�\}}}|�|�d|vr)t|�r)|j|fS|j�|�}|D]
}t||�r>||fSq1|D]
}t||�rN||fSqA|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.
    �=r9z--)r�r�appendr��
get_paramsr�r�)rMrIrJr+rr�r�rrrrLs"


�
�
rLr').rwr<�typingr3rr�corerrrrrr	r
�parserr�utilsrr[r5r4ryrrr�r�r�r7r_r�r�r��TyperZr6r�r�boolr�r�r^r�rKr]�UnionrLrrrr�<module>s�
�����
�&& &j1����
�

����
�4����
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY