� K�g�H� �h�UddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZd edejeejfdedededef d�ZGd�d��ZdZdZdZGd�d��ZGd�de��ZGd�de��ZGd�d e��Zejd!ej e�"��Z!eeed#�Z"ej#eej efe$d$< d4d%e!d&ej%ede!fd'�Z&d(edej%ej efd)�Z'd*e d+e de(fd,�Z)d*e d-ede(fd.�Z*d*e d/ej+ed+e de(fd0�Z,d edejeejfded/ej+ede f d1�Z-d*e d/ej+ed2edej.ej/ee feffd3�Z0dS)5�N)�gettext�)�Argument)� BaseCommand)�Context)� MultiCommand)�Option)� Parameter)�ParameterSource)�split_arg_string)�echo�cli�ctx_args� prog_name� complete_var� instruction�returnc��|�d��\}}}t|��}|�dS|||||��}|dkr#t|�����dS|dkr#t|�����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) rrrrr�shellr�comp_cls�comps �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/click/shell_completion.py�shell_completers���&(�1�1�#�6�6��E�1�k�#�E�*�*�H����q� �8�C��9�l� ;� ;�D��h��� �T�[�[�]�]�����q��j� � � �T�]�]�_�_�����q� �1�c �|�eZdZdZdZ d dejdedejedejd df d �Z d ed ejfd �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%�kwargsrc �>�||_||_||_||_dS�Nr")�selfr#r$r%r(s r�__init__zCompletionItem.__init__Ls$��"�� ��� �%)�� ��� � � r�namec�6�|j�|��Sr*)r&�get)r+r-s r� __getattr__zCompletionItem.__getattr__Xs���z�~�~�d�#�#�#r)r'N) �__name__� __module__� __qualname__�__doc__� __slots__�t�Any�str�Optionalr,r0�rrr!r!7s���������$3�I� � $� � ��u� �� ��j��o� � �%� � � � � � �$��$���$�$�$�$�$�$rr!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 ��eZdZUdZejeed< ejeed< dedej eej fdededd f d �Z e defd ���Z dejeej ffd �Zdefd �Zdejejeeffd�Zdejededejefd�Zdedefd�Zdefd�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_templaterrrrrNc�>�||_||_||_||_dSr*)rrrr)r+rrrrs rr,zShellComplete.__init__�s'����� �� �"���(����rc��tjdd|j�dd��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_name�sA�� �F�6�2�t�~�'=�'=�c�3�'G�'G�r�x�X�X�X� �)�9�)�)�)�)rc�,�|j|j|jd�S)z�Vars for formatting :attr:`source_template`. By default this provides ``complete_func``, ``complete_var``, and ``prog_name``. )� complete_funcrr)rIrr�r+s r� source_varszShellComplete.source_vars�s#��"�^� �-��� � � rc�:�|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`. )r=rMrLs rrzShellComplete.source�s�� �#�d�&6�&6�&8�&8�8�8rc��t�)z�Use the env vars defined by the shell script to return a tuple of ``args, incomplete``. This must be implemented by subclasses. ��NotImplementedErrorrLs r�get_completion_argsz!ShellComplete.get_completion_argss �� "�!r�args� incompletec��t|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_contextrrr�_resolve_incompleter)r+rSrT�ctx�objs r�get_completionszShellComplete.get_completionssH���t�x������M�M��-�c�4��D�D���Z��!�!�#�z�2�2�2r�itemc��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. rP�r+r[s r�format_completionzShellComplete.format_completions �� "�!rc�������\}}��||��}�fd�|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. c�:��g|]}��|����Sr:)r^)�.0r[r+s �r� <listcomp>z*ShellComplete.complete.<locals>.<listcomp>&s'���D�D�D��t�%�%�d�+�+�D�D�Dr� )rRrZ�join)r+rSrT� completions�outs` rrzShellComplete.completesY��� �3�3�5�5���j��*�*�4��<�<� �D�D�D�D� �D�D�D���y�y��~�~�r)r1r2r3r4r6�ClassVarr8�__annotations__r�MutableMappingr7r,�propertyrI�DictrMr�Tuple�ListrRr!rZr^rr:rrr<r<�s�������� � � �*�S�/����� �Z��_�$�$�$�� )� � )��"�3���:�.� )�� )� � )� � )� )� )� )��*�3�*�*�*��X�*�  �Q�V�C���J�/�  �  �  �  �9��9�9�9�9�"�Q�W�Q�V�C�[�#�-=�%>�"�"�"�"� 3��F�3�K� 3�-0� 3� ��� � 3� 3� 3� 3�"�n�"��"�"�"�"� �#� � � � � � rr<c���eZdZdZdZeZed d���Zde f�fd� Z de j e j e e ffd�Zdede fd �Z�xZS) � BashCompletezShell completion for Bash.�bashrNc��ddl}ddl}|�d��}|�d}nL|�|dddg|j���}t jd|j�����}|�M|� ��\}}|dks |dkr&|dkr"ttd ��d � ��dSdSdSttd ��d � ��dS) Nrrpz--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�PIPErD�searchrr�decode�groupsr r)rurv�bash_exe�match�output�major�minors r�_check_versionzBashComplete._check_version0s&��� � � ������<�<��'�'�� � ��E�E��^�^��8�T�+C�D�!��$���F��I�3�V�]�5I�5I�5K�5K�L�L�E� � � �<�<�>�>�L�E�5��s�{�{�e�s�l�l�u�s�{�{���4���� ������+�l�{�{� ��T�U�U�� � � � � � rc�l��|���t�����Sr*)r��superr)r+� __class__s �rrzBashComplete.sourceQs)��� �������w�w�~�~���rc���ttjd��}ttjd��}|d|�} ||}n#t$rd}YnwxYw||fS�N� COMP_WORDS� COMP_CWORDrr@�r �os�environ�int� IndexError�r+�cwords�cwordrSrTs rrRz BashComplete.get_completion_argsU�x��!�"�*�\�":�;�;���B�J�|�,�-�-���a��g��� ����J�J��� � � ��J�J�J� �����Z���� A� A"�!A"r[c�$�|j�d|j��S)N�,)r$r#r]s rr^zBashComplete.format_completionas���)�*�*�d�j�*�*�*r)rN)r1r2r3r4r-� _SOURCE_BASHr=� staticmethodr�r8rr6rlrmrRr!r^� __classcell__)r�s@rroro*s��������$�$� �D�"�O������\��@ �� � � � � � �  �Q�W�Q�V�C�[�#�-=�%>�  �  �  �  �+�n�+��+�+�+�+�+�+�+�+rroc�f�eZdZdZdZeZdejej e e ffd�Z de de fd�Z dS)� ZshCompletezShell completion for Zsh.�zshrc���ttjd��}ttjd��}|d|�} ||}n#t$rd}YnwxYw||fSr�r�r�s rrRzZshComplete.get_completion_argskr�r�r[c�F�|j�d|j�d|jr|jnd��S)Nrcr)r$r#r%r]s rr^zZshComplete.format_completionws/���)�N�N�t�z�N�N�$�)�-L�T�Y�Y��N�N�NrN)r1r2r3r4r-� _SOURCE_ZSHr=r6rlrmr8rRr!r^r:rrr�r�es{������#�#� �D�!�O�  �Q�W�Q�V�C�[�#�-=�%>�  �  �  �  �O�n�O��O�O�O�O�O�Orr�c�f�eZdZdZdZeZdejej e e ffd�Z de de fd�Z dS)� FishCompletezShell completion for Fish.�fishrc���ttjd��}tjd}|dd�}|r"|r |d|kr|���||fS)Nr�r�r�����)r r�r��pop)r+r�rTrSs rrRz FishComplete.get_completion_args�sf��!�"�*�\�":�;�;���Z� �-� ��a�b�b�z�� � �$� �4��8�z�#9�#9� �H�H�J�J�J��Z��rr[c�d�|jr|j�d|j�d|j��S|j�d|j��S)Nr�� )r%r$r#r]s rr^zFishComplete.format_completion�sF�� �9� <��i�;�;�$�*�;�;�� �;�;� ;��)�*�*�d�j�*�*�*rN)r1r2r3r4r-� _SOURCE_FISHr=r6rlrmr8rRr!r^r:rrr�r�{ss������$�$� �D�"�O�  �Q�W�Q�V�C�[�#�-=�%>�  �  �  �  �+�n�+��+�+�+�+�+�+rr��ShellCompleteType)�bound)rpr�r��_available_shells�clsr-c�,�|�|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. )r-r�)r�r-s r�add_completion_classr��s �� �|��x��!��d�� �Jrrc�6�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/)rs rrr�s�� � � �� '� '�'rrX�paramc�`�t|t��sdS|j�J�|j�|j��}|jdkpd|�|j��tjup>|jdko3t|ttf��ot|��|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/�nargs�get_parameter_sourcer � COMMANDLINE�tuple�list�len)rXr�r#s r�_is_incomplete_argumentr��s��� �e�X� &� &���u� �:� !� !� !� �J�N�N�5�:� &� &�E� � �r�� � � #� #�E�J� /� /��7R� R� � �K�!�O� )��5�5�$�-�0�0� )��E� � �U�[�(� rr#c�,�|sdS|d}||jvS)z5Check if the value looks like the start of an option.Fr)� _opt_prefixes)rXr#�cs r�_start_of_optionr��s&�� ���u� �a��A� ��!� !�!rrSc���t|t��sdS|js|jrdSd}t t |����D]'\}}|dz|jkrnt||��r|}�(|duo||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)rXrSr�� last_option�index�args r�_is_incomplete_optionr��s��� �e�V� $� $���u� �}��� ���u��K������/�/��� ��s� �1�9�u�{� "� "� �E� �C�� %� %� ��K�� �d� "� @�{�e�j�'@�@rc��d|d<|j||���fi|��}|j|jz}|r�|j}t |t ��r�|jsG|�||��\}}}|�|S|�|||d���}|j|jz}nZ|}|rB|�||��\}}}|�|S|�|||ddd���}|j}|�B|}g|j�|j�}nn|��|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_argsrS�commandr�r�chain�resolve_command) rrrrSrXr�r-�cmd�sub_ctxs rrVrV�se��%)�H� �!� �#� �9�d�i�i�k�k� >� >�X� >� >�C� � ��� (�D� �"��+�� �g�|� ,� ,� ��=� @�")�"9�"9�#�t�"D�"D���c�4��;��J��&�&�t�T�#�QU�&�V�V���)�C�H�4������(�&-�&=�&=�c�4�&H�&H�O�D�#�t��{�"� �!�.�.���"�)-�05�*.� /���G�#�<�D��(� ��?��/�?�'�,�?��� �E �"�H �JrrTc��|dkrd}nBd|vr>t||��r.|�d��\}}}|�|��d|vrt||��r |j|fS|j�|��}|D]}t |||��r||fcS�|D]}t ||��r||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. �=r@z--)r�r�appendr�� get_paramsr�r�)rXrSrTr-rr�r�s rrWrW/s���S���� � � � � � �/��Z�@�@� �(�2�2�3�7�7���a�� � � �D����  �4���,�S�*�=�=���{�J�&�&� �[� #� #�C� (� (�F��%�%�� ��d�E� 2� 2� %��*�$� $� $� $� %� �%�%�� "�3�� .� .� %��*�$� $� $� $� %� �;� � "�"rr*)1r�rD�typingr6rr�corerrrrr r r �parserr �utilsr rir8r7r�rr!r�r�r�r<ror�r��TypeVar�Typer�r�rkrhr9r�r�boolr�r�rmr�rVrl�UnionrWr:rr�<module>r�s9�� � � � � � � � � ����� � � � � � �������������������������������������!�!�!�!�!�!�$�$�$�$�$�$�������# � �# ���s�A�E�z�*�# ��# �� # � � # �  � # �# �# �# �L"$�"$�"$�"$�"$�"$�"$�"$�L� �@*� �X� �.g�g�g�g�g�g�g�g�T8+�8+�8+�8+�8+�=�8+�8+�8+�vO�O�O�O�O�-�O�O�O�,+�+�+�+�+�=�+�+�+�2�A�I�1��� �9N�O�O�O�� � � �9�9��1�6�#�q�v�m�4�4�5����59��� ��"#�*�S�/�������((��(�� �1�6�-�3H�(I�(�(�(�(������t�����2"�'�"�#�"�$�"�"�"�"�A�w�A�a�f�S�k�A�)�A�PT�A�A�A�A�06� �6���s�A�E�z�*�6��6� �&��+� 6�  � 6�6�6�6�r,#� �,#���s� �,#�14�,#��W�Q�W�[�)�+� ,�c� 1�2�,#�,#�,#�,#�,#�,#r
Memory