File: //home/arjun/projects/env/lib/python3.10/site-packages/kombu/utils/__pycache__/text.cpython-310.pyc
o
'we� � @ s� d Z ddlmZ ddlmZ ddlmZmZ ddlm Z d'dd�Z
d(d)dd�Zd(d*dd�Zd+dd�Z
d,d-d!d"�Zd.d/d$d%�Zd&S )0zText Utilities.� )�annotations)�SequenceMatcher)�Iterable�Iterator)�version_info_t� c s d� � fdd�| D ��S )z2Escape string for use within a regular expression.r c 3 s8 � | ]}|� � s|� v r|n |d krdnd| V qdS )� z\000�\N)�isalnum)�.0�c��white� �I/home/arjun/projects/env/lib/python3.10/site-packages/kombu/utils/text.py� <genexpr> s � �
�zescape_regex.<locals>.<genexpr>)�join)�pr r r
r �escape_regex
s �r �333333�?�needle�str�haystack�
Iterable[str]� min_ratio�float�return�Iterator[tuple[float, str]]c c s2 � |D ]}t d| |��� }||kr||fV qdS )zVFuzzy match: iteratively.
Yields
------
Tuple: of ratio and key.
N)r �ratio)r r r �keyr r r r �fmatch_iter s �
��r �
str | Nonec C s4 zt t| ||�dd�d d W S ty Y dS w )z'Fuzzy match - Find best match (scalar).T)�reverser � N)�sortedr �
IndexError)r r r r r r �fmatch_best# s ����r&