← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/click/__pycache__/shell_completion.cpython-312.pyc

302 lines

�

c�bjZX��>�UddlmZddlmZddlZddlZddlZddl	m	Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZ												d3d
�Zej,rddlmZeddej2��Znej0dd��ZGd�dej6e�ZdZdZdZGd�dej@�Z!Gd�d�Z"Gd�de"�Z#Gd�de"�Z$Gd �d!e"�Z%e#e%e$d"�Z&d#e'd$<ej0d%d�&�Z(	d4					d5d'�Z)ejTd6d(��Z+ejTd7d)��Z+ejTd8d*��Z+ejTd9d+��Z+d9d,�Z+d:d-�Z,d;d.�Z-d<d/�Z.d=d0�Z/										d>d1�Z0								d?d2�Z1y)@�)�annotationsN)�gettext�)�Argument)�Command)�Context)�Group)�Option)�	Parameter)�ParameterSource)�echoc��|jd�\}}}t|�}|�y|||||�}|dk(r*t|j�j	�d��y|dk(r(t|j�j	��yy)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.
    �_r�sourceF)�nlr�complete)�	partition�get_completion_classr
r�encoder)	�cli�ctx_args�	prog_name�complete_var�instruction�shellr�comp_cls�comps	         �m/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/click/shell_completion.py�shell_completers���&(�1�1�#�6��E�1�k�#�E�*�H�����C��9�l�;�D��h���T�[�[�]�
!�
!�
#��.���j� ��T�]�]�_�
#�
#�
%�&���)�TypeVar�
_ValueT_coT)�	covariant�default)r#c�<�eZdZdZdZ		d									dd�Zdd�Zy)	�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�_infoNc�<�||_||_||_||_y�Nr')�selfr(r)r*�kwargss     r�__init__zCompletionItem.__init__Xs ��"'��
���	� $��	���
r c�8�|jj|�Sr-)r+�get)r.�names  r�__getattr__zCompletionItem.__getattr__ds���z�z�~�~�d�#�#r )�plainN)
r(r"r)�strr*�
str | Noner/�t.Any�return�None)r3r6r9r8)�__name__�
__module__�__qualname__�__doc__�	__slots__r0r4�r rr&r&CsP���$3�I�
��	
��
��
��	
�
�
�
�
�$r r&a�%(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�,�eZdZUded<ded<ded<y)�_SourceVarsDictr6�
complete_funcrrN)r;r<r=�__annotations__r@r rrBrB�s�������Nr rBc��eZdZUdZded<	ded<	ded<ded<d	ed
<d	ed<										dd�Zedd
��Zdd�Zdd�Z	dd�Z
						dd�Zdd�Zdd�Z
y)�
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
    �t.ClassVar[str]r3�source_templaterr�cabc.MutableMapping[str, t.Any]rr6rrc�<�||_||_||_||_yr-)rrrr)r.rrrrs     rr0zShellComplete.__init__�s!����� ��
�"���(��r c��tjdd|jjdd�tj��}d|�d�S)zQThe name of the shell function defined by the completion
        script.
        z\W*��-r)�flags�_completion)�re�subr�replace�ASCII)r.�	safe_names  r�	func_namezShellComplete.func_names<��
