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/prompt_toolkit/completion/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/__pycache__/nested.cpython-39.pyc
a

��Sh�@s�dZddlmZddlmZmZmZmZmZddl	m
Z
mZmZddl
mZddlmZdgZeeeeeedeffZGd	d�de�ZdS)
zA
Nestedcompleter for completion of hierarchical data structures.
�)�annotations)�Any�Iterable�Mapping�Set�Union)�
CompleteEvent�	Completer�
Completion)�
WordCompleter)�Document�NestedCompleterNc@sXeZdZdZddddd�dd�Zd	d
�dd�Zed
dd�dd��Zdddd�dd�ZdS)r
a�
    Completer which wraps around several other completers, and calls any the
    one that corresponds with the first word of the input.

    By combining multiple `NestedCompleter` instances, we can achieve multiple
    hierarchical levels of autocompletion. This is useful when `WordCompleter`
    is not sufficient.

    If you need multiple levels, check out the `from_nested_dict` classmethod.
    Tzdict[str, Completer | None]�bool�None)�options�ignore_case�returncCs||_||_dS)N�rr)�selfrr�r�J/usr/local/lib/python3.9/site-packages/prompt_toolkit/completion/nested.py�__init__szNestedCompleter.__init__�str)rcCsd|j�d|j�d�S)NzNestedCompleter(z, ignore_case=�)r)rrrr�__repr__%szNestedCompleter.__repr__�
NestedDict)�datarcCs�i}|��D]j\}}t|t�r(|||<qt|t�rB|�|�||<qt|t�rb|�t�|��||<q|dusnJ�d||<q||�S)a�
        Create a `NestedCompleter`, starting from a nested dictionary data
        structure, like this:

        .. code::

            data = {
                'show': {
                    'version': None,
                    'interfaces': None,
                    'clock': None,
                    'ip': {'interface': {'brief'}}
                },
                'exit': None
                'enable': None
            }

        The value should be `None` if there is no further completion at some
        point. If all values in the dictionary are None, it is also possible to
        use a set instead.

        Values in this data structure can be a completers as well.
        N)�items�
isinstancer	�dict�from_nested_dict�set�fromkeys)�clsrr�key�valuerrrr (s




z NestedCompleter.from_nested_dictrrzIterable[Completion])�document�complete_eventrc
cs�|j��}t|j�t|�}d|vr�|��d}|j�|�}|dur�|t|�d���}t|�t|�|}t||j|d�}	|�|	|�EdHn*t	t
|j���|jd�}|�||�EdHdS)N� r)�cursor_position)r)
Ztext_before_cursor�lstrip�len�splitr�getrr)�get_completionsr�list�keysr)
rr&r'�textZstripped_lenZ
first_termZ	completerZremaining_textZmove_cursorZnew_documentrrrr.Os"
��zNestedCompleter.get_completionsN)T)	�__name__�
__module__�__qualname__�__doc__rr�classmethodr r.rrrrr
s�&)r5�
__future__r�typingrrrrrZprompt_toolkit.completionrr	r
Z(prompt_toolkit.completion.word_completerrZprompt_toolkit.documentr�__all__rrr
rrrr�<module>s

Yohohohohohooho | Sanrei Aya