o
    5e!                     @   s  d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm	Z	m
Z
mZmZmZmZ edZede	dZG dd dZed	d
dededefddZed	d
dededefddZed	d
dededefddZG dd dZG dd dZG dd dZG dd deZdedefddZ	d,deeee f d edefd!d"Zd#e de fd$d%Z!d&ed'edefd(d)Z"d'ede	e	gef fd*d+Z#dS )-    N)	lru_cachewraps)CallableListUnionIterableTypeVarcast\   C)boundc                   @   sZ   e Zd ZU dZg Zee ed< g Zee ed< dZ	e
dd Ze
dd Ze
d	d Zd
S )__config_flagsz=Internal class for defining compatibility and debugging flags
_all_names_fixed_namesconfigurationc                 C   sv   || j v r#tj| j d| d| j dtt| |  ddd d S || jv r0t	| || d S t
d| j d|)N. z is z and cannot be overridden   )
stacklevelzno such )r   warningswarn__name__
_type_descstrgetattrupperr   setattr
ValueError)clsdnamevalue r!   M/var/www/html/venv/lib/python3.10/site-packages/pip/_vendor/pyparsing/util.py_set   s   
,
z__config_flags._setc                 C      |  |dS )NTr#   r   namer!   r!   r"   <lambda>#       z__config_flags.<lambda>c                 C   r$   )NFr%   r&   r!   r!   r"   r(   $   r)   N)r   
__module____qualname____doc__r   r   r   __annotations__r   r   classmethodr#   enabledisabler!   r!   r!   r"   r      s   
 
r      )maxsizelocstrgreturnc                 C   sF   |}d|   k rt |k rn n
|| d  dkrdS | |dd|  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)r3   r4   sr!   r!   r"   col'   s   Br;   c                 C   s   | dd| d 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.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.
    r7   r   r6   )count)r3   r4   r!   r!   r"   lineno8   s   r=   c                 C   sB   | dd| }|d| }|dkr||d | S ||d d S )zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r7   r   r6   N)r9   find)r3   r4   last_crnext_crr!   r!   r"   lineF   s   (rA   c                   @      e Zd Zdd ZdS )_UnboundedCachec                    sp   i   j t  | _fdd} fdd} fdd}d | _t|| | _ t|| | _t|| | _d S )Nc                    
    |S Nr!   _key	cache_getnot_in_cacher!   r"   getV      