�F�F�6�2�t�~�~�'=�'=�c�3�'G�r�x�x�X�	��9�+�[�)�)r c�J�|j|j|jd�S)z�Vars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )rCrr)rUrr�r.s r�source_varszShellComplete.source_vars	s%��"�^�^� �-�-����
�	
r c�<�|j|j�zS)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`.
        )rHrXrWs rrzShellComplete.sources���#�#�d�&6�&6�&8�8�8r c��t�)z�Use the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        ��NotImplementedErrorrWs r�get_completion_argsz!ShellComplete.get_completion_argss
��
"�!r c��t|j|j|j|�}t	|||�\}}|j||�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_contextrrr�_resolve_incompleter)r.�args�
incomplete�ctx�objs     r�get_completionszShellComplete.get_completions$sE���t�x�x��������M��-�c�4��D���Z��!�!�#�z�2�2r c��t�)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.
        r[�r.�items  r�format_completionzShellComplete.format_completion2s
��"�!r c��|j�\}}|j||�}|D�cgc]}|j|���}}dj|�Scc}w)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.
        �
)r]reri�join)r.rarb�completionsrh�outs      rrzShellComplete.complete:s\�� �3�3�5���j��*�*�4��<��8C�D���t�%�%�d�+���D��y�y��~���Es�AN)
rrrrIrr6rr6r9r:�r9r6)r9rB�r9ztuple[list[str], str])ra�	list[str]rbr6r9zlist[CompletionItem[str]]�rhzCompletionItem[str]r9r6)r;r<r=r>rDr0�propertyrUrXrr]rerirr@r rrFrF�s���
����
%�$��
�L�-�-��N���
)�
�
)�2�
)��	
)�
�
)�
�
)��*��*�

�9�"�3��3�+.�3�	"�3�"�
r rFc�d��eZdZUdZdZded<eZded<ed
d��Z	d�fd�Z
dd�Zd
d	�Z�xZ
S)�BashCompletezShell completion for Bash.�bashrGr3rHc��ddl}ddl}|jd�}|�d}nO|j|dddg|j��}tjd|jj��}|�;|j�\}}|dks
|dk(r|dkrttd	�d
��yyyttd�d
��y)
Nrrvz--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�PIPErP�searchrx�decode�groupsr
r)r{r|�bash_exe�match�output�major�minors       r�_check_versionzBashComplete._check_versionMs������<�<��'�����E��^�^��8�T�+C�D�!���$��F��I�I�3�V�]�]�5I�5I�5K�L�E��� �<�<�>�L�E�5��s�{�e�s�l�u�s�{���4����0;�l�
��T�U��
r c�@��|j�t�|�	�Sr-)r��superr)r.�	__class__s �rrzBashComplete.sourcens��������w�~��r c��ttjd�}ttjd�}|d|}	||}||fS#t$rd}Y||fSwxYw�N�
COMP_WORDS�
COMP_CWORDrrL��split_arg_string�os�environ�int�
IndexError�r.�cwords�cwordrarbs     rr]z BashComplete.get_completion_argsr�o��!�"�*�*�\�":�;���B�J�J�|�,�-���a����	����J��Z�����	��J��Z���	���A�A�Ac�8�|j�d|j��S)N�,)r)r(rgs  rrizBashComplete.format_completion~s���)�)��A�d�j�j�\�*�*r )r9r:rorp)rhzCompletionItem[t.Any]r9r6)r;r<r=r>r3rD�_SOURCE_BASHrH�staticmethodr�rr]ri�
__classcell__)r�s@rruruGs<���$�"�D�/�"�'3�O�_�3�����@ �
 �+r ruc�>�eZdZUdZdZded<eZded<d	d�Zd
d�Z	y)�ZshCompletezShell completion for Zsh.�zshrGr3rHc��ttjd�}ttjd�}|d|}	||}||fS#t$rd}Y||fSwxYwr�r�r�s     rr]zZshComplete.get_completion_args�r�r�c��|jxsd}|dk7r|jjdd�n|j}|j�d|�d|��S)Nr�:z\:rk)r*r(rRr))r.rh�help_r(s    rrizZshComplete.format_completion�sO���	�	� �S��38�3�,��
�
�"�"�3��.�D�J�J���)�)��B�u�g�R��w�/�/r Nrprr)
r;r<r=r>r3rD�_SOURCE_ZSHrHr]rir@r rr�r��s#��#�!�D�/�!�'2�O�_�2�
 �0r r�c�>�eZdZUdZdZded<eZded<d	d�Zd
d�Z	y)�FishCompletezShell completion for Fish.�fishrGr3rHc���ttjd�}tjd}|rt|�d}|dd}|r|r|d|k(r|j�||fS)Nr�r�rr�����)r�r�r��pop)r.r�rbras    rr]z FishComplete.get_completion_args�sf��!�"�*�*�\�":�;���Z�Z��-�
��)�*�5�a�8�J��a�b�z���$�4��8�z�#9��H�H�J��Z��r c���|jrJ|jjdd�jdd�}|j�d|j�d|��S|j�d|j��S)z�
        .. versionchanged:: 8.4.2
            Escape newlines and replace tabs with spaces in the help text to
            fix completion errors with multi-line help strings.
        rkz\n�	� r�)r*rRr)r()r.rhr�s   rrizFishComplete.format_completion�sf���9�9��I�I�%�%�d�E�2�:�:�4��E�E��i�i�[��$�*�*��R��w�7�7��)�)��A�d�j�j�\�*�*r Nrprr)
r;r<r=r>r3rD�_SOURCE_FISHrHr]rir@r rr�r��s#��$�"�D�/�"�'3�O�_�3� �+r r�)rvr�r�z't.Final[dict[str, type[ShellComplete]]]�_available_shells�_ShellCompleteT)�boundc�4�|�|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.
    )r3r�)�clsr3s  r�add_completion_classr��s"���|��x�x��!��d���Jr c��yr-r@�rs rrr����JMr c��yr-r@r�s rrr�r�r c��yr-r@r�s rrr�s��HKr c��yr-r@r�s rrr�s��DGr c�,�tj|�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�r2r�s rrr�s��� � ��'�'r c���ddl}|j|d��}d|_d|_g}	|D]}|j|��	|S#t$r|j|j
�Y|SwxYw)a�Split an argument string as with :func:`shlex.split`, but don't
    fail if the string is incomplete. Ignores a missing closing quote or
    incomplete escape sequence and uses the partial token as-is.

    .. code-block:: python

        split_arg_string("example 'my file")
        ["example", "my file"]

        split_arg_string("example my\")
        ["example", "my"]

    :param string: String to split.

    .. versionchanged:: 8.2
        Moved to ``shell_completion`` from ``parser``.
    rNT)�posixrL)�shlex�whitespace_split�
commenters�append�
ValueError�token)�stringr��lexrnr�s     rr�r��sw��$�
�+�+�f�D�+�
)�C��C���C�N�
�C���E��J�J�u����J��
��	�
�
�3�9�9���J�
�s�A�$A,�+A,c�l�t|t�sy|jj|j�}|j
dk(xsn|j
|j�tjuxsA|j
dkDxr0t|ttf�xrt|�|j
kS)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.
    Fr�r)�
isinstancer�paramsr2r3�nargs�get_parameter_sourcer�COMMANDLINE�tuple�list�len)rc�paramr(s   r�_is_incomplete_argumentr�s����e�X�&���J�J�N�N�5�:�:�&�E�
���r��	
��#�#�E�J�J�/��7R�7R�R�	
�
�K�K�!�O�
)��5�5�$�-�0�
)��E�
�U�[�[�(�
r c�.�|sy|d}||jvS)z5Check if the value looks like the start of an option.Fr)�
_opt_prefixes)rcr(�cs   r�_start_of_optionr�6s"����
�a��A���!�!�!�!r c��t|t�sy|js|jryd}t	t|��D])\}}|dz|jkDrnt||�s�'|}n|duxr||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�count�	enumerate�reversedr�r��opts)rcrar��last_option�index�args      r�_is_incomplete_optionr�?s}���e�V�$���}�}������K�����/�
��s��1�9�u�{�{�"���C��%��K��
0��d�"�@�{�e�j�j�'@�@r c	���d|d<|j||j�fi|��5}|j|jz}|r�|j}t|t�r�|js]|j||�\}}}|�|cddd�S|j|||d��5}|}|j|jz}ddd�nv|}|rT|j||�\}}}|�|cddd�S|j|||ddd��5}	|	}|j}ddd�|r�T|}g|j�|j�}nn|r��ddd�|S#1swY�xYw#1swY�CxYw#1swYSxYw)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_argsra�commandr�r	�chain�resolve_command)
rrrrarcr�r3�cmd�sub_ctx�sub_sub_ctxs
          rr_r_Xs���%)�H�
 �!�	��	�	�)�T�Y�Y�[�	=�H�	=���"�"�S�X�X�-����k�k�G��'�5�)��}�}�&-�&=�&=�c�4�&H�O�D�#�t��{�"�
>�	=��)�)��d�3�$�*�� �%��"�2�2�S�X�X�=��	��"�G��*1�*A�*A�#�t�*L���c�4��;�#&�3
>�	=�6!�-�-� � �#&�-1�49�.2�
.��)�&1�G�#*�<�<�D��
�""�C�D�W�4�4�D�w�|�|�D�D��M�
>�V�J�=������7
>�V�J�sN�AE$�E$�$E�&E$�0E$�E�
E$�! E$�E	�E$�E!	�E$�$E.c�r�|dk(rd}n6d|vr2t||�r&|jd�\}}}|j|�d|vrt||�r|j|fS|jj	|�}|D]}t|||�s�||fcS|D]}t
||�s�||fcS|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.
    �=rLz--)r�rr�r��
get_paramsr�r�)rcrarbr3rr�r�s       rr`r`�s����S���
�	�
�	�/��Z�@�(�2�2�3�7���a�����D���4��,�S�*�=��{�{�J�&�&�
�[�[�
#�
#�C�
(�F��� ��d�E�2��*�$�$����"�3��.��*�$�$���;�;�
�"�"r )rrrrIrr6rr6rr6r9zt.Literal[0, 1]r-)r��type[_ShellCompleteT]r3r7r9r�)rzt.Literal['bash']r9ztype[BashComplete])rzt.Literal['fish']r9ztype[FishComplete])rzt.Literal['zsh']r9ztype[ZshComplete])rr6r9ztype[ShellComplete] | None)r�r6r9rq)rcrr�rr9�bool)rcrr(r6r9r�)rcrrarqr�rr9r�)
rrrrIrr6rarqr9r)rcrrarqrbr6r9ztuple[Command | Parameter, str])2�
__future__r�collections.abc�abc�cabcr�rP�typing�trr�corerrrr	r
rr�utilsr
r�
TYPE_CHECKING�typing_extensionsr!�Anyr"�Genericr&r�r�r��	TypedDictrBrFrur�r�r�rDr�r��overloadrr�r�r�r�r_r`r@r r�<module>rs ��"��	�	�� �������!��$
�	�$
�-�$
��$
��	$
�
�$
��
$
�N�?�?�)����q�u�u�E�J�����<�4�8�J�"$�Q�Y�Y�z�*�"$�L��L*��X��.�a�k�k��l�l�^8+�=�8+�v!0�-�!0�H"+�=�"+�L
���>��:���!�)�)�-�_�E��48��	��&0����(���M��M����M��M����K��K����G��G�(�"�J�."�A�2:�	�:�-�:��:��	:�

�:�z,#�	�,#�!�,#�/2�,#�$�,#r