%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pyparsing/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pyparsing/__pycache__/util.cpython-312.pyc

�

&
�d�!����ddlZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZmZm
Z
mZed�Ze
de	��ZGd�d�Zed	�
�deded
efd��Zed	�
�deded
efd��Zed	�
�deded
efd��ZGd�d�ZGd�d�ZGd�d�ZGd�de�Zded
efd�Z	d#deeeefded
efd�Zde d
e fd�Z!ded ed
efd!�Z"d ed
e	e	geffd"�Z#y)$�N)�	lru_cache�wraps)�Callable�List�Union�Iterable�TypeVar�cast�\�C)�boundc�r�eZdZUdZgZeeed<gZeeed<dZ	e
d��Ze
d��Ze
d��Z
y)	�__config_flagsz=Internal class for defining compatibility and debugging flags�
_all_names�_fixed_names�
configurationc�>�||jvrYtj|j�d|�d|j�dtt
||��j��d�d��y||jvrt|||�ytd|j�d|����)N�.� z is z and cannot be overridden�)�
stacklevelzno such )r�warnings�warn�__name__�
_type_desc�str�getattr�upperr�setattr�
ValueError)�cls�dname�values   �0/usr/lib/python3/dist-packages/pyparsing/util.py�_setz__config_flags._sets����C�$�$�$��M�M��<�<�.��%���#�.�.�)9��c�'�#�u�BU�>V�>\�>\�>^�=_�+�-��
�

��C�N�N�"��C���&��x����'7�q��	�B�C�C�c�&�|j|d�S)NT�r%�r!�names  r$�<lambda>z__config_flags.<lambda>#s��3�8�8�D�$�+?�r&c�&�|j|d�S)NFr(r)s  r$r+z__config_flags.<lambda>$s��C�H�H�T�5�,A�r&N)r�
__module__�__qualname__�__doc__rrr�__annotations__rr�classmethodr%�enable�disable�r&r$rrsR��G��J��S�	�� �L�$�s�)� � �J��D��D��?�
@�F��A�B�Gr&r�)�maxsize�loc�strg�returnc�z�|}d|cxkrt|�krnn
||dz
dk(rdS||jdd|�z
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.parse_string` 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)r7r8�ss   r$�colr@'sG��	
�A��C� �#�a�&� �Q�s�Q�w�Z�4�%7�1�X�S�1�7�7�4�QR�TW�CX�=X�Xr&c�.�|jdd|�dzS)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.parse_string`
    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)r7r8s  r$�linenorC8s���:�:�d�A�s�#�a�'�'r&c�v�|jdd|�}|jd|�}|dk\r||dz|S||dzdS)zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r<rr;N)r>�find)r7r8�last_cr�next_crs    r$�linerHFsM��
�j�j��q�#�&�G��i�i��c�"�G�*1�Q�,�4��!��g�&�O�D��1���<O�Or&c��eZdZd�Zy)�_UnboundedCachec�����i��j�t�x|_���fd�}�fd�}�fd�}d|_t	j
||�|_t	j
||�|_t	j
||�|_y)Nc����|��S�Nr4��_�key�	cache_get�not_in_caches  ��r$�getz%_UnboundedCache.__init__.<locals>.getV�����S�,�/�/r&c���|�|<yrMr4)rOrPr#�caches   �r$�set_z&_UnboundedCache.__init__.<locals>.set_Ys����E�#�Jr&c�&���j�yrM)�clear)rOrVs �r$rYz'_UnboundedCache.__init__.<locals>.clear\s����K�K�Mr&)rS�objectrR�size�types�
MethodType�setrY)�selfrSrWrYrVrQrRs    @@@r$�__init__z_UnboundedCache.__init__Qst������I�I�	�+1�8�3���L�	0�	�	���	��#�#�C��.����#�#�D�$�/����%�%�e�T�2��
r&N�rr-r.r`r4r&r$rJrJPs��3r&rJc��eZdZd�Zy)�
_FifoCachec�������	�
�t�x|_�
i�t�g�z�	�j��j�t	j
t
������
fd�}����	fd�}��	�fd�}�|_tj||�|_tj||�|_
tj||�|_y)Nc����|��SrMr4rNs  ��r$rSz _FifoCache.__init__.<locals>.getnrTr&c�H��|�|<t��}��|d�|�|<yrM)�next)rOrPr#�irV�	cache_pop�keyiter�keyrings    ����r$rWz!_FifoCache.__init__.<locals>.set_qs,����E�#�J��W�
�A��g�a�j�$�'��G�A�Jr&c�H���j�t�g�z�ddyrM)rYrZ)rOrVrkr[s ���r$rYz"_FifoCache.__init__.<locals>.clearws����K�K�M� �(��d�*�G�A�Jr&)rZrRrS�pop�	itertools�cycle�ranger[r\r]r^rY)r_r[rSrWrYrVrQrirjrkrRs `   @@@@@@r$r`z_FifoCache.__init__fs����+1�8�3���L����8�*�t�#���I�I�	��I�I�	��/�/�%��+�.��	0�	�	+���	��#�#�C��.����#�#�D�$�/����%�%�e�T�2��
r&Nrar4r&r$rcrces��3r&rcc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�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.
    c�R�||_i|_tj�|_yrM)�	_capacity�_active�collections�OrderedDict�_memory)r_�capacitys  r$r`zLRUMemo.__init__�s ��!������"�.�.�0��r&c��	|j|S#t$r-|jj|�|j|cYSwxYwrM)ru�KeyErrorrx�move_to_end�r_rPs  r$�__getitem__zLRUMemo.__getitem__�sF��	%��<�<��$�$���	%��L�L�$�$�S�)��<�<��$�$�	%�s��3A�Ac�Z�|jj|d�||j|<yrM)rxrmru�r_rPr#s   r$�__setitem__zLRUMemo.__setitem__�s$��������d�#�!����S�r&c�:�	|jj|�}t|j�|jk\r?|jjd��t|j�|jk\r�?||j|<y#t$rYywxYw)NF)�last)rurmr=rxrt�popitemr{r�s   r$�__delitem__zLRUMemo.__delitem__�s���	&��L�L�$�$�S�)�E��d�l�l�#�t�~�~�5����$�$�%�$�0��d�l�l�#�t�~�~�5� %�D�L�L�����	��	�s�B�	B�Bc�l�|jj�|jj�yrM)rurYrx)r_s r$rYz