z%_UnboundedCache.__init__.<locals>.getc                    s   | |< d S rE   r!   )rG   rH   r    cacher!   r"   set_Y      z&_UnboundedCache.__init__.<locals>.set_c                    s       d S rE   )clearrG   rN   r!   r"   rR   \   rQ   z'_UnboundedCache.__init__.<locals>.clear)rL   objectrK   sizetypes
MethodTypesetrR   )selfrL   rP   rR   r!   )rO   rJ   rK   r"   __init__Q   s   z_UnboundedCache.__init__Nr   r*   r+   rZ   r!   r!   r!   r"   rC   P       rC   c                   @   rB   )
_FifoCachec                    s   t   | _i  t  g  j jttfdd} fdd} fdd}| _t	|| | _t	|| | _
t	|| | _d S )Nc                    rD   rE   r!   rF   rI   r!   r"   rL   n   rM   z _FifoCache.__init__.<locals>.getc                    s*   | |< t }| d  ||< d S rE   )next)rG   rH   r    i)rO   	cache_popkeyiterkeyringr!   r"   rP   q   s   z!_FifoCache.__init__.<locals>.set_c                    s        t g d d < d S rE   )rR   rT   rS   )rO   rb   rU   r!   r"   rR   w   s   z"_FifoCache.__init__.<locals>.clear)rT   rK   rL   pop	itertoolscyclerangerU   rV   rW   rX   rR   )rY   rU   rL   rP   rR   r!   )rO   rJ   r`   ra   rb   rK   rU   r"   rZ   f   s   z_FifoCache.__init__Nr[   r!   r!   r!   r"   r]   e   r\   r]   c                   @   s8   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zd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.
    c                 C   s   || _ i | _t | _d S rE   )	_capacity_activecollectionsOrderedDict_memory)rY   capacityr!   r!   r"   rZ      s   zLRUMemo.__init__c                 C   s6   z| j | W S  ty   | j| | j|  Y S w rE   )ri   KeyErrorrl   move_to_endrY   rH   r!   r!   r"   __getitem__   s   zLRUMemo.__getitem__c                 C   s   | j |d  || j|< d S rE   )rl   rc   ri   rY   rH   r    r!   r!   r"   __setitem__   s   zLRUMemo.__setitem__c                 C   sb   z| j |}W n
 ty   Y d S w t| j| jkr*| jjdd t| j| jks|| j|< d S )NF)last)ri   rc   rn   r8   rl   rh   popitemrr   r!   r!   r"   __delitem__   s   zLRUMemo.__delitem__c                 C   s   | j   | j  d S rE   )ri   rR   rl   )rY   r!   r!   r"   rR      s   
zLRUMemo.clearN)	r   r*   r+   r,   rZ   rq   rs   rv   rR   r!   r!   r!   r"   rg      s    
rg   c                   @   s   e Zd ZdZdd ZdS )UnboundedMemoz<
    A memoizing mapping that retains all deleted items
    c                 C   s   d S rE   r!   rp   r!   r!   r"   rv         zUnboundedMemo.__delitem__N)r   r*   r+   r,   rv   r!   r!   r!   r"   rw      s    rw   r:   c                 C   s:   dD ]
}|  |t| } q|  dd} |  dd} t| S )Nz\^-[]r7   z\n	z\t)replace_bslashr   )r:   cr!   r!   r"   _escape_regex_range_chars   s
   r}   T	re_escapec           	         s  fddd_ t _d_dd  dd }|s| g }d	tt| } t| d
krztj	| dD ]C\}}t
| }}tjtt|g|dd }||kr[| | q5t|t|d krgd	nd}| | |  |  q5n	 fdd| D }d	|S )Nc                    s4   t | }| j _}|| dkrt j _ jS )Nr6   )ordprevr^   counterr    )r|   c_intr   )is_consecutiver!   r"   r      s
   z2_collapse_string_to_ranges.<locals>.is_consecutiver   c                 S   s   | dv rd|  S | S )Nz\^-][\r!   r|   r!   r!   r"   escape_re_range_char   s   z8_collapse_string_to_ranges.<locals>.escape_re_range_charc                 S   s   | S rE   r!   r   r!   r!   r"   no_escape_re_range_char   rx   z;_collapse_string_to_ranges.<locals>.no_escape_re_range_char r   )rH   r6   )maxlen-c                    s   g | ]} |qS r!   r!   ).0r|   )r   r!   r"   
<listcomp>   s    z._collapse_string_to_ranges.<locals>.<listcomp>)r   rd   r<   r   r    joinsortedrX   r8   groupbyr^   rj   dequechainiterrc   appendr   )	r:   r~   r   retrG   charsfirstrt   sepr!   )r   r   r"   _collapse_string_to_ranges   s6   

r   llc                 C   s6   g }| D ]}t |tr|t| q|| q|S rE   )
isinstancelistextend_flattenr   )r   r   r_   r!   r!   r"   r      s   
r   compat_namefnc                    s   t  d  dtt jd krt  fdd}n
t  fdd}d j d|_| |_ j|_t	 t
jrA j|_nt	 trQt d	rQ jj|_nd |_ j|_tt|S )
N__func__rY   r   c                    s    | g|R i |S rE   r!   )rY   argskwargsr   r!   r"   _inner   s   z&_make_synonym_function.<locals>._innerc                     s    | i |S rE   r!   )r   r   r   r!   r"   r     s   zDeprecated - use :class:``rZ   )r   r   inspect	signature
parametersr   r   r,   r-   r   rV   FunctionType__kwdefaults__typehasattrrZ   r+   r	   r   )r   r   r   r!   r   r"   _make_synonym_function   s    

r   c                    s    fddS )zZ
    Decorator for pre-PEP8 compatibility synonyms, to link them to the new function.
    c                    s   t | j S rE   )r   r   )otherr   r!   r"   r(     r)   z"replaced_by_pep8.<locals>.<lambda>r!   r   r!   r   r"   replaced_by_pep8  s   r   )T)$r   r   rV   rj   rd   	functoolsr   r   typingr   r   r   r   r   r	   chrr{   r   r   intr   r;   r=   rA   rC   r]   rg   dictrw   r}   boolr   r   r   r   r   r!   r!   r!   r"   <module>   s@    	'	

,
 (