Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/completion/__pycache__/fuzzy_completer.cpython-39.pyc
Ðазад
a d�h: � @ s� d dl mZ d dlZd dlmZmZmZmZ d dlm Z d dl mZmZ d dl mZmZ ddlmZmZmZ dd lmZ d dgZG dd � d e�ZG d d� de�ZG dd� de�ZdS )� )�annotationsN)�Callable�Iterable� NamedTuple�Sequence)�Document)�FilterOrBool� to_filter)�AnyFormattedText�StyleAndTextTuples� )� CompleteEvent� Completer� Completion)� WordCompleter�FuzzyCompleter�FuzzyWordCompleterc @ sl e Zd ZdZdddddd d �dd�Zd ddd�dd�Zdd�dd�Zd ddd�dd�Zdddd�dd�ZdS )r a Fuzzy completion. This wraps any other completer and turns it into a fuzzy completer. If the list of words is: ["leopard" , "gorilla", "dinosaur", "cat", "bee"] Then trying to complete "oar" would yield "leopard" and "dinosaur", but not the others, because they match the regular expression 'o.*a.*r'. Similar, in another application "djm" could expand to "django_migrations". The results are sorted by relevance, which is defined as the start position and the length of the match. Notice that this is not really a tool to work around spelling mistakes, like what would be possible with difflib. The purpose is rather to have a quicker or more intuitive way to filter the given completions, especially when many completions have a common prefix. Fuzzy algorithm is based on this post: https://blog.amjith.com/fuzzyfinder-in-10-lines-of-python :param completer: A :class:`~.Completer` instance. :param WORD: When True, use WORD characters. :param pattern: Regex pattern which selects the characters before the cursor that are considered for the fuzzy matching. :param enable_fuzzy: (bool or `Filter`) Enabled the fuzzy behavior. For easily turning fuzzyness on or off according to a certain condition. FNTr �boolz str | Noner �None)� completer�WORD�pattern�enable_fuzzy�returnc C s<