LRUMemo.clear�s"�������������r&N)	rr-r.r/r`r~r�r�rYr4r&r$rrrr�s ���1�
%�"�&�r&rrc��eZdZdZd�Zy)�
UnboundedMemoz<
    A memoizing mapping that retains all deleted items
    c��yrMr4r}s  r$r�zUnboundedMemo.__delitem__�s��r&N)rr-r.r/r�r4r&r$r�r��s���
r&r�r?c��dD]}|j|t|z�}�|jdd�}|jdd�}t|�S)Nz\^-[]r<z\n�	z\t)�replace�_bslashr)r?�cs  r$�_escape_regex_range_charsr��sN��
�&��
�I�I�a��1��%��&�	�	�	�$���A�	�	�	�$���A��q�6�Mr&�	re_escapec�����fd��d�_tj��_d�_d�}d�}|s|}g}djt
t|���}t|�dkDr�tj|���D]�\}}t|�x}}tjtjt|g�|�d	�
�j�}||k(r|j!||���st#|�t#|�d	zk(rdnd}	|j!||��|	�||������n|D�
cgc]
}
||
���}}
dj|�Scc}
w)Nc���t|�}|�jc�_}||z
dkDrt�j��_�jS)Nr;)�ord�prevrg�counterr#)r��c_intr��is_consecutives   �r$r�z2_collapse_string_to_ranges.<locals>.is_consecutive�sL����A���$)�>�+>�+>�!���T��4�<�!��#'��(>�(>�#?�N� ��#�#�#r&r���c��|dvrd|zS|S)Nz\^-][�\r4�r�s r$�escape_re_range_charz8_collapse_string_to_ranges.<locals>.escape_re_range_char�s����=�t�a�x�/�a�/r&c��|SrMr4r�s r$�no_escape_re_range_charz;_collapse_string_to_ranges.<locals>.no_escape_re_range_char�s���r&�r)rPr;)�maxlen�-)r�rnrBr�r#�join�sortedr^r=�groupbyrgrv�deque�chain�iterrm�appendr�)r?r�r�r��retrO�chars�firstr��sepr�r�s           @r$�_collapse_string_to_rangesr��sN���$��N��&�_�_�.�N���N��0���6��
�C�
����s�1�v���A�
�1�v��z�!�)�)�!��@�	�H�A�u���;�&�E�D��$�$�����d�V��e�4�Q���c�e�
���}��
�
�/��6�7���I��U��a��7�b�S���
�
�+�E�2�3�C�5�9M�d�9S�8T�U��	�12�2�1�#�A�&�2��2�
�7�7�3�<���3s�=E�llc��g}|D]>}t|t�r|jt|���.|j	|��@|SrM)�
isinstance�list�extend�_flattenr�)r�r�rhs   r$r�r��sB��
�C�
����a����J�J�x��{�#��J�J�q�M�	�
�Jr&�compat_name�fnc�:��t�d���dttj��j�dk(rt���fd��}nt���fd��}d�j�d�|_||_�j|_t�tj�r�j|_n?t�t�r(t�d�r�jj|_nd|_�j |_t#t$|�S)	N�__func__r_rc����|g|��i|��SrMr4)r_�args�kwargsr�s   �r$�_innerz&_make_synonym_function.<locals>._inner�s���
�d�,�T�,�V�,�,r&c����|i|��SrMr4)r�r�r�s  �r$r�z&_make_synonym_function.<locals>._inners���
�t�&�v�&�&r&zDeprecated - use :class:`�`r`)rr��inspect�	signature�
parametersrrr/r0r�r\�FunctionType�__kwdefaults__�type�hasattrr`r.r
r)r�r�r�s ` r$�_make_synonym_functionr��s����

��Z��	$�B���g�'�'��+�6�6�7��:�:�	�r��	-�
�	-�
�r��	'�
�	'�3�2�;�;�-�q�C�F�N�!�F�O��/�/�F���"�e�(�(�)� "� 1� 1���	�B��	�'�"�j�"9� "��� :� :��� $����/�/�F����6�?�r&c����fd�S)zZ
    Decorator for pre-PEP8 compatibility synonyms, to link them to the new function.
    c�0��t|j��SrM)r�r)�otherr�s �r$r+z"replaced_by_pep8.<locals>.<lambda>s���/�����C�r&r4)r�s`r$�replaced_by_pep8r�s���D�Cr&)T)$r�rr\rvrn�	functoolsrr�typingrrrrr	r
�chrr�rr�intrr@rCrHrJrcrr�dictr�r��boolr�r�r�r�r�r4r&r$�<module>r�s��������&�A�A�

�b�'���C�x� ��C�C�2�3��
Y�S�
Y��
Y��
Y��
Y� �3��
(��
(�3�
(�3�
(��
(��3��P�c�P��P��P��P�3�3�*3�3�8$�$�N
�D�
������59�)��S�(�3�-�
� �)�-1�)��)�X���$��%��%��%�q�%�PD��D�x��
�A�
�6�Dr&

Zerion Mini Shell 1.0