
    4Ysh                        d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm	Z	  e
d      Z G d d      Z ed      d	ed
edefd       Z ed      d	ed
edefd       Z ed      d	ed
edefd       Z G d d      Z G d d      Z G d d      Z G d de      ZdedefdZ	 ddeee	e   f   dedefdZdedefdZy)    N)	lru_cache)ListUnionIterable\   c                   r    e Zd ZU dZg Zee   ed<   g Zee   ed<   dZ	e
d        Z e
d       Z e
d       Zy)	__config_flagsz=Internal class for defining compatibility and debugging flags
_all_names_fixed_namesconfigurationc                 Z   || j                   v r]t        j                  dj                  | j                  || j
                  t        t        | |            j                                      y || j                  v rt        | ||       y t        dj                  | j
                  |            )Nz'{}.{} {} is {} and cannot be overriddenzno such {} {!r})r   warningswarnformat__name__
_type_descstrgetattrupperr
   setattr
ValueError)clsdnamevalues      n/var/www/sten-cake5-migrate2.hellocrow.space/lexinfo-master/env/lib/python3.12/site-packages/pyparsing/util.py_setz__config_flags._set   s    C$$$MM9@@LLNNU+,224	 CNN"C&.55cnneLMM    c                 &    | j                  |d      S )NTr   r   names     r   <lambda>z__config_flags.<lambda>$   s    388D$+? r   c                 &    | j                  |d      S )NFr   r    s     r   r"   z__config_flags.<lambda>%   s    CHHT5,A r   N)r   
__module____qualname____doc__r
   r   r   __annotations__r   r   classmethodr   enabledisable r   r   r	   r	      sR    GJS	 L$s)  JN N  ?@FABGr   r	      )maxsizelocstrgreturnc                 z    |}d| cxk  rt        |      k  rn n|| dz
     dk(  rdS | |j                  dd|       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.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/   ss      r   colr7   (   sG     	AC #a& QsQwZ4%71XS1774QRTWCX=XXr   c                 .    |j                  dd|       dz   S )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.
    r3   r   r2   )count)r.   r/   s     r   linenor:   9   s     ::dAs#a''r   c                 v    |j                  dd|       }|j                  d|       }|dk\  r||dz   | S ||dz   d S )zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r3   r   r2   N)r5   find)r.   r/   last_crnext_crs       r   liner?   G   sM    
 jjq#&Giic"G*1Q,4!g&OD1<OOr   c                       e Zd Zd Zy)_UnboundedCachec                    i j                   t               x| _        fd}fd}fd}d | _        t	        j
                  ||       | _         t	        j
                  ||       | _        t	        j
                  ||       | _        y )Nc                      |      S Nr+   _key	cache_getnot_in_caches     r   getz%_UnboundedCache.__init__.<locals>.getW       S,//r   c                     ||<   y rD   r+   )rF   rG   r   caches      r   set_z&_UnboundedCache.__init__.<locals>.set_Z   s    E#Jr   c                 &    j                          y rD   clearrF   rM   s    r   rQ   z'_UnboundedCache.__init__.<locals>.clear]       KKMr   )rJ   objectrI   sizetypes
