o
    ~#g                     @   s>  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 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S )%    N)	lru_cache)ListUnionIterable\   c                   @   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   sb   || j v rtd| j|| jtt| |  d S || j	v r(t
| || d S td| j|)Nz'{}.{} {} is {} and cannot be overriddenzno such {} {!r})r	   warningswarnformat__name__
_type_descstrgetattrupperr   setattr
ValueError)clsdnamevalue r   /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/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.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+   sr   r   r   col(   s   Br2   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.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.   r   r-   )count)r*   r+   r   r   r   lineno9   s   r4   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.
    r.   r   r-   N)r0   find)r*   r+   last_crnext_crr   r   r   lineG   s   (r8   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   getW      
z%_UnboundedCache.__init__.<locals>.getc                    s   | |< d S r<   r   r>   r?   r   cacher   r   set_Z      z&_UnboundedCache.__init__.<locals>.set_c                           d S r<   clearr>   rF   r   r   rL   ]   rI   z'_UnboundedCache.__init__.<locals>.clear)rC   objectrB   sizetypes
MethodTypesetrL   )selfrC   rH   rL   r   )rG   rA   rB   r   __init__R   s   z_UnboundedCache.__init__Nr   r!   r"   rT   r   r   r   r   r:   Q       r:   c                   @   r9   )
_FifoCachec                    sv   t   | _t   jfdd} fdd} fdd}| _t|| | _t|| | _t|| | _	d S )Nc                    r;   r<   r   r=   r@   r   r   rC   l   rD   z _FifoCache.__init__.<locals>.getc                    s4   | |< t  kr jdd t  ks
d S d S NF)last)r/   popitemrE   )rG   rO   r   r   rH   o   s   z!_FifoCache.__init__.<locals>.set_c                    rJ   r<   rK   rM   rF   r   r   rL   t   rI   z"_FifoCache.__init__.<locals>.clear)
rN   rB   collectionsOrderedDictrC   rO   rP   rQ   rR   rL   )rS   rO   rC   rH   rL   r   )rG   rA   rB   rO   r   rT   g   s   z_FifoCache.__init__NrU   r   r   r   r   rW   f   rV   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 r<   )	_capacity_activer[   r\   _memory)rS   capacityr   r   r   rT      s   zLRUMemo.__init__c                 C   s6   z| j | W S  ty   | j| | j|  Y S w r<   )r_   KeyErrorr`   move_to_endrS   r?   r   r   r   __getitem__   s   zLRUMemo.__getitem__c                 C   s   | j |d  || j|< d S r<   )r`   popr_   rS   r?   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 rX   )r_   rf   rb   r/   r`   r^   rZ   rg   r   r   r   __delitem__   s   zLRUMemo.__delitem__c                 C   s   | j   | j  d S r<   )r_   rL   r`   )rS   r   r   r   rL      s   
zLRUMemo.clearN)	r   r!   r"   r#   rT   re   rh   ri   rL   r   r   r   r   r]   }   s    
r]   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 r<   r   rd   r   r   r   ri         zUnboundedMemo.__delitem__N)r   r!   r"   r#   ri   r   r   r   r   rj      s    rj   r1   c                 C   s:   dD ]
}|  |t| } q|  dd} |  dd} t| S )Nz\^-[]r.   z\n	z\t)replace_bslashr   )r1   cr   r   r   _escape_regex_range_chars   s
   rp   T	re_escapec           	   	      s  fddd_ t _d_dd  dd }|s| g }d	tt| } t| d
krytj	| dD ]B\}}t
| }}tjtt|g|dd }||kr[| | q5t|t|d krgd	nd}|d || | q5n	 fdd| D }d	|S )Nc                    s4   t | }| j _}|| dkrt j _ jS )Nr-   )ordprevnextcounterr   )ro   c_intrs   )is_consecutiver   r   rw      s
   z2_collapse_string_to_ranges.<locals>.is_consecutiver   c                 S   s   | dv rd|  S | S )Nz\^-][\r   ro   r   r   r   escape_re_range_char   s   z8_collapse_string_to_ranges.<locals>.escape_re_range_charc                 S   s   | S r<   r   rz   r   r   r   no_escape_re_range_char   rk   z;_collapse_string_to_ranges.<locals>.no_escape_re_range_char    )r?   r-   )maxlen-z{}{}{}c                    s   g | ]} |qS r   r   ).0ro   )r{   r   r   
<listcomp>   s    z._collapse_string_to_ranges.<locals>.<listcomp>)rs   	itertoolsr3   ru   r   joinsortedrR   r/   groupbyrt   r[   dequechainiterrf   appendrr   r   )	r1   rq   r|   retr>   charsfirstrY   sepr   )r{   rw   r   _collapse_string_to_ranges   s:   

r   llc                 C   s6   g }| D ]}t |tr|t| q|| q|S r<   )
isinstancelistextend_flattenr   )r   r   ir   r   r   r      s   
r   )T)r   rP   r[   r   	functoolsr   typingr   r   r   chrrn   r   intr   r2   r4   r8   r:   rW   r]   dictrj   rp   boolr   r   r   r   r   r   r   <module>   s8   	'	

.