Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/contrib/regular_languages/__pycache__/validation.cpython-39.pyc
Ðазад
a d�h � @ sR d Z ddlmZ ddlmZ ddlmZmZ ddlm Z dgZ G dd� de�Zd S ) z# Validator for a regular language. � )�annotations)�Document)�ValidationError� Validator� )�_CompiledGrammar�GrammarValidatorc @ s2 e Zd ZdZdddd�dd�Zddd �d d�ZdS ) r aZ Validator which can be used for validation according to variables in the grammar. Each variable can have its own validator. :param compiled_grammar: `GrammarCompleter` instance. :param validators: `dict` mapping variable names of the grammar to the `Validator` instances to be used for each variable. r zdict[str, Validator]�None)�compiled_grammar� validators�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/validation.py�__init__ s zGrammarValidator.__init__r )�documentr c C s� | j �|j�}|r�|�� D ]�}| j�|j�}|r| j �|j|j�}t |t |��}z|�|� W q ty� } z$t|j |j |jd�|�W Y d }~qd }~0 0 qntt |j�dd��d S )N)�cursor_position�messagezInvalid command)r �match�text� variablesr �get�varname�unescape�valuer �len�validater �startr r )r r �m�v� validatorZunwrapped_textZinner_document�er r r r ! s&