MethodTypesetrQ   )selfrJ   rN   rQ   rM   rH   rI   s       @@@r   __init__z_UnboundedCache.__init__R   st    II	+183L	0		 	##C.##D$/%%eT2
r   Nr   r$   r%   rZ   r+   r   r   rA   rA   Q   s    3r   rA   c                       e Zd Zd Zy)
_FifoCachec                 @   t               x| _        t        j                         j                  fd}fd}fd}| _        t        j                  ||       | _        t        j                  ||       | _        t        j                  ||       | _	        y )Nc                      |      S rD   r+   rE   s     r   rJ   z _FifoCache.__init__.<locals>.getl   rK   r   c                 p    ||<   t              kD  r"j                  d       t              kD  r!y y NF)last)r4   popitem)rF   rG   r   rM   rU   s      r   rN   z!_FifoCache.__init__.<locals>.set_o   s4    E#Je*t#5) e*t#r   c                 &    j                          y rD   rP   rR   s    r   rQ   z"_FifoCache.__init__.<locals>.cleart   rS   r   )
rT   rI   collectionsOrderedDictrJ   rU   rV   rW   rX   rQ   )rY   rU   rJ   rN   rQ   rM   rH   rI   s    `   @@@r   rZ   z_FifoCache.__init__g   s}    +183L'')II		0	*
	 	##C.##D$/%%eT2
r   Nr[   r+   r   r   r]   r]   f   s    3r   r]   c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)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 | _        t        j                         | _        y rD   )	_capacity_activere   rf   _memory)rY   capacitys     r   rZ   zLRUMemo.__init__   s     !"..0r   c                     	 | j                   |   S # t        $ r- | j                  j                  |       | j                  |   cY S w xY wrD   )rk   KeyErrorrl   move_to_endrY   rG   s     r   __getitem__zLRUMemo.__getitem__   sF    	%<<$$ 	%LL$$S)<<$$	%s    3AAc                 Z    | j                   j                  |d        || j                  |<   y rD   )rl   poprk   rY   rG   r   s      r   __setitem__zLRUMemo.__setitem__   s$    d#!Sr   c                 :   	 | j                   j                  |      }t        | j                        | j                  k\  r?| j                  j                  d       t        | j                        | j                  k\  r?|| j                  |<   y # t        $ r Y y w xY wra   )rk   rt   r4   rl   rj   rc   ro   ru   s      r   __delitem__zLRUMemo.__delitem__   s    	&LL$$S)E dll#t~~5$$%$0 dll#t~~5 %DLL  		s   B 	BBc                 l    | j                   j                          | j                  j                          y rD   )rk   rQ   rl   )rY   s    r   rQ   zLRUMemo.clear   s"    r   N)	r   r$   r%   r&   rZ   rr   rv   rx   rQ   r+   r   r   rh   rh   }   s     1
%"&r   rh   c                       e Zd ZdZd Zy)UnboundedMemoz<
    A memoizing mapping that retains all deleted items
    c                      y rD   r+   rq   s     r   rx   zUnboundedMemo.__delitem__   s    r   N)r   r$   r%   r&   rx   r+   r   r   r{   r{      s    r   r{   r6   c                     dD ]  }| j                  |t        |z         }  | j                  dd      } | j                  dd      } t        |       S )Nz\^-[]r3   z\n	z\t)replace_bslashr   )r6   cs     r   _escape_regex_range_charsr      sN     &IIa1%&			$A			$Aq6Mr   	re_escapec           
         fdd_         t        j                         _        d_        d }d }|s|}g }dj                  t        t        |                   } t        |       dkD  rt        j                  |       D ]  \  }}t        |      x}}t        j                  t        j                  t        |g      |      d	
      j                         }||k(  r|j!                   ||             st#        |      t#        |      d	z   k(  rdnd}	|j!                  dj%                   ||      |	 ||                    n| D 
cg c]
  }
 ||
       }}
dj                  |      S c c}
w )Nc                     t        |       }|j                  c_        }||z
  dkD  rt        j                        _        j                  S )Nr2   )ordprevnextcounterr   )r   c_intr   is_consecutives      r   r   z2_collapse_string_to_ranges.<locals>.is_consecutive   sL    A$)>+>+>!T4<!#'(>(>#?N ###r   r   c                     | dv rd| z   S | S )Nz\^-][\r+   r   s    r   escape_re_range_charz8_collapse_string_to_ranges.<locals>.escape_re_range_char   s    =tax/a/r   c                     | S rD   r+   r   s    r   no_escape_re_range_charz;_collapse_string_to_ranges.<locals>.no_escape_re_range_char   s    r       )rG   r2   )maxlen-z{}{}{})r   	itertoolsr9   r   r   joinsortedrX   r4   groupbyr   re   dequechainiterrt   appendr   r   )r6   r   r   r   retrF   charsfirstrb   sepr   r   s              @r   _collapse_string_to_rangesr      sO   $ N&__.NN0 6
C
s1vA
1vz!))!@ 	HAu;&ED$$dVe4Qce  }

/67IUa7bS

OO,U3S:Nt:T	 1221#A&22773< 3s   E*llc                     g }| D ]>  }t        |t              r|j                  t        |             .|j	                  |       @ |S rD   )
isinstancelistextend_flattenr   )r   r   is      r   r   r      sB    
C aJJx{#JJqM	
 Jr   )T)r   rV   re   r   	functoolsr   typingr   r   r   chrr   r	   intr   r7   r:   r?   rA   r]   rh   dictr{   r   boolr   r   r   r+   r   r   <module>r      sE        ( (
b'C C8 3YS Y Y Y Y  3
( 
(3 
(3 
( 
( 3Pc P P P P3 3*3 3.$ $ND    59+S(3- +-1++\ $ r   