HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_vendor/pyparsing/__pycache__/util.cpython-310.pyc
o

@%Ne��@s>ddlZddlZddlZddlZddlmZddlmZmZm	Z	e
d�ZGdd�d�Zedd�d	e
d
ede
fdd
��Zedd�d	e
d
ede
fdd��Zedd�d	e
d
edefdd��ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�de�Zdedefdd�Z	d$deee	efdedefdd �Zd!edefd"d#�ZdS)%�N)�	lru_cache)�List�Union�Iterable�\c@sZeZdZUdZgZeeed<gZeeed<dZ	e
dd��Ze
dd��Ze
d	d��Z
d
S)�__config_flagsz=Internal class for defining compatibility and debugging flags�
_all_names�_fixed_names�
configurationcCsb||jvrt�d�|j||jtt||������dS||j	vr(t
|||�dStd�|j|���)Nz'{}.{} {} is {} and cannot be overriddenzno such {} {!r})r	�warnings�warn�format�__name__�
_type_desc�str�getattr�upperr�setattr�
ValueError)�cls�dname�value�r�</usr/lib/python3/dist-packages/pip/_vendor/pyparsing/util.py�_sets
��
z__config_flags._setcC�|�|d�S)NT�r�r�namerrr�<lambda>$�z__config_flags.<lambda>cCr)NFrrrrrr%r N)r�
__module__�__qualname__�__doc__rrr�__annotations__r	r�classmethodr�enable�disablerrrrrs

r�)�maxsize�loc�strg�returncCsF|}d|krt|�krnn
||ddkrdS||�dd|�S)a�
    Returns current column within a string, counting newlines as line separators.
    The first column is number 1.

    Note: the default parsing behavior is to expand tabs in the input string
    before starting the parsing process.  See
    :class:`ParserElement.parseString` for more
    information on parsing strings containing ``<TAB>`` s, and suggested
    methods to maintain a consistent view of the parsed string, the parse
    location, and line and column positions within the parsed string.
    r��
)�len�rfind)r*r+�srrr�col(s
Br2cCs|�dd|�dS)a�Returns current line number within a string, counting newlines as line separators.
    The first line is number 1.

    Note - the default parsing behavior is to expand tabs in the input string
    before starting the parsing process.  See :class:`ParserElement.parseString`
    for more information on parsing strings containing ``<TAB>`` s, and
    suggested methods to maintain a consistent view of the parsed string, the
    parse location, and line and column positions within the parsed string.
    r.rr-)�count)r*r+rrr�lineno9sr4cCsB|�dd|�}|�d|�}|dkr||d|�S||dd�S)zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r.rr-N)r0�find)r*r+�last_cr�next_crrrr�lineGs(r8c@�eZdZdd�ZdS)�_UnboundedCachecspi��j�t�|_���fdd�}�fdd�}�fdd�}d|_t�||�|_t�||�|_t�||�|_dS)Nc�
�|��S�Nr��_�key��	cache_get�not_in_cacherr�getW�
z%_UnboundedCache.__init__.<locals>.getcs|�|<dSr<r�r>r?r��cacherr�set_Z�z&_UnboundedCache.__init__.<locals>.set_c����dSr<��clear�r>rFrrrL]rIz'_UnboundedCache.__init__.<locals>.clear)rC�objectrB�size�types�
MethodType�setrL)�selfrCrHrLr)rGrArBr�__init__Rsz_UnboundedCache.__init__N�rr!r"rTrrrrr:Q�r:c@r9)�
_FifoCachecsvt�|_�t����j���fdd�}��fdd�}�fdd�}�|_t�||�|_t�||�|_t�||�|_	dS)Ncr;r<rr=r@rrrClrDz _FifoCache.__init__.<locals>.getcs4|�|<t���kr�jdd�t���ks
dSdS�NF)�last)r/�popitemrE)rGrOrrrHos�z!_FifoCache.__init__.<locals>.set_crJr<rKrMrFrrrLtrIz"_FifoCache.__init__.<locals>.clear)
rNrB�collections�OrderedDictrCrOrPrQrRrL)rSrOrCrHrLr)rGrArBrOrrTgsz_FifoCache.__init__NrUrrrrrWfrVrWc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�LRUMemoz�
    A memoizing mapping that retains `capacity` deleted items

    The memo tracks retained items by their access order; once `capacity` items
    are retained, the least recently used item is discarded.
    cCs||_i|_t��|_dSr<)�	_capacity�_activer[r\�_memory)rS�capacityrrrrT�szLRUMemo.__init__cCs6z|j|WSty|j�|�|j|YSwr<)r_�KeyErrorr`�move_to_end�rSr?rrr�__getitem__�s�zLRUMemo.__getitem__cCs|j�|d�||j|<dSr<)r`�popr_�rSr?rrrr�__setitem__�szLRUMemo.__setitem__cCsbz|j�|�}Wn
tyYdSwt|j�|jkr*|jjdd�t|j�|jks||j|<dSrX)r_rfrbr/r`r^rZrgrrr�__delitem__�s��zLRUMemo.__delitem__cCs|j��|j��dSr<)r_rLr`)rSrrrrL�s
z
LRUMemo.clearN)	rr!r"r#rTrerhrirLrrrrr]}s
r]c@seZdZdZdd�ZdS)�
UnboundedMemoz<
    A memoizing mapping that retains all deleted items
    cCsdSr<rrdrrrri��zUnboundedMemo.__delitem__N)rr!r"r#rirrrrrj�srjr1cCs:dD]
}|�|t|�}q|�dd�}|�dd�}t|�S)Nz\^-[]r.z\n�	z\t)�replace�_bslashr)r1�crrr�_escape_regex_range_chars�s
rpT�	re_escapec		s�fdd��d�_t���_d�_dd��dd�}|s|�g}d	�tt|���}t|�d
krytj	|�d�D]B\}}t
|�}}tjt�
t|g�|�dd
���}||kr[|��|��q5t|�t|�dkrgd	nd}|�d��|�|�|���q5n	�fdd�|D�}d	�|�S)Ncs4t|�}|�j�_}||dkrt�j��_�jS)Nr-)�ord�prev�next�counterr)ro�c_intrs)�is_consecutiverrrw�s
z2_collapse_string_to_ranges.<locals>.is_consecutiver���cSs|dvrd|S|S)Nz\^-][�\r�rorrr�escape_re_range_char�sz8_collapse_string_to_ranges.<locals>.escape_re_range_charcSs|Sr<rrzrrr�no_escape_re_range_char�rkz;_collapse_string_to_ranges.<locals>.no_escape_re_range_char��)r?r-)�maxlen�-z{}{}{}csg|]}�|��qSrr)�.0ro)r{rr�
<listcomp>�sz._collapse_string_to_ranges.<locals>.<listcomp>)rs�	itertoolsr3rur�join�sortedrRr/�groupbyrtr[�deque�chain�iterrf�appendrrr
)	r1rqr|�retr>�chars�firstrY�sepr)r{rwr�_collapse_string_to_ranges�s:
�����
r��llcCs6g}|D]}t|t�r|�t|��q|�|�q|Sr<)�
isinstance�list�extend�_flattenr�)r�r��irrrr��s
r�)T)rrPr[r��	functoolsr�typingrrr�chrrnr�intrr2r4r8r:rWr]�dictrjrp�boolr�r�r�rrrr�<module>s8
	'	
���
�.