U
    &%e!                     @   sx  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
eeedddZed	d
eeedddZed	d
eeedddZG dd dZG dd dZG dd dZG dd deZeedddZd*eeee f eeddd Ze e d!d"d#Z!eeed$d%d&Z"ee	e	gef d'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   sx   || j krFtj| j d| d| j dtt| |  ddd d S || jkr^t	| || nt
d| j d|d S )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!   Y/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/pip/_vendor/pyparsing/util.py_set   s    
,
z__config_flags._setc                 C   s   |  |dS )NTr#   r   namer!   r!   r"   <lambda>#       z__config_flags.<lambda>c                 C   s   |  |dS )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 r4n n|| d  dkr4d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)r2   r3   sr!   r!   r"   col'   s    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.
    r6   r   r5   )count)r2   r3   r!   r!   r"   lineno8   s    r<   c                 C   sB   | dd| }|d| }|dkr2||d | S ||d d S )zh
    Returns the line of text containing loc within a string, counting newlines as line separators.
    r6   r   r5   N)r8   find)r2   r3   last_crnext_crr!   r!   r"   lineF   s    r@   c                   @   s   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
    |S Nr!   _key	cache_getnot_in_cacher!   r"   getV   s    z%_UnboundedCache.__init__.<locals>.getc                    s   | |< d S rB   r!   )rD   rE   r    cacher!   r"   set_Y   s    z&_UnboundedCache.__init__.<locals>.set_c                    s       d S rB   )clearrD   rJ   r!   r"   rM   \   s    z'_UnboundedCache.__init__.<locals>.clear)rI   objectrH   sizetypes
MethodTypesetrM   )selfrI   rL   rM   r!   )rK   rG   rH   r"   __init__Q   s    z_UnboundedCache.__init__Nr   r)   r*   rU   r!   r!   r!   r"   rA   P   s   rA   c                   @   s   e Zd Zdd ZdS )
_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                    s
    |S rB   r!   rC   rF   r!   r"   rI   n   s    z _FifoCache.__init__.<locals>.getc                    s*   | |< t }| d  ||< d S rB   )next)rD   rE   r    i)rK   	cache_popkeyiterkeyringr!   r"   rL   q   s    z!_FifoCache.__init__.<locals>.set_c                    s        t g d d < d S rB   )rM   rO   rN   )rK   r\   rP   r!   r"   rM   w   s    z"_FifoCache.__init__.<locals>.clear)rO   rH   rI   pop	itertoolscyclerangerP   rQ   rR   rS   rM   )rT   rP   rI   rL   rM   r!   )rK   rG   rZ   r[   r\   rH   rP   r"   rU   f   s    z_FifoCache.__init__NrV   r!   r!   r!   r"   rW   e   s   rW   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 rB   )	_capacity_activecollectionsOrderedDict_memory)rT   capacityr!   r!   r"   rU      s    zLRUMemo.__init__c                 C   s<   z| j | W S  tk
r6   | j| | j|  Y S X d S rB   )rc   KeyErrorrf   move_to_endrT   rE   r!   r!   r"   __getitem__   s
    zLRUMemo.__getitem__c                 C   s   | j |d  || j|< d S rB   )rf   r]   rc   rT   rE   r    r!   r!   r"   __setitem__   s    zLRUMemo.__setitem__c                 C   sT   z| j |}W n tk
r$   Y n,X t| j| jkrF| jjdd q&|| j|< d S )NF)last)rc   r]   rh   r7   rf   rb   popitemrl   r!   r!   r"   __delitem__   s    zLRUMemo.__delitem__c                 C   s   | j   | j  d S rB   )rc   rM   rf   )rT   r!   r!   r"   rM      s    
zLRUMemo.clearN)	r   r)   r*   r+   rU   rk   rm   rp   rM   r!   r!   r!   r"   ra      s   
ra   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 rB   r!   rj   r!   r!   r"   rp      s    zUnboundedMemo.__delitem__N)r   r)   r*   r+   rp   r!   r!   r!   r"   rq      s   rq   )r9   r4   c                 C   s:   dD ]}|  |t| } q|  dd} |  dd} t| S )Nz\^-[]r6   z\n	z\t)replace_bslashr   )r9   cr!   r!   r"   _escape_regex_range_chars   s
    rv   T)r9   	re_escaper4   c           	         s  fddd_ t _d_dd  dd }|s:| g }d	tt| } t| d
krtj	| dD ]\}}t
| }}tjtt|g|dd }||kr| | qjt|t|d krd	nd}| | |  |  qjn fdd| D }d	|S )Nc                    s4   t | }| j  _}|| dkr.t j _ jS )Nr5   )ordprevrX   counterr    )ru   c_intry   )is_consecutiver!   r"   r|      s
    z2_collapse_string_to_ranges.<locals>.is_consecutiver   c                 S   s   | dkrd|  S | S )Nz\^-][\r!   ru   r!   r!   r"   escape_re_range_char   s    z8_collapse_string_to_ranges.<locals>.escape_re_range_charc                 S   s   | S rB   r!   r   r!   r!   r"   no_escape_re_range_char   s    z;_collapse_string_to_ranges.<locals>.no_escape_re_range_char r   )rE   r5   )maxlen-c                    s   g | ]} |qS r!   r!   ).0ru   )r   r!   r"   
<listcomp>   s     z._collapse_string_to_ranges.<locals>.<listcomp>)ry   r^   r;   rz   r    joinsortedrS   r7   groupbyrX   rd   dequechainiterr]   appendrx   )	r9   rw   r   retrD   charsfirstrn   sepr!   )r   r|   r"   _collapse_string_to_ranges   s2    
 
r   )llr4   c                 C   s6   g }| D ](}t |tr&|t| q|| q|S rB   )
isinstancelistextend_flattenr   )r   r   rY   r!   r!   r"   r      s    
r   )compat_namefnr4   c                    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r j|_n&t	 trt d	r jj|_nd |_ j|_tt|S )
N__func__rT   r   c                    s    | f||S rB   r!   )rT   argskwargsr   r!   r"   _inner   s    z&_make_synonym_function.<locals>._innerc                     s
    | |S rB   r!   )r   r   r   r!   r"   r     s    zDeprecated - use :class:``rU   )r   r   inspect	signature
parametersr   r   r+   r,   r   rQ   FunctionType__kwdefaults__typehasattrrU   r*   r	   r   )r   r   r   r!   r   r"   _make_synonym_function   s     
r   )r   r4   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 rB   )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   rQ   rd   r^   	functoolsr   r   typingr   r   r   r   r   r	   chrrt   r   r   intr   r:   r<   r@   rA   rW   ra   dictrq   rv   boolr   r   r   r   r   r!   r!   r!   r"   <module>   s:    	'	
  ,
(