HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/pyparsing/__pycache__/util.cpython-37.pyc
B

�f%d��@s(ddlZddlZddlZddlZddlmZddlmZmZm	Z	e
d�ZGdd�d�Zedd�e
ee
d	�d
d��Zedd�e
ee
d	�dd
��Zedd�e
eed	�dd��ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�de�Zeed�dd�Zd"eee	efeed�dd�Zeed�d 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_namesZ
configurationcCsd||jkr6t�d�|j||jtt||������dS||j	krNt
|||�ntd�|j|���dS)Nz'{}.{} {} is {} and cannot be overriddenzno such {} {!r})r	�warnings�warn�format�__name__�
_type_desc�str�getattr�upperr�setattr�
ValueError)�clsZdname�value�r�?/opt/alt/python37/lib/python3.7/site-packages/pyparsing/util.py�_sets

z__config_flags._setcCs|�|d�S)NT)r)r�namerrr�<lambda>$�z__config_flags.<lambda>cCs|�|d�S)NF)r)rrrrrr%rN)r
�
__module__�__qualname__�__doc__rrr�__annotations__r	r�classmethodrZenableZdisablerrrrrs
r�)�maxsize)�loc�strg�returncCsF|}d|krt|�kr4nn||ddkr4dS||�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
r+cCs|�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�lineno9sr-cCsB|�dd|�}|�d|�}|dkr2||d|�S||dd�S)zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r'rr&N)r)�find)r#r$Zlast_crZnext_crrrr�lineGsr/c@seZdZdd�ZdS)�_UnboundedCachecspi��j�t�|_���fdd�}�fdd�}�fdd�}d|_t�||�|_t�||�|_t�||�|_dS)Ncs
�|��S)Nr)�_�key)�	cache_get�not_in_cacherr�getWsz%_UnboundedCache.__init__.<locals>.getcs|�|<dS)Nr)r1r2r)�cacherr�set_Zsz&_UnboundedCache.__init__.<locals>.set_cs���dS)N)�clear)r1)r6rrr8]sz'_UnboundedCache.__init__.<locals>.clear)r5�objectr4�size�types�
MethodType�setr8)�selfr5r7r8r)r6r3r4r�__init__Rsz_UnboundedCache.__init__N)r
rrr?rrrrr0Qsr0c@seZdZdd�ZdS)�
_FifoCachecsvt�|_�t����j���fdd�}��fdd�}�fdd�}�|_t�||�|_t�||�|_t�||�|_	dS)Ncs
�|��S)Nr)r1r2)r3r4rrr5lsz _FifoCache.__init__.<locals>.getcs*|�|<xt���kr$�jdd�q
WdS)NF)�last)r(�popitem)r1r2r)r6r:rrr7osz!_FifoCache.__init__.<locals>.set_cs���dS)N)r8)r1)r6rrr8tsz"_FifoCache.__init__.<locals>.clear)
r9r4�collections�OrderedDictr5r:r;r<r=r8)r>r:r5r7r8r)r6r3r4r:rr?gsz_FifoCache.__init__N)r
rrr?rrrrr@fsr@c@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��|_dS)N)�	_capacity�_activerCrD�_memory)r>Zcapacityrrrr?�szLRUMemo.__init__cCs6y
|j|Stk
r0|j�|�|j|SXdS)N)rG�KeyErrorrH�move_to_end)r>r2rrr�__getitem__�s

zLRUMemo.__getitem__cCs|j�|d�||j|<dS)N)rH�poprG)r>r2rrrr�__setitem__�szLRUMemo.__setitem__cCsXy|j�|�}Wntk
r$Yn0Xx"t|j�|jkrH|jjdd�q(W||j|<dS)NF)rA)rGrLrIr(rHrFrB)r>r2rrrr�__delitem__�szLRUMemo.__delitem__cCs|j��|j��dS)N)rGr8rH)r>rrrr8�s
z
LRUMemo.clearN)	r
rrrr?rKrMrNr8rrrrrE}s
rEc@seZdZdZdd�ZdS)�
UnboundedMemoz<
    A memoizing mapping that retains all deleted items
    cCsdS)Nr)r>r2rrrrN�szUnboundedMemo.__delitem__N)r
rrrrNrrrrrO�srO)r*r%cCs>xdD]}|�|t|�}qW|�dd�}|�dd�}t|�S)Nz\^-[]r'z\n�	z\t)�replace�_bslashr)r*�crrr�_escape_regex_range_chars�s

rTT)r*�	re_escaper%c		s�fdd��d�_t���_d�_dd��dd�}|s:|�g}d	�tt|���}t|�d
kr�x�tj	|�d�D]�\}}t
|�}}tjt�
t|g�|�dd
���}||kr�|��|��qlt|�t|�dkr�d	nd}|�d��|�|�|���qlWn�fdd�|D�}d	�|�S)Ncs4t|�}|�j�_}||dkr.t�j��_�jS)Nr&)�ord�prev�next�counterr)rSZc_intrW)�is_consecutiverrrZ�s
z2_collapse_string_to_ranges.<locals>.is_consecutiver���cSs|dkrd|S|S)Nz\^-][�\r)rSrrr�escape_re_range_char�sz8_collapse_string_to_ranges.<locals>.escape_re_range_charcSs|S)Nr)rSrrr�no_escape_re_range_char�sz;_collapse_string_to_ranges.<locals>.no_escape_re_range_char��)r2r&)�maxlen�-z{}{}{}csg|]}�|��qSrr)�.0rS)r]rr�
<listcomp>�sz._collapse_string_to_ranges.<locals>.<listcomp>)rW�	itertoolsr,rYr�join�sortedr=r(�groupbyrXrC�deque�chain�iterrL�appendrVr)	r*rUr^�retr1�chars�firstrA�sepr)r]rZr�_collapse_string_to_ranges�s.
rq)�llr%cCs:g}x0|D](}t|t�r(|�t|��q
|�|�q
W|S)N)�
isinstance�list�extend�_flattenrl)rrrm�irrrrv�s

rv)T)r
r;rCre�	functoolsr�typingrrr�chrrRr�intrr+r-r/r0r@rE�dictrOrT�boolrqrtrvrrrr�<module>s*
	'	
,