Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/contrib/regular_languages/__pycache__/completion.cpython-39.pyc
Ðазад
a d�h� � @ sf d Z ddlmZ ddlmZ ddlmZmZmZ ddl m Z ddlmZm Z dgZG d d� de�Zd S )z" Completer for a regular grammar. � )�annotations)�Iterable)� CompleteEvent� Completer� Completion)�Document� )�Match�_CompiledGrammar�GrammarCompleterc @ sV e Zd ZdZdddd�dd�Zdd d d�dd �Zdd d d�dd�Zd d d�dd�ZdS )r af Completer which can be used for autocompletion according to variables in the grammar. Each variable can have a different autocompleter. :param compiled_grammar: `GrammarCompleter` instance. :param completers: `dict` mapping variable names of the grammar to the `Completer` instances to be used for each variable. r zdict[str, Completer]�None)�compiled_grammar� completers�returnc C s || _ || _d S �N)r r )�selfr r � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/contrib/regular_languages/completion.py�__init__ s zGrammarCompleter.__init__r r zIterable[Completion])�document�complete_eventr c c s. | j �|j�}|r*| �| �||��E d H d S r )r Zmatch_prefixZtext_before_cursor�_remove_duplicates�_get_completions_for_match)r r r �mr r r �get_completions# s �z GrammarCompleter.get_completionsr )�matchr r c c s� |� � D ]�}|j}|j}| j�|�}|r|j}| j�||�}t|t |��} |� | |�D ]J} |dt |�| j � | j }t | j�||�|t |j� | j| jd�V qVqdS )z� Yield all the possible completions for this input string. (The completer assumes that the cursor position was at the end of the input string.) N)�text�start_position�display�display_meta)Z end_nodes�varname�startr �get�valuer �unescaper �lenr r r r �escape�stringr r )r r r Zmatch_variabler r! Z completerr Zunwrapped_textr � completion�new_textr r r r - s&