
    C`              	           d dl mZ d dlmZ d dlmZ  edg d          Z G d de          Z e	            f e
eee ed          f          eeeefd	ZddZdS )    )
namedtuple)update_wrapper)RLock	CacheInfo)hitsmissesmaxsizecurrsizec                   "    e Zd ZdZefdZd ZdS )
_HashedSeq	hashvaluec                 4    || d d <    ||          | _         d S Nr   )selftuphashs      ,lib/python3.11/site-packages/glob2/compat.py__init__z_HashedSeq.__init__   s"    QQQc    c                     | j         S r   r   )r   s    r   __hash__z_HashedSeq.__hash__   s
    ~r   N)__name__
__module____qualname__	__slots__r   r   r    r   r   r   r   
   s?        I!% # # # #    r   r   Nc	                 H   | }	|r, ||                                           }
|	|z  }	|
D ]}|	|z  }	|r7|	 |fd| D                       z  }	|r|	 |fd|
D                       z  }	n* ||	          dk    r |	d                   |v r|	d         S t          |	          S )zGMake a cache key from optionally typed positional and keyword argumentsc              3   .   K   | ]} |          V  d S r   r   ).0vtypes     r   	<genexpr>z_make_key.<locals>.<genexpr>    s+      ++TT!WW++++++r   c              3   4   K   | ]\  }} |          V  d S r   r   )r    kr!   r"   s      r   r#   z_make_key.<locals>.<genexpr>"   s/      ::TQa::::::r      r   )itemsr   )argskwdstypedkwd_mark	fasttypessortedtupler"   lenkeysorted_itemsitems          `    r   	_make_keyr3      s    
 C vdjjll++x  	 	D4KCC uu++++d++++++ 	;55::::\::::::C	SQ44A<<9441vc??r   d   Fc                       fd}|S )a  Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize) with
    f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used

    c                    	
 t                      ddgd\  t          j        t          
t	                      g d d gd d <   gd\  	dk    r fd}n$ f	d}n	
 fd}fd}fd} |_        ||_        ||_        t          |           S )	Nr   )r   r&   )r   r&         c                  8     | i |}xx         dz  cc<   |S Nr&   r   )r(   r)   resultMISSESstatsuser_functions      r   wrapperz7lru_cache.<locals>.decorating_function.<locals>.wrapperP   s2    &555f"r   c                     	  | |          } |	          }|	ur
xx         dz  cc<   |S  | i |}||<   
xx         dz  cc<   |S r:   r   )r(   r)   r0   r;   HITSr<   cache	cache_getmake_keyrootr=   r*   r>   s       r   r?   z7lru_cache.<locals>.decorating_function.<locals>.wrapperX   s    htT511"3--%%$KKK1$KKK!M&555#c
f"r   c                  b   |sr | |          n| }5   |          }|O\  }|\  }}}}||<   ||<   |         }|x|<   |<   ||<   ||<   xx         dz  cc<   |cd d d            S 	 d d d            n# 1 swxY w Y    | i |}5  \  }|v rnh           k    r<|}	||	<   ||	<   |	         x}d<   |         }
|         }d x|<   |<   |
= |	|<   n|         }||||g}|x|<   x|<   |<   xx         dz  cc<   d d d            n# 1 swxY w Y   |S )Nr&   r   r   )r(   r)   r0   linkrE   	link_prev	link_nextr;   lastoldrootoldkeyoldvaluerA   KEYr<   NEXTPREVRESULT_lenrB   rC   lockrD   r	   nonlocal_rootr=   r*   r>   s               r   r?   z7lru_cache.<locals>.decorating_function.<locals>.wrapperf   su   59LULhhtT5111 & &$9S>>D' -<@9	9c6*3	$*3	$#Dz266T
T$Z%)T
%)T
dq(%& & & & & & & &'& & & & & & & & & & & & & & & '555 ' ')EDe||
 e//"&'**029$-?}Q/!%c#'<377S	DL!&M%,c

  $Dz $dC8?CCT
CT$Z%*&MMMQ&MMM5' ' ' ' ' ' ' ' ' ' ' ' ' ' '6 s%   ABBBBD$$D(+D(c            	          5  t                             t                              cddd           S # 1 swxY w Y   dS )zReport cache statisticsN)
_CacheInfor/   )rA   r<   rB   rS   r	   r=   s   r   
cache_infoz:lru_cache.<locals>.decorating_function.<locals>.cache_info   s     S S!%+uV}gs5zzRRS S S S S S S S S S S S S S S S S Ss   +<A A c                      5                                    d         } | | ddg| dd<   ddgdd<   ddd           dS # 1 swxY w Y   dS )z$Clear the cache and cache statisticsr   N)clear)rE   rB   rS   rT   r=   s    r   cache_clearz;lru_cache.<locals>.decorating_function.<locals>.cache_clear   s     " "$Q'tT2QQQq6aaa	" " " " " " " " " " " " " " " " " "s   1AA	A)	dictr3   getr/   r   __wrapped__rW   rZ   r   )r>   r?   rW   rZ   rA   rN   r<   rO   rP   rQ   rR   rB   rC   rS   rD   rT   rE   r=   r	   r*   s   `   @@@@@@@@@@@@@@r   decorating_functionz&lru_cache.<locals>.decorating_function@   s   AfI	wwtT*QQQ",dCa<<        _
 
 
 
 
 
 
 
 
 
 
 
 
 
- - - - - - - - - - - - - - - - - - - -^	S 	S 	S 	S 	S 	S 	S 	S 	S 	S
	" 	" 	" 	" 	" 	" 	" 	" ,')g}555r   r   )r	   r*   r^   s   `` r   	lru_cacher_   '   s1    2e6 e6 e6 e6 e6 e6N r   )r4   F)collectionsr   	functoolsr   	threadingr   rV   listr   objectsetintstr	frozensetr"   r-   r.   r/   r3   r_   r   r   r   <module>ri      s    # " " " " " $ $ $ $ $ $      Z%N%N%NOO
         c3	44::>??%d   &@ @ @ @ @ @